从错误主张到错误补丁:对编码智能体中任务基础推理的实证研究
From Faulty Claims to Incorrect Patches: An Empirical Study of Task-Grounded Reasoning in Coding Agents
AI总结:
本研究针对编码智能体的任务基础推理开展实证研究,分析SWE-bench Pro上4个模型的400条轨迹,发现多数错误补丁源于CoT中的错误主张,修正此类主张可解决部分失败任务。
摘要:
基于大语言模型(LLM)的编码智能体越来越多地解决现实世界的软件工程任务,但仍在许多任务上失败。先前的轨迹研究通过与任务无关的智能体行为模式(如重复操作)来表征这些失败。然而,智能体可能遵循合理的工作流程,但却基于对现有代码、任务要求或候选修复的错误理解采取行动。为大多数最先进的编码智能体提供动力的推理模型,会在其原生思维链(CoT)中揭示这种理解,可对照事实检查其关于任务的主张。但目前仍不清楚CoT包含多少此类可检查主张、其中多少是错误的,以及错误主张是否实际导致错误补丁。我们对这类主张(我们称之为任务基础推理)开展了首次实证研究,分析了SWE-bench Pro上四个开放权重推理模型的400条轨迹。我们用LLM从CoT中提取原子主张,对照LLM智能体收集的证据对其进行评估,并手动将错误补丁的缺陷追溯至错误主张,通过修正主张后的重放确认每个关联。任务基础推理仅覆盖CoT token的18.5%,但每条轨迹产生191个原子主张,其中至少9.6%是错误的。96.7%的已解决轨迹中存在错误主张,因此其单纯存在是较弱的失败信号。然而,188个错误补丁中有三分之二可追溯至错误主张。修正此类主张可使智能体在89.0%的案例中修复关联缺陷,修正所有此类主张可解决11.7%的失败任务。我们的研究结果表明,CoT携带有用于诊断和修复智能体失败的任务特定信号,但利用这些信号需要精准定位实际导致补丁缺陷的少数错误主张。
英文摘要:
Large language model (LLM)-based coding agents increasingly resolve real-world software engineering tasks, yet still fail on many of them. Prior trajectory studies characterize these failures through task-agnostic patterns of agent behavior, such as repeated actions. However, an agent may follow a sound workflow yet act on a faulty understanding of the existing code, the task requirements, or a candidate fix. Reasoning models, which power most state-of-the-art coding agents, reveal this understanding in their native chain-of-thought (CoT), whose claims about the task can be checked against the facts. Yet it remains unclear how many such checkable claims the CoT contains, how many are faulty, and whether faulty claims actually cause incorrect patches. We present the first empirical study of such claims, which we term task-grounded reasoning, analyzing 400 trajectories of four open-weight reasoning models on SWE-bench Pro. We extract atomic claims from the CoT with an LLM, assess them against evidence gathered by an LLM agent, and manually trace the defects of incorrect patches back to faulty claims, confirming each link with a claim-corrected replay. Task-grounded reasoning covers only 18.5% of the CoT tokens, yet yields 191 atomic claims per trajectory, at least 9.6% of which are faulty. Faulty claims also occur in 96.7% of the resolved trajectories, so their mere presence is a weak signal of failure. Yet two thirds of the 188 incorrect patches trace back to faulty claims. Correcting such a claim makes the agent fix the linked defect in 89.0% of the cases, and correcting all such claims resolves 11.7% of the failed tasks. Our findings show that the CoT carries task-specific signals for diagnosing and repairing agent failures, but exploiting them requires pinpointing the few faulty claims that actually cause patch defects.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。