Microsoft study finds most extra lines in agent patches are tests and documentation
Delta Residue Attribution traces each patch unit to its step and reruns tests to check whether it was needed, across 7,660 Copilot CLI trajectories.
Agent-written patches on SWE-bench Verified are larger than developer patches, and a Microsoft study finds that on that benchmark most of the surplus is tests and documentation rather than code. The authors introduce Delta Residue Attribution (DRA). It replays each agent trajectory, traces every unit of the final patch to the step that wrote it, reverts that unit, and reruns the task tests to see whether the unit was needed. They applied it to 7,660 resolved GitHub Copilot CLI trajectories from 18 frontier models, 6,728 on SWE-bench Verified and 932 on DeepSWE. They graded developer patches with the same method so the two could be compared.
The paper's central observation is that patch size alone cannot say whether the extra edits are needed, what they are, or where they come from. On SWE-bench Verified, the majority of extra edits add tests (61%) and documentation (13%). On DeepSWE the picture reverses, with most extra edits being code (58%). The authors measure code necessity as the share of code units needed to pass the task tests. On that measure agent code is on average at least as necessary as developer code, at 0.887 against 0.864 on SWE-bench Verified, and 0.797 against 0.785 on DeepSWE. On SWE-bench Verified, 11 of 18 models left less unneeded code than the developers did.
The remaining waste is smaller but not zero. The paper says about 11% of an agent patch's code units on SWE-bench Verified are still unneeded, and that 89% of those change behavior, which means they are not harmless leftovers. Code necessity differs substantially by model. The relationship to resolve rate depends on the benchmark: it is unrelated to resolve rate on SWE-bench Verified and negatively correlated with it on DeepSWE, with a Spearman coefficient of -0.59 and p = 0.01. The paper doesn't say what drives that difference between benchmarks. The authors also report that debug steps write almost none of the unneeded code.
Pruning with DRA using only the tests the agent can see, its own tests and the repository's, removed most unneeded code, with 67% recall and 46% precision. That means it also removed some code that was needed. Of the pruned patches, 89% still resolved the task. Asking the agent to audit its own diff was more precise, at 66%, but found less, at 36% recall. The authors recommend that benchmarks report code necessity next to resolve rate, and that over-editing be addressed through model training and harness-level pruning.
What changed
Agent-written patches on SWE-bench Verified are larger than developer patches, with most of the surplus being tests and documentation rather than code.
Type: Research · Applies to: SWE-bench Verified, DeepSWE, GitHub Copilot CLI
Why it matters
Patch size alone is a weak signal of over-editing, so teams comparing coding agents on size or diff volume may be measuring the wrong thing.
What you can do
When evaluating coding agents, ask vendors or internal teams to report unneeded code alongside resolve rate.
Original source
- arxiv.org[2611.34875] How Much Do Coding Agents Over-Edit, and Why? An Empirical Study of Unneeded Edits in Repository-Level Agent Patches
- academy.dair.aiHow Much Do Coding Agents Over-Edit, and Why? An Empirical Study of Unneeded Edits in Repository-Level Agent Patches | DAIR.AI Academy | DAIR.AI Academy
Where we saw it
DAIR.AI (Elvis Saravia)
AI wrote this summary from the sources listed, and nobody reviewed it individually before publication. Check the original source before you rely on it. How it works