PapersSelected

Microsoft 研究:编程智能体的多余代码比想象中少

Why we picked it

这篇文章推翻了一个流行说法:智能体补丁大不等于乱改。Microsoft 用 7,660 条 Copilot CLI 轨迹逐块验证,数据很扎实。做智能体评估或写代码工具的人应该看看,尤其是那个“剪枝后 89% 补丁照样过测试”的发现。

Microsoft 发表论文,用 Delta Residue Attribution 方法检验“编程智能体过度修改代码”的常见假设。研究分析了 7,660 条 GitHub Copilot CLI 的解决轨迹,覆盖 18 个前沿模型:将最终补丁逐块回退并重跑任务测试,记录每块代码是否必要。

Body

结果显示,智能体补丁多出的行里 61% 是测试代码、13% 是文档;智能体代码的必要性均值为 0.887,反而高于开发者代码的 0.864,18 个模型中有 11 个留下的无用代码比开发者更少。不过仍有约 11% 的代码单元无必要,其中 89% 会改变程序行为。

代码必要性与 SWE-bench Verified 的解决率无相关,在 DeepSWE 上甚至呈负相关(Spearman -0.59)。实验还发现,只用智能体可见的测试做剪枝就能去掉大部分无用代码,且 89% 被剪枝后的补丁仍能解决任务。

Original · DAIR.AI

Great paper from Microsoft on how much coding agents over-edit.

It is widely assumed that coding agents over-edit, because their patches are larger than developer patches.

This study tested that claim on 7,660 resolved GitHub Copilot CLI trajectories from 18 frontier models. Their method, Delta Residue Attribution, reverts each block of the final patch, reruns the task tests, and records whether the block was needed.

On SWE-bench Verified, most of the extra lines are tests (61%) and documentation (13%). Agent code was on average at least as necessary as developer code (0.887 vs 0.864), and 11 of 18 models left less unneeded code than developers.

About 11% of an agent's code units were still unneeded, and 89% of those changed behavior. Code necessity had no relation to resolve rate on SWE-bench Verified and a negative one on DeepSWE (Spearman -0.59).

Pruning with only the tests the agent can see removed most of the unneeded code, and 89% of pruned patches still resolved the task.

https://t.co/ZKe28zEH2Z

Chat with Paper: https://t.co/or4icJ7Gz1

Industry Coordinates & Source Verification

This report is categorized under AITOP's "Papers" desk, focusing on US frontier AI labs and Silicon Valley technology leaders. Within our cross-regional analytical framework, it directly maps to AI developer toolchains, coding agents, and engineering workflows. Key entities and technical topics under continuous tracking include SWE-bench Verified, GitHub Copilot, Microsoft, coding assistants.

Source attribution: curated from DAIR.AI (@dair_ai).