Text Classification
Transformers
Safetensors
English
roberta
agent-traces
post-training
sft-filter
rl-rollouts
renaissancelabs
text-embeddings-inference
Instructions to use RenaissanceLabsEU/trace-loop-classifier with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use RenaissanceLabsEU/trace-loop-classifier with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="RenaissanceLabsEU/trace-loop-classifier")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("RenaissanceLabsEU/trace-loop-classifier") model = AutoModelForSequenceClassification.from_pretrained("RenaissanceLabsEU/trace-loop-classifier", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from RenaissanceLabsEU/trace-loop-classifier: direct link, hf CLI and curl.
- Browser
- Download file 6.02 kB
-
https://huggingface.co/RenaissanceLabsEU/trace-loop-classifier/resolve/main/README.md
- Command line
-
hf download hf://RenaissanceLabsEU/trace-loop-classifier/README.md
-
curl -L -o README.md https://huggingface.co/RenaissanceLabsEU/trace-loop-classifier/resolve/main/README.md
6.02 kB
metadata
license: apache-2.0
base_model: distilroberta-base
datasets:
- open-thoughts/AgentTrove
- Agent-Ark/Toucan-1.5M
- openbmb/UltraData-SFT-Agent-2609
- jupyter-agent/jupyter-agent-dataset
- FineEnvs/SmolDataEnvs-sft
- jedisct1/security-audits
- SWE-bench/SWE-smith-trajectories
- Lego-X/LegoFlow-SWE
language:
- en
tags:
- text-classification
- agent-traces
- post-training
- sft-filter
- rl-rollouts
- renaissancelabs
library_name: transformers
trace-loop-classifier
A fast, lightweight (82M-parameter distilroberta-base) binary classifier trained by Renaissance Labs to detect agent stall loops and semantic repetition in multi-turn tool-calling and coding-agent trajectories — built to complement exact-match regex filters in SFT data curation and RL rollout monitoring (motivated by Marin #12264).
Labels:
0(clean): normal multi-turn progress (including legitimate single-retry-then-succeed recoveries)1(loop_or_stall): consecutive stalls, argument-jittered retries, A-B-A-B oscillations, circular apology/plan-restate stalls, or doom-loop suffix repetition
Benchmark results (vs. exact-match regex baselines)
Evaluated on both in-distribution held-out trajectories (test_id, 217 traces from 6 permissive sources) and unseen-source OOD trajectories (test_ood, 500 traces from SWE-bench/SWE-smith-trajectories and Lego-X/LegoFlow-SWE, never seen during training):
In-distribution test (test_id, n = 217)
| Detector | F1 | Precision | Recall | Accuracy | AUROC | Latency |
|---|---|---|---|---|---|---|
Regex: consecutive exact stall (>=3x) |
0.3762 |
1.0000 |
0.2317 |
0.7097 |
0.6159 |
<0.1 ms |
Regex: spread exact duplicate (>=30%) |
0.5487 |
1.0000 |
0.3780 |
0.7650 |
0.6890 |
<0.1 ms |
Regex: combined (exact OR spread) |
0.6102 |
1.0000 |
0.4390 |
0.7880 |
0.7195 |
<0.1 ms |
RenaissanceLabsEU/trace-loop-classifier |
0.9487 |
1.0000 |
0.9024 |
0.9631 |
0.9587 |
17.7 ms/trace (M5 MPS) |
Unseen-source OOD test (test_ood, n = 500: SWE-smith + LegoFlow-SWE)
| Detector | F1 | Precision | Recall | Accuracy | AUROC | Latency |
|---|---|---|---|---|---|---|
Regex: consecutive exact stall (>=3x) |
0.4266 |
1.0000 |
0.2711 |
0.6720 |
0.6356 |
<0.1 ms |
Regex: spread exact duplicate (>=30%) |
0.0769 |
1.0000 |
0.0400 |
0.5680 |
0.5200 |
<0.1 ms |
Regex: combined (exact OR spread) |
0.4483 |
1.0000 |
0.2889 |
0.6800 |
0.6444 |
<0.1 ms |
RenaissanceLabsEU/trace-loop-classifier |
0.9933 |
1.0000 |
0.9867 |
0.9940 |
0.9912 |
18.1 ms/trace (M5 MPS) |
OOD breakdown by subtype (test_ood)
| Subtype | True label | Count | Accuracy |
|---|---|---|---|
clean (real unseen SWE traces) |
0 |
225 |
100.0% |
hard_neg_single_retry (1 retry → success) |
0 |
50 |
100.0% |
exact_stall (3–5× consecutive repeat) |
1 |
54 |
100.0% |
jitter_retry (argument/comment-tweaked retries) |
1 |
36 |
100.0% |
ab_oscillation (A-B-A-B cycle) |
1 |
42 |
100.0% |
apology_stall (circular plan-restate / apology) |
1 |
40 |
100.0% |
doom_suffix (repeated tail chunk) |
1 |
50 |
100.0% |
real_loop (natural spread-out repeats in 99-turn LegoFlow-SWE runs) |
1 |
3 |
0.0% (see Limits) |
Run Card
- Base model:
distilroberta-base(82M params, Apache-2.0) - Splits:
1,346train /209val /217ID test (from 6 Apache-2.0 / MIT HF trace datasets:AgentTrove,Toucan-1.5M,UltraData-SFT-Agent-2609,jupyter-agent-dataset,SmolDataEnvs-sft,security-audits) +500unseen-source OOD test (SWE-smith-trajectories,LegoFlow-SWE). - Truncation:
max_length=512,truncation_side="left"(always preserves the tail of the trajectory where stalls occur). - Hyperparameters: full fine-tune in fp32,
AdamW,lr=3e-5, cosine warmup,batch_size=8,grad_accum=2(eff batch 16),4epochs, best checkpoint selected by validation F1 (0.9867, val AUROC0.9999). - Hardware & wall-clock: Apple M5 (MPS),
429.5s(~7 minutes total).
Quick start
from transformers import pipeline
clf = pipeline(
"text-classification",
model="RenaissanceLabsEU/trace-loop-classifier",
truncation=True,
max_length=512,
)
# Format trajectory as [ROLE] content lines (keep the tail for long runs)
trace = "[USER] Fix failing tests\n[ASSISTANT] Running pytest...\n[TOOL] Exit code 1\n..."
print(clf(trace))
Honest limits & recommended usage
- 512-token tail window misses early-episode spread-out repeats: On the 3 natural
real_looptraces intest_ood(LegoFlow-SWE, averaging ~99 turns), the repeated actions happened earlier than the final 512 tokens, so the model scored0/3. Recommended production setup: run this classifier together with a cheap whole-episode exact-duplicate counter (spread_repeat >= 30%ORtrace-loop-classifier >= 0.5). - Synthetic semantic-loop positives: Because natural permissive trace datasets contain relatively few labeled semantic loops, the
jitter_retry,ab_oscillation,apology_stall, anddoom_suffixpositives were injected onto real clean trajectories. Real-world semantic loops outside those templates should be audited before relying on this model as a sole gate. - English-primary: Trained on English-dominant coding and tool-calling traces.
Links & license
- Agentic Traces Audit & Shortlist: RenaissanceLabs-EU/datasets/agentic-traces
- Open Agent Skills: skills.renaissancelabs.eu
- Lab: renaissancelabs.eu
- License: Apache 2.0.