DeLoop: Repeated Actions as Self-Supervision for Long-Horizon Agents
Organizations: Google · Boston University · University of Washington · University of Southern California ·
Abstract
Language-model agents that run long tasks often redo work they have already done: they re-issue a tool call they made earlier and get back exactly the same observation, a step that adds no new information. We identify this failure as a loop. Loops appear natively in Qwen, Llama, and Gemini agents and become far more common once the agent's history is compressed to fit its context window. To reduce these loops, we propose DeLoop, a self-supervised training method. DeLoop builds on a simple observation: the agent's own rollout can provide the supervision needed to learn from its loops. We use a looping action as a negative example and the first later non-looping action in the same rollout as a positive example. DeLoop learns from these pairs through direct preference optimization and does not require task rewards, gold answers, or LLM judges. On CodeGym under compression, DeLoop reduces the share of Qwen3-8B tasks containing loops from 57.3% to 6.1%. It also uses about one third as many steps per task, with similar task success. On Qwen3-32B, DeLoop reduces loops and steps while raising task success from 37.7% to 44.8%.
Figures & tables
| Method | Supervision (labels needed) | Loop (%) | Success (%) | Steps | Tokens/task (k) |
|---|---|---|---|---|---|
| Reference | |||||
| Full history | none | 29.0 | 31.7 | 12.23 | 24.3 |
| Training-free context methods | |||||
| Compressed baseline | none | 57.3 | 25.1 | 15.00 | 23.9 |
| Retrieval memory | none | 42.7 | 27.7 | 13.34 | 26.1 |
| ACON compressor | none | 46.3 | 29.3 | 14.84 | 20.5 |
| Policy | Loop (%) | Success (%) |
|---|---|---|
| Compressed baseline | 57.3 | 25.1 |
| Objective (same loop signal) | ||
| DPO (DeLoop) | 6.1 ( 51.2) | 25.9 (+0.8) |
| KTO | 12.6 | 23.8 |
| IPO | 11.7 | 24.0 |
| Looping-action penalty GRPO | 15.0 | 24.7 |
| Loop (%) | Success (%) | Tokens (k) | ||||
|---|---|---|---|---|---|---|
| Env. | Base | Ours | Base | Ours | Base | Ours |
| ALFWorld | 55.2 | 27.6 ( 27.6) | 37.3 | 38.1 (+0.8) | 9.3 | 6.2 ( 3.1) |
| Open-AgentRL | 79.0 | 73.5 ( 5.5) | 43.9 | 45.5 (+1.6) | – | – |
| AppWorld | 73.7 | 40.9 ( 32.8) | 7.0 | 5.8 ( 1.2) | 17.9 | 14.1 ( 3.8) |
| ScienceWorld | 96.5 | 83.5 ( 13.0) | 3.5 | 1.5 ( 2.0) | 6.5 | 6.0 ( 0.5) |
Appendix figures & tables30 assets
Supplementary material from the paper’s appendix.
Appendix
| Context method | Loop rate (%) | Success (%) | Steps/task | Tokens/task | Fired (%) |
|---|---|---|---|---|---|
| No compression (full history) | 29.0 | 31.7 | 12.23 | 24,319 | 0.0 |
| Summaries | |||||
| Standard rolling summary | 57.3 | 25.1 | 15.00 | 23,915 | 96.6 |
| Instruction-ledger summary | 50.0 | 27.0 | 12.40 | 19,535 | 95.7 |
| Claude-style compact summary | 50.3 | 26.3 | 13.67 | 20,944 | 95.0 |
| LangChain-style summary | 51.7 | 26.3 | 13.25 | 20,725 | 96.7 |
| Context method | Loop (%) | Success (%) |
|---|---|---|
| No compression (full history) | 34.0 | 57.0 |
| Summarization | 47.1 | 54.7 |
| Truncation | 48.7 | 46.0 |
| Claude-style compact summary | 49.0 | 56.0 |
| LangChain-style summary | 49.7 | 49.7 |
| Structured action trace | 64.4 | 46.3 |
| Loop (%) | Success (%) | Steps | Tokens (k) | |||||
|---|---|---|---|---|---|---|---|---|
| Model | Base | DeLoop | Base | DeLoop | Base | DeLoop | Base | DeLoop |
| Qwen3-8B | 57.3 | 6.1 | 25.1 | 25.9 | 15.00 | 4.67 | 23.9 | 12.7 |
| Qwen3-14B | 42.9 | 12.3 | 45.1 | 52.3 | 15.28 | 8.18 | 13.3 | 8.6 |
| Qwen3-32B | 38.5 | 12.9 | 37.7 | 44.8 | 13.54 | 8.82 | 11.4 | 8.1 |
| Qwen3.5-9B | 54.7 | 26.0 | 49.7 | 55.3 | 19.15 | 14.95 | 8.0 | 5.8 |
| Model | Compression | Episodes | Failure, loop (%) | Failure, no loop (%) |
|---|---|---|---|---|
| Qwen3-8B | Summ. 4,096 | 1,500 | 84.9 | 67.7 |
| Qwen3-14B | Summ. 4,096 | 400 | 70.8 | 47.7 |
| Gemini 3.5 Flash-Lite | Summ. 1,400 | 300 | 61.1 | 36.5 |
| Gemini 3.1 Flash | Summ. 1,400 | 300 | 51.3 | 23.9 |
| Gemini 3.6 Flash | Summ. 1,400 | 300 | 41.4 | 12.8 |
| Gemini 3.1 Pro | Summ. 1,400 | 300 | 47.6 | 11.7 |
| Policy | A: verbatim | B: assertion | C: deleted |
|---|---|---|---|
| Compressed baseline | 15.3 | 17.6 | 43.3 |
| DeLoop (ours) | 3.4 | 4.5 | 15.0 |
| Method | Examples | Loop (%) | Success (%) | Steps |
|---|---|---|---|---|
| Full history | — | 29.0 | 31.7 | 12.23 |
| Compressed baseline | — | 57.3 | 25.1 | 15.00 |
| Outcome DPO | 3,910 | 49.5 | 25.8 | 12.95 |
| 8,000 | 34.7 | 25.7 | 10.99 | |
| Gold-label DPO | 3,910 | 37.5 | 26.3 | 10.23 |
| 8,000 | 22.3 | 25.7 | 8.10 |
| Self-mined pairs | Loop (%) | Success (%) | Steps |
|---|---|---|---|
| Compressed baseline | 57.3 | 25.1 | 15.00 |
| 1k | 45.1 | 26.4 | 11.88 |
| 2k | 34.5 | 24.7 | 9.57 |
| 3.9k | 18.6 | 22.2 | 7.47 |
| 8k (DeLoop) | 6.1 | 25.9 | 4.67 |
| 9.4k | 6.7 | 23.0 | 4.82 |
| Training data | Share | Loop (%) | Success (%) | Steps |
|---|---|---|---|---|
| Compressed baseline | — | 57.3 | 25.1 | 15.00 |
| CodeGym only (DeLoop) | 0% | 6.1 | 25.9 | 4.67 |
| + two sources | 10% | 8.3 | 27.6 | 5.55 |
| + two sources | 20% | 11.9 | 26.8 | 6.74 |
| + two sources | 37% | 19.0 | 30.9 | 8.80 |
| + three sources (DeLoop-Mix) | 37% | 10.1 | 30.3 | 5.94 |
| Method | Budget | Labels | Loop (%) | Success (%) | Steps | Tokens/task (k) |
|---|---|---|---|---|---|---|
| Compressed baseline | — | none | 57.3 | 25.1 | 15.00 | 23.9 |
| DeLoop (ours) | 1,000 | none | 45.1 | 26.4 | 11.88 | 22.4 |
| Agent-R-style divergence splice | 1,000 | task success | 52.3 | 24.0 | 13.62 | 27.1 |
| Setting | Loop (%) | Success (%) | Steps |
|---|---|---|---|
| Compressed baseline | 57.3 | 25.1 | 15.00 |
| Default recipe (DeLoop) | 6.1 | 25.9 | 4.67 |
| DPO | |||
| 17.3 | 16.3 | 2.06 | |
| 17.7 | 23.0 | 6.88 | |
| 36.7 | 25.0 | 10.57 | |
| Setting | Mined | Loop (%) | Success (%) | Rounds |
|---|---|---|---|---|
| Compressed baseline | — | 57.3 | 25.1 | 16.34 |
| Default (DeLoop) | 9,403 | 6.1 | 25.9 | 5.47 |
| SFT (chosen action only) | — | 37.7 | 21.3 | 11.71 |
| Mining rule (one change each) | ||||
| Random later chosen | 9,357 | 3.7 | 23.3 | 4.61 |
| Exact-string match | 9,294 | 7.0 | 22.7 | 5.02 |
| Model | Training pairs | Loop (%) | Success (%) | Rounds |
|---|---|---|---|---|
| Qwen3-8B | none | 57.3 | 25.1 | 16.34 |
| Qwen3-8B | 8,000 own | 6.1 | 25.9 | 5.47 |
| Qwen3-8B | 2,331 from 14B | 35.0 | 28.7 | 11.28 |
| Qwen3-14B | none | 42.9 | 45.1 | 15.57 |
| Qwen3-14B | 2,331 own | 12.3 | 52.3 | 8.26 |
| Qwen3-14B | 8,000 from 8B | 9.3 | 44.3 | 7.21 |
| Policy | Looping actions (% of steps) | Informative repeats (% of steps) | Selectivity (%) | Scored steps |
|---|---|---|---|---|
| Compressed baseline | 24.9 | 10.6 | 29.9 | 13,504 |
| DeLoop (ours) | 2.5 | 5.8 | 69.8 | 4,204 |
| DeLoop-Mix (ours) | 2.6 | 7.5 | 74.2 | 5,347 |
| Control | Loop (%) | Success (%) | Steps | Tokens/task (k) |
|---|---|---|---|---|
| Compressed baseline | 57.3 | 25.1 | 15.00 | 23.9 |
| Blocking and decoding | ||||
| Exact duplicate blocker | 46.7 | 25.3 | 14.71 | 24.9 |
| Temperature 0.7 | 63.3 | 29.3 | 16.99 | 18.5 |
| Repetition penalty 1.2 | 65.7 | 29.0 | 16.85 | 14.7 |
| Within-episode controls (act when a stuck detector fires) | ||||
| Method | Reward or signal | Loop (%) | Success (%) | Steps | Tokens/ task (k) | Informative groups (%) |
|---|---|---|---|---|---|---|
| Compressed baseline | none | 57.3 | 25.1 | 15.00 | 23.9 | — |
| Loop signal (no labels) | ||||||
| Looping-action penalty GRPO | per-step penalty | 15.0 | 24.7 | 6.39 | 13.4 | — |
| + mixed prompts | per-step penalty | 18.3 | 28.3 | 7.08 | 13.8 | — |
| Episode-level loop reward GRPO | one reward per episode | 47.3 | 25.3 | 13.53 | 21.8 | — |
| Loop-weighted SFT | weighted imitation | 42.3 | 19.0 | 9.92 | 28.6 | — |
| Training sequence | SFT demonstrations | Loop (%) | Success (%) | Steps |
|---|---|---|---|---|
| Main evaluation | ||||
| DPO only (DeLoop) | — | 6.1 | 25.9 | 4.67 |
| Screening evaluation: objective order | ||||
| DPO only | — | 6.5 | 16.4 | 4.74 |
| DPO SFT | solved CodeGym traces | 29.7 | 12.5 | 10.79 |
| DPO SFT DPO | solved CodeGym traces | 2.3 | 21.1 | 4.62 |
| CodeGym | ALFWorld | ||||
|---|---|---|---|---|---|
| Cross-domain source | Loop (%) | Success (%) | Steps | Loop (%) | Success (%) |
| Compressed baseline | 57.3 | 25.1 | 15.00 | 55.2 | 37.3 |
| SWE-agent | 17.3 | 26.0 | 7.18 | 35.8 | 36.6 |
| OpenHands | 21.0 | 28.7 | 7.88 | 33.6 | 37.3 |
| WebArena | 22.7 | 28.3 | 8.00 | 46.3 | 41.8 |
| Policy | LiveCodeBench | MT-Bench | IFEval (%) |
|---|---|---|---|
| Qwen3-8B (untrained) | 53/182 | 4.225 | 82.8 |
| DeLoop (ours) | 52/182 | 4.463 | 83.5 |
| DeLoop-Mix (ours) | 54/182 | 4.213 | 83.4 |
| Memory policy | Policy | Loop (%) | Success (%) | Steps | Tokens/ task (k) |
|---|---|---|---|---|---|
| Retrieval memory | Compressed baseline | 42.7 | 27.7 | 13.34 | 26.1 |
| DeLoop-Mix (ours) | 10.7 | 31.0 | 6.93 | 11.8 | |
| Instruction ledger | Compressed baseline | 50.0 | 27.0 | 12.40 | 19.5 |
| DeLoop-Mix (ours) | 7.0 | 25.3 | 5.16 | 8.8 | |
| Claude-style compact | Compressed baseline | 50.3 | 26.3 | 13.67 | 20.9 |
| DeLoop-Mix (ours) | 6.3 | 25.7 | 5.84 | 9.3 |
| Model | Setting | Loop (%) | Success (%) | Steps |
|---|---|---|---|---|
| Llama-3.1-8B | Full history | 44.0 | 17.5 | 17.41 |
| Compressed baseline | 43.7 | 17.8 | 17.51 | |
| DeLoop (ours) | 2.0 | 19.4 | 5.72 | |
| Qwen3-14B | Full history | 33.3 | 54.0 | 14.36 |
| Compressed baseline | 42.9 | 45.1 | 15.28 | |
| DeLoop (ours) | 12.3 | 52.3 | 8.18 |
| Looping points ( ) | Retry points ( ) | |||||
|---|---|---|---|---|---|---|
| Context condition | Base | DeLoop | DeLoop-Mix | Base | DeLoop | DeLoop-Mix |
| Not yet executed | 73.7 | 61.4 | 57.3 | 68.4 | 63.3 | 62.2 |
| Proposed only | 73.9 | 41.0 | 24.4 | 66.7 | 31.9 | 25.2 |
| Proposed + observation | 29.0 | 2.5 | 2.2 | 20.6 | 4.7 | 7.2 |
| Just executed | 4.9 | 1.9 | 1.9 | 5.6 | 5.6 | 6.9 |
| Record present | 16.5 | 8.3 | 6.8 | 51.7 | 36.1 | 38.0 |
| Tasks (%) | Per action (%) | Ratio | Trained, per action (%) | Failure | ||||
|---|---|---|---|---|---|---|---|---|
| Signature | Full | Comp. | Full | Comp. | ( ) | DeLoop | DeLoop-Mix | OR |
| Exact loop (our detector) | 28.6 | 57.0 | 6.6 | 24.8 | 3.77 | 2.3 | 2.5 | 1.62 |
| Near-duplicate | 75.7 | 77.9 | 46.7 | 34.3 | 0.73 | 19.0 | 23.7 | 0.68 |
| Argument thrash | 3.3 | 3.4 | 0.4 | 0.3 | 0.92 | 0.1 | 0.2 | 3.10 |
| Redundant observe | 52.3 | 56.3 | 21.1 | 22.5 | 1.07 | 6.7 | 7.7 | 0.69 |
| Productive repeat | 30.0 | 39.2 | 8.9 | 10.7 | 1.21 | 5.9 | 7.6 | 2.00 |
| Training data | Pairs | Updates | Loop (%) | Success (%) | Steps |
|---|---|---|---|---|---|
| Compressed baseline | — | — | 66.1 | 11.5 | 19.12 |
| Random pairs | 877 1 | 55 | 54.8 | 11.9 | 13.26 |
| Random pairs | 877 9 | 495 | 69.5 | 11.7 | 16.17 |
| Self-mined pairs | 1,003 8 | 504 | 9.4 | 23.4 | 5.82 |
| Self-mined pairs | 4,012 2 | 502 | 5.5 | 20.3 | 4.95 |
| Self-mined pairs (DeLoop) | 8,000 1 | 500 | 5.5 | 15.6 | 4.80 |
| Chosen action | Loop (%) | Steps |
|---|---|---|
| Compressed baseline (no training) | 57.0 | 14.91 |
| Loop-breaking action (DeLoop) | 5.7 | 4.59 |
| Random action from the same history | 41.9 | 8.17 |
| Chosen action of another pair | 36.1 | 8.99 |
| Policy | Loop rate | In context | Summarized |
|---|---|---|---|
| Compressed baseline | 57.3 | 25.2 | 32.1 |
| DeLoop | 6.1 | 3.2 | 2.9 |
| DeLoop-Mix | 10.1 | 4.3 | 5.8 |
| Full history | 29.0 | 29.0 | – |
| Repeat proposals | Loop | Steps | Success | ||
|---|---|---|---|---|---|
| Policy | Tasks (%) | Per task | (%) | (%) | |
| Compressed baseline | 69.8 | 5.29 | 57.3 | 15.00 | 25.1 |
| Duplicate blocker | 71.3 | 4.77 | 5.7 | 14.71 | 25.3 |
| DeLoop | 13.6 | 0.38 | 6.1 | 4.67 | 25.9 |
| DeLoop + blocker | 13.7 | 0.25 | 1.3 | 4.84 | 27.7 |
| Same tasks | All tasks | ||||
|---|---|---|---|---|---|
| Model | Tasks | None | Summ. | None | Summ. |
| Gemini 3.5 Flash-Lite | 191 | 40.8 | 47.1 | 34.0 | 36.0 |
| Gemini 3.1 Flash | 226 | 46.5 | 65.5 | 40.0 | 52.7 |
| Gemini 3.1 Pro | 139 | 33.1 | 61.9 | 21.3 | 34.3 |
| Step index | ||||
|---|---|---|---|---|
| Policy | 0–4 | 5–9 | 10–14 | 15–19 |
| Compressed baseline | 4.1 | 22.3 | 32.8 | 42.8 |
| DeLoop | 0.8 | 4.1 | 7.0 | 25.7 |
| DeLoop-Mix | 1.8 | 3.6 | 4.5 | 7.3 |
| Full history | 2.3 | 6.8 | 11.3 | 13.9 |
Long-Horizon LLM Agents
Long-horizon large language model agents plan, use tools, and preserve task state across extended, multi-step interactions.
See all 451 papers