arXiv(opens in a new tab)cs.AIOct 2026Cited by 1 paper on PaperVantage

Manuscript Offprint

arXiv:2610.25525

StopLoss: Teaching Agents to Predict Failure and Stop Early

Jiarong Liang, Xueguang Ma, Dongfu Jiang, Yuxuan Zhang, Ping Nie, Wenhu Chen

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.

StopLoss Stop more failures. Spend less.

SWE-bench Pro · GPT-5.6 Luna trajectories

213 stopping runs

(a) Failure capture vs. total cost

Figure

(b) Monitoring overhead

Cumulative cost ($)

Figure

14-104x lower monitoring cost

Figure 1: StopLoss stops more failing runs than LLM judges and spends far less on monitoring. Results on SWE-bench Pro tasks executed by GPT-5.6 Luna. StopLoss is the Qwen2.5-Coder-7B-Instruct. (a) Failure capture versus cost per retained solve. StopLoss stops 35 of the 69 failing runs (50.7%), while no judge stops more than 20. (b) Cumulative monitoring cost under each frozen policy: 0.15forStopLossacrossall213runs,versus0.15 for StopLoss across all 213 runs, versus2.03–$15.36 for the judges. Table 1 reports details.

1 INTRODUCTION

Coding agents can continue editing, testing, and invoking tools on runs that will ultimately fail verification. By the time the verdict arrives, the cost of those runs has already been paid. A monitor that recognizes failure risk from what is observable during execution could stop unproductive work before more computation is spent.

Two kinds of monitors are natural, and each has a problem. Budget-based approaches, from step or spend caps to the within-budget feasibility estimators of BAGEN (Lin et al., 2026), ask whether a run will finish within a budget, so a run that would eventually pass can still be cut off. A general-purpose model can instead read the trajectory and judge the agent's progress, but each judgment is itself an expensive call, and repeated judging can cost more than it saves. The underlying constraint is simple: early stopping lowers the cost per solved task only if the execution it avoids exceeds the monitoring overhead plus the successes it mistakenly kills (Section 5.3). A practical monitor must therefore be both discriminative and cheap.

Completed trajectories offer a way to obtain both. Verifier outcomes arrive only after execution, but in retrospect they label every earlier window of a run, providing supervision for a predictor of eventual failure from local records alone. Because the label is the outcome of continuing the observed execution, an expensive run that eventually passes remains a success: the monitor learns to recognize failure rather than to enforce a budget. A small model trained on such data can then assess new runs as they unfold in a single forward pass, reading only observable text without the hidden-state access required by probe-based approaches (Ruan et al., 2026), so it can monitor closed executors.

StopLoss implements this idea. We adapt 7B–8B models with LoRA (Hu et al., 2022) on GPT-family SWE-rebench trajectories. At scheduled checks, the monitor scores a short window of recent actions and observations and reads a failure probability directly from the output logits. A threshold calibrated on successful trajectories maps the score to an abort decision; the executor remains fixed. We evaluate on SWE-bench Verified and a three-repository SWE-bench Pro subset with GPT-5.6 Luna and Claude Sonnet 4.6 executors, comparing against six general-purpose judges, three per executor family, that read identical windows, and charging every method for the checks it visits and the successes it loses.

The results connect learned recognition to inexpensive monitoring and early stopping. Figure 1 illustrates this connection on Pro/Luna. Outcome supervision moves failure ranking from near chance to a usable signal: on Verified/Luna, training raises Qwen2.5-7B-Instruct's mean single-model tier AUC from 0.491 to 0.606, and the trained ensemble already separates outcomes at the first scheduled check, tool step 5 (Section 4.2). Each check costs an estimated $0.00024, one to two orders of magnitude below every tested judge (Section 4.3). On calibration-disjoint Verified/Luna runs, the frozen policy retains 99.0% of otherwise successful runs and lowers cost per retained solve by 4.5% relative to completing every run, whereas every GPT-judge policy raises it; savings reach 31% on the costlier Pro subset, and across all four settings StopLoss has lower estimated cost per retained solve than every judge policy. A judge can rank failures better and still lose money: on Verified/Sonnet, Claude Opus 5 has the highest AUC in the study yet raises cost per solve by a third, because its monitoring bill exceeds the execution it saves.

Our contributions are:

• Outcome-supervised failure monitoring. We show that completed trajectories and their verifier outcomes suffice to train a small external monitor that scores local execution windows and triggers early stopping, without modifying the executor or accessing its internals.

• Early recognition at low monitoring cost. Outcome supervision supplies failure signal at the first scheduled check, at per-check costs one to two orders of magnitude below general-purpose judges.

• Practical early-stopping evaluation. Using replay that charges monitoring and lost successes, and a break-even analysis that relates the two, we show cost advantages over six judge policies across four executor–benchmark settings and three 7B–8B backbones, and characterize when prediction and threshold transfer support early stopping.

StopLoss | From final outcomes to early stopping

Figure

Figure 2: StopLoss turns final verifier outcomes into early-stopping decisions. Offline, the outcome of each completed run labels its earlier windows, 7B–8B models are adapted with LoRA on these windows, and the stopping threshold τ\tau is calibrated on successful runs and then frozen. Online, at tool steps 5, 8, 11, ..., each ensemble member reads the step count and the three most recent action–observation pairs in one forward pass; the run stops once the averaged failure score reaches τ\tau, and the executor itself is unchanged.

References (41)