StopLoss: Teaching Agents to Predict Failure and Stop Early
Organizations: University of Waterloo
Abstract
Coding agents keep working on runs that will fail verification, and asking a frontier model to watch for this is expensive in its own right. We introduce StopLoss, a small external monitor that learns failure recognition from completed trajectories and their verifier outcomes. The name is inspired by the stop-loss order in finance: StopLoss ends a run early when the run is likely to fail, which saves resources. Final outcomes label earlier local windows, so a fine-tuned language model can score the most recent tool steps in a single forward pass, and a threshold calibrated on successful runs turns that score into an abort decision without changing the executor. Trained on GPT-family SWE-rebench trajectories and evaluated on SWE-bench Verified and a SWE-bench Pro subset with GPT and Claude executors, StopLoss is compared against six general-purpose judges reading identical windows. Outcome supervision lifts failure prediction from near chance to a useful signal at the first check, at one to two orders of magnitude lower cost per check than any tested judge. This translates into savings: relative to completing every task, StopLoss lowers cost per retained solve by 4.5% on Verified while preserving 99% of successful runs, and by up to 31% on the costlier Pro subset, reaching 48% with a Qwen3-8B backbone, and in all four settings its cost per retained solve is below that of every judge policy. Outcome-trained small monitors can make failure recognition cheap enough for early stopping to pay for itself.
Figures & tables
| Method | Cost | Prediction | Stopping outcomes | ||
|---|---|---|---|---|---|
| CPS (%) | Monitoring (\downarrow$ | Tier AUC | Success retained (%) | Failure capture (%) | |
| SWE-bench Verified / GPT-5.6 Luna 425 stopping runs; 306 successes; 119 failures | |||||
| StopLoss | −4.5 | 0.44 | 0.622 | 99.0 | 5.0 |
| Qwen3-8B | −1.8 | 0.43 | 0.605 | 97.7 | 5.0 |
| Qwen2.5-Coder-7B-Instruct | −5.2 | 0.35 | 0.612 | 99.0 | 5.9 |
| GPT-5.6 Sol | +116.8 | 33.20 | 0.633 | 91.8 | 20.2 |
| GPT-5.6 Luna runs | Claude Sonnet 4.6 runs | ||||
|---|---|---|---|---|---|
| Backbone | Configuration | SWE-bench Verified | SWE-bench Pro | SWE-bench Verified | SWE-bench Pro |
| Untuned base | 0.491 | 0.452 | 0.512 | 0.511 | |
| Qwen2.5-7B-Instruct | Trained ensemble | 0.622 (+0.131) | 0.614 (+0.162) | 0.561 (+0.049) | 0.579 (+0.068) |
| Untuned base | 0.504 | 0.507 | 0.481 | 0.516 | |
| Qwen3-8B | Trained ensemble | 0.605 (+0.100) | 0.621 (+0.114) | 0.563 (+0.082) | 0.608 (+0.092) |
| Untuned base | 0.437 | 0.433 | 0.455 | 0.478 | |
Appendix figures & tables7 assets
Supplementary material from the paper’s appendix.
Appendix
| Role | Model(s) | Reasoning setting | Limits and interface |
|---|---|---|---|
| Executor | GPT-5.6 Luna | Effort unset; upstream default not recorded | 100 turns; 7,200 s agent timeout; $9 spend valve. Output-token caps stripped by the GPT gateway. |
| Executor | Claude Sonnet 4.6 | Thinking enabled, 8,000-token budget | 100 turns; 7,200 s agent timeout; $26 spend valve. Gateway default output limit 16,000 tokens. |
| Judge | GPT-5.6 Sol, GPT-5.6 Terra, GPT-5.6 Luna | High reasoning effort | Native Responses API; output-token caps stripped, so no enforced per-call output cap. |
| Judge | Claude Opus 5, Claude Opus 4.6, Claude Sonnet 4.6 | Adaptive thinking, high effort | Native Messages API; output limits 4,000, 8,000, 16,000 on truncation retries. |
| Benchmark / executor | Ranking runs | Solved | No checkpoint | Windows | Stopping runs |
|---|---|---|---|---|---|
| Verified / Luna | 499 | 355 | 2 | 2307 | 425 |
| Verified / Sonnet | 499 | 377 | 9 | 2215 | 425 |
| Pro / Luna | 264 | 177 | 3 | 1569 | 213 |
| Pro / Sonnet | 261 | 132 | 2 | 1960 | 213 |
| Model identifier | Input | Output |
|---|---|---|
| gpt-5.6-sol | 4.00 | 20.00 |
| gpt-5.6-terra | 2.00 | 12.00 |
| gpt-5.6-luna | 0.20 | 1.20 |
| claude-opus-5 | 5.00 | 25.00 |
| claude-opus-4-6 | 5.00 | 25.00 |
| claude-sonnet-4-6 | 3.00 | 15.00 |
| Cell | Judge | Windows | $/check | Judge / ensemble |
|---|---|---|---|---|
| Verified / Luna | GPT-5.6 Sol | 2307 | 0.01949 | 82.3 |
| Verified / Luna | GPT-5.6 Terra | 2307 | 0.00774 | 32.7 |
| Verified / Luna | GPT-5.6 Luna | 2307 | 0.00248 | 10.5 |
| Verified / Sonnet | Claude Opus 5 | 2215 | 0.07722 | 326.3 |
| Verified / Sonnet | Claude Opus 4.6 | 2215 | 0.02015 | 85.1 |
| Verified / Sonnet | Claude Sonnet 4.6 | 2215 | 0.02114 | 89.3 |
| Judge | Covered windows | New windows | Known new $ | Unknown usage |
|---|---|---|---|---|
| GPT-5.6 Sol | 3876 | 2751 | 48.64 | 3 |
| GPT-5.6 Terra | 3876 | 2751 | 19.71 | 2 |
| GPT-5.6 Luna | 3876 | 2751 | 6.12 | 7 |
| Claude Opus 5 | 4175 | 2592 | 146.36 | 47 |
| Claude Opus 4.6 | 4175 | 2592 | 49.07 | 0 |
| Claude Sonnet 4.6 | 4175 | 2592 | 49.68 | 1 |
| Cell | FK% | ||||
|---|---|---|---|---|---|
| Verified / Luna | -4.5 | -2.9 | +1.8 | +9.7 | 1.0 |
| Verified / Sonnet | +0.2 | +0.3 | +0.8 | +1.5 | 0.0 |
| Pro / Luna | -24.2 | -23.0 | -19.5 | -13.6 | 27.8 |
| Pro / Sonnet | -30.6 | -30.5 | -30.3 | -29.9 | 8.4 |
| Seed | GPT-5.6 Luna runs | Claude Sonnet 4.6 runs | ||
|---|---|---|---|---|
| Verified | Pro | Verified | Pro | |
| Qwen2.5-7B-Instruct | ||||
| Seed 0 | 0.615 | 0.607 | 0.578 | 0.548 |
| Seed 1 | 0.608 | 0.599 | 0.522 | 0.564 |
| Seed 2 | 0.605 | 0.586 | 0.531 | 0.586 |
| Seed 3 | 0.598 | 0.610 | 0.545 | 0.582 |
Early Stopping
Early stopping uses signals during training or inference to halt computation before a fixed budget, balancing generalization, quality, and cost.
See all 44 papers