终止延迟:编码代理解决得早却停得晚

·

研究论文 · 2026/11/17

编码智能体往往在任务已解决后仍继续工作。我们通过记录并测试执行过程中生成的每个不同仓库补丁,在五个模型、两个智能体框架和三个SWE-bench数据集上刻画了终止滞后——即智能体首次正确补丁与运行结束之间的步数。分析显示,38-82%的成功运行在首次源代码编辑时就得到了正确解。然而,智能体在正确补丁后仍投入大量精力,在SWE-bench Verified和Multilingual的成功运行中,Qwen3-Coder的解决方案后步骤中位数为35-37%,Laguna-XS.2为54-60%。智能体将这些额外步骤主要用于验证工作和探索仓库。在少数情况下(1-8%),这种持续活动导致智能体撤销了先前正确的补丁,使最终解决方案错误。

该研究揭示了编码智能体普遍存在的低效行为:过早解决却过晚停止,甚至可能破坏已正确的解决方案。这为优化智能体终止策略和提升效率提供了实证依据,对智能体设计和评估具有重要参考价值。

Coding agents can solve a task well before they stop working on it. We characterize termination lag--the number of steps between an agent's first correct patch and the end of its run--across five models, two agent frameworks, and three SWE-bench datasets by recording and testing every distinct repository patch generated during execution. Our analysis reveals that 38--82% of successful runs achieve a correct solution on their initial source-code edit. However, agents continue to expend substantial effort after correct patches, with post-solution steps accounting for a median of 35--37% for Qwen3-Coder and 54--60% for Laguna-XS.2 in successful runs on SWE-bench Verified and Multilingual. Agents spend most of these additional steps verifying their work and exploring the repository. In a small fraction of cases (1--8%), this continued activity leads agents to undo their earlier correct patch, leaving the final solution incorrect.

阅读原文

参与讨论