StopLoss:教智能体预测失败并提前停止
研究论文 · 2026/10/21
编码智能体常会继续执行最终无法通过验证的任务,而用前沿模型监控这种失败既昂贵又低效。我们提出 StopLoss,一个小型外部监控器,它从已完成的轨迹及其验证器结果中学习失败识别。其名称灵感来自金融中的止损指令:当运行可能失败时,StopLoss 会提前终止运行以节省资源。最终结果用于标注较早的局部窗口,因此微调后的语言模型可以通过单次前向传播对最近的工具步骤进行评分,而在成功运行上校准的阈值将该评分转化为中止决策,且无需更改执行器。基于 GPT 系列 SWE-rebench 轨迹训练,并在 SWE-bench Verified 和 SWE-bench Pro 子集上使用 GPT 和 Claude 执行器进行评估,StopLoss 与六个读取相同窗口的通用评判器进行了比较。结果监督将失败预测从接近随机提升为首次检查时的有用信号,且每次检查的成本比任何测试的评判器低一到两个数量级。这转化为节省:相对于完成所有任务,StopLoss 在 Verified 上将每次保留求解的成本降低 4.5%,同时保留 99% 的成功运行;在成本更高的 Pro 子集上降低高达 31%,使用 Qwen3-8B 骨干网络时达到 48%;在所有四种设置中,其每次保留求解的成本均低于所有评判器策略。经过结果训练的小型监控器可以使失败识别足够廉价,从而使提前停止能够自我补偿成本。
该研究解决了编码智能体在注定失败的任务上浪费资源的关键问题,提出了一种低成本、高效的失败预测方法,并实证展示了显著的资源节省,对提升智能体系统的经济性和可靠性具有重要价值。
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.