What the paper measured
If you review pull requests from a coding agent, you'll have seen this: the fix is in the diff, but it sits among new tests, rewritten docstrings and a helper function nobody asked for. A paper posted to arXiv on 25 November 2026 by Microsoft researchers Aakash Goel, Benjamin Steenhoek and Yu Hu measures how often that happens. The study covers 7,660 resolved trajectories from 18 models. A trajectory is the full record of an agent's tool calls and edits on one task. All the main runs used GitHub Copilot CLI as the harness, meaning the program that wraps the model, runs its tools and manages its context. The tasks came from SWE-bench Verified and DeepSWE.
The results are better than the folklore suggests. On SWE-bench Verified, the average necessity of agent code was 0.887, against 0.864 for the human developers who fixed the same issues, and 11 of the 18 models left less unneeded code than those developers. About 11% of agent code units were still unneeded. The share also varied widely between models, and a model's benchmark score didn't predict where it would land.
How Delta Residue Attribution works
The authors call their method Delta Residue Attribution (DRA). DRA replays the agent's file-editing calls on the original files and records which step wrote each line. The final patch is then split into units, each a contiguous block of changed lines in one file. Each unit is tagged as code, test, docs, config or formatting. Each unit is credited to the last step that touched the unit's lines, and every step gets a role such as exploring, reproducing, debugging, fixing or cleaning up. GPT-6.1 Sol assigned most of the role labels, and a second judge, Claude Opus 5.5, agreed with 84.4% of them.
The necessity test is simple. DRA reverts one unit, reruns the task's tests and counts the unit as needed only if the tests then fail. SWE-bench Verified is a 500-task, human-validated subset of SWE-bench. Its grading applies a patch and requires two test sets to pass: FAIL_TO_PASS tests, which show the issue is fixed, and PASS_TO_PASS tests, which show nothing else broke. DeepSWE adds 113 long-horizon tasks in Go, TypeScript, Python, Rust and JavaScript.
The test suite that decides necessity is called the oracle, and the oracle's strength changes the answers. With task tests alone, 33% of developer code units look unneeded. When the authors added LLM-written behavioural probes, only 3% did. With the stronger oracle, agents fell from 2.3 percentage points ahead of developers on necessity to 4.5 points behind. The claim that agents match humans therefore holds under the weaker oracle only.
Where the extra lines come from
The median agent patch on SWE-bench Verified changed 2.33 times as many lines as the developer patch, but only 0.86 times as many lines of code. Of the extra lines, 61% were in test files, 21% were code and 13% were documentation. SWE-bench resets test files during grading, so those agent-written tests never affect the score. DeepSWE showed a different mix, with 58% of the extra lines in code and 26% in tests.
Debugging leftovers were rare. Debug steps wrote 154 of 3,987 unneeded code units, while fix steps wrote 83% of the unneeded code. The more worrying figure for reviewers is that 89% of the unneeded agent code units changed the program's behaviour when reverted (84% for developer code). Unneeded code here means behaviour the tests don't check, which is a bigger risk than dead code.
The agents' extra tests mostly earned their place. The authors ran mutation testing, which plants small deliberate bugs (mutants) to see whether tests catch them. Agent-added tests caught 68.1% of mutants, against 45.6% for the existing regression tests.
Resolve rate is a poor guide
On SWE-bench Verified, the Spearman rank correlation between a model's resolve rate and its code necessity was -0.10 and not statistically significant. Sonnet 5 resolved 80.6% of tasks and left about 0.34 unneeded code units per task. Gemini 3.7 Flash resolved 81.4% and left about 1.23. On DeepSWE the correlation was -0.59 (p = 0.01), so the higher-scoring models left more unneeded code on the longer tasks. A leaderboard position tells you little about how much a model's patches will cost you to review.
Automatic pruning and its trade-offs
The paper tested ways to remove the extra code. The most precise was a self-audit, where the agent states in one line why each hunk is needed to resolve the issue and drops any hunk it can't justify. Self-audit had 65.7% precision and 35.5% recall. Precision is the share of dropped units that really were unneeded, and recall is the share of unneeded units that got dropped. 98.2% of patches still resolved their tasks afterwards. Pruning with DRA, using the agent's own tests plus the existing pass-to-pass tests, had 67.3% recall but only 46.3% precision, and 89.1% of pruned patches still resolved. Stopping the agent at its first passing test run changed almost nothing.
The results fit an earlier study by Lim, Kan and Zhu, published in September, which used synthetic function-level bugs. In that study, a prompt asking the model to preserve existing code cut average excess edit distance from 0.195 to 0.131. In both studies, asking the model to justify or limit its edits helps without hurting pass rates much.
Limits
The main results come from one harness. The appendix compares others on overlapping tasks: for Opus 5, code necessity was 0.903 in the Copilot coding agent, 0.911 in VS Code agent mode and 0.910 in Copilot CLI, and the authors describe the differences as small. SWE-bench Verified is Python-only and may be in the models' training data. Only resolved trajectories were studied. Units were reverted one at a time, so units that are needed only in combination could be misjudged. A human validation set was prepared but not completed. The paper doesn't report DRA's compute cost or say whether the code and data will be released.
What builders can do with this
If your harness lets you add a pre-submit instruction, the self-audit is the cheapest change to try. The paper's version asks for a one-line justification per hunk and removal of any hunk without one, and in the paper it dropped few needed units. When you compare agent and human patch sizes in your own repositories, count test and code changes separately, because tests made up most of the extra lines on SWE-bench Verified. When you choose a model for agent work, run a handful of your own tasks and count the unneeded code units alongside the pass rate, since the paper found the two barely related. Mutation testing tools such as mutmut, which the authors used, can show whether the extra tests an agent writes are catching anything.
For small New Zealand teams, where one senior engineer often reviews everything, a model that leaves about one unneeded unit per task costs more review time than its score suggests. If you build a necessity check into your own pipeline, we'd like to see it on the ASAI projects page.
Sources
- How Much Do Coding Agents Over-Edit, and Why? An Empirical Study of Unneeded Edits in Repository-Level Agent Patches (arXiv abstract)
- How Much Do Coding Agents Over-Edit, and Why? (arXiv full text, HTML v1)
- Introducing SWE-bench Verified (OpenAI)
- When Models Edit Too Much: On the Fidelity of Minimal Code Edits (Hugging Face Papers)
Build with people working on the same things
Join the Auckland Society for AI: NZ$599 a year with a ForgeBox and the members' projects area. Our Auckland meetups are open to everyone.