Coding Agents' Extra Edits Are Mostly Tests
A Microsoft study posted to arXiv on Nov. 25, 2026, found AI coding agent patches change 2.33 times as many lines as human fixes on SWE-bench Verified, but most extra edits are tests (61%) and documentation (13%). About 11% of agent code units were still unneeded, and 89% of those changed behavior.
AI coding agents write bigger patches than human developers, but most of the extra lines are tests and documentation, not wasted code, according to a study by three Microsoft researchers posted to arXiv on Wednesday, Nov. 25, 2026. The team still found that about 11% of the code units in a typical agent patch were not needed, and that nearly all of those quietly changed how the program behaves.

Key takeaways
- On SWE-bench Verified, the median model changed 2.33 times as many lines as the human fix, but 61% of the extra edits were tests and 13% were documentation.
- Agent code was at least as necessary as human code on average: 0.887 versus 0.864 on the study's necessity score.
- About 11% of agent code units were unneeded, 89% of those changed behavior, and a model's benchmark resolve rate did not predict how clean its patches were.
How Microsoft measured AI agent over-editing
The paper, by Aakash Goel, Benjamin Steenhoek and Yu Hu, introduces a method called Delta Residue Attribution, or DRA. It replays an agent's recorded session, splits the final patch into small blocks, traces each block to the step that wrote it, then reverts the blocks one at a time and reruns the task's tests. A block whose removal still passes the tests is counted as unneeded.
The researchers applied DRA to 7,660 resolved sessions of the GitHub Copilot CLI agent, run with 18 frontier models from four providers. Of those, 6,728 came from SWE-bench Verified, a set of 500 Python bug-fix tasks, and 932 from DeepSWE, 113 longer feature tasks in Go, TypeScript, Python, Rust and JavaScript. They graded the human developers' own patches the same way.
Bigger patches, mostly tests
Measured by size alone, agent patches look bloated. Outside test files, though, the gap shrank to 1.09 times. On SWE-bench Verified, 61% of the extra edits were in test files, 21% were code, 13% were documentation and 5% were comments or formatting. Some 81.5% of agent patches touched a test file.
Those tests had value. In a mutation test with injected bugs, agent-written tests caught 68.1% of them, against 45.6% for the repository's existing regression tests and 77.1% for the benchmark's own task tests. They also caught 22.7% of the bugs the task tests missed.
The picture changed on DeepSWE's longer tasks, where code made up 58% of the extra edits. There, agents were on par with developers, at 0.797 versus 0.785 on the necessity score.
Which models leave the most unneeded code
On SWE-bench Verified, 11 of the 18 models left less unneeded code than the developers, four showed no significant difference, and three left significantly more: Google's Gemini 3.8, 3.7 and 3.6 Flash. At nearly the same resolve rate, Gemini 3.7 Flash left about 3.6 times as many unneeded code units per task as Anthropic's Claude Sonnet 5.
Debugging leftovers were not the main culprit. Exploration and probing steps wrote just 154 of 3,987 unneeded code units, while fix steps wrote 83%. And code necessity was unrelated to resolve rate on SWE-bench Verified, but negatively correlated with it on DeepSWE (Spearman -0.59), meaning the models that solved more of those tasks left more unneeded code.
Context: the review burden
The paper cites a maintainer study that found roughly half of SWE-bench-passing patches would not have been merged. As tools such as Meta's Muse Code raise the volume of agent-written code, unneeded but behavior-changing lines are exactly what human reviewers struggle to spot.
What's next
The team tested cleanup options. Pruning with DRA using only the tests an agent can see removed 67.3% of unneeded code at 46.3% precision, and 89.1% of pruned patches still passed. Asking the agent to audit its own diff was more precise, at 65.7%, but caught only 35.5%. The authors recommend that benchmarks report code necessity next to resolve rate, and that over-editing be tackled through model training and harness-level pruning.
FAQ
Do AI coding agents over-edit?
Their patches are larger, but on SWE-bench Verified most extra lines are tests and documentation. About 11% of agent code units were still unneeded.
Does a higher benchmark score mean cleaner code?
No. The study found no link on SWE-bench Verified and a negative one on DeepSWE.
Can unneeded code be removed automatically?
Partly. Test-based pruning caught 67.3% of it but also removed some needed code, so human review is still required.
References
- How Much Do Coding Agents Over-Edit, and Why? An Empirical Study of Unneeded Edits in Repository-Level Agent Patches — arXiv, Microsoft (Nov. 25, 2026)
- Full text (HTML version) — arXiv (Nov. 25, 2026)
Editor responsible for AI Newsway. Writes about AI, developer tools, cloud and productivity technology.
Comments 0
Comments are currently disabled.