The median coding agent changed 2.33 times as many lines as the developer who fixed the same bug. That number has been circulating for months as a verdict: agents over-edit, diffs balloon, review load doubles.
Microsoft Research went through every one of those lines. On November 25, researchers Aakash Goel, Benjamin Steenhoek, and Yu Hu published a study of 7,660 resolved patches from GitHub Copilot CLI, covering 18 frontier models on SWE-bench Verified and DeepSWE. For each patch they did something nobody had done at this scale: they cut it into blocks, traced every block to the step in the agent’s run that wrote it, reverted the block, and reran the tests. A block is needed if the tests fail without it.
Three results came out, and they pull in different directions. The extra lines are mostly tests and documentation, not code. The code itself is, on average, as lean as a developer’s, and leaner for 11 of the 18 models. And the 11% of code blocks that were not needed are not lint: 89% of them change behavior, and the model’s benchmark score says nothing about which models write them.
Revert Every Block
The method is the contribution, so it is worth thirty seconds. Delta Residue Attribution, as the paper calls it, starts by replaying the agent’s recorded file edits on the original repository and checking that the replayed final state matches the submitted patch exactly; 96.7% of SWE-bench Verified trajectories do. It then splits the diff into units, contiguous blocks of changed lines in one file, and labels each unit by the role of the step that wrote it: exploring, reproducing, fixing, revising, cleaning up.
Then the blunt part. For each unit, revert it in the task container and rerun the task’s tests. If they fail, the unit was needed. If they pass, it was not. The share of needed units is the patch’s necessity, and the authors report it for code separately from tests, because SWE-bench resets test files during grading and an agent’s test edits never count for or against it.
There is an obvious objection: the tests are incomplete, so a block the tests do not need may still be the right fix. The authors answer it two ways. They grade the human developer’s patch for the same bug with the same method, so the comparison is like for like. And they run behavioral probes on the unneeded blocks, asking a model to write inputs that call the changed code under both the full patch and the reverted one, then comparing what comes out.
The developer baseline also calibrates how much to trust the number. The task tests alone call 33% of the developer’s own code blocks unneeded. Add the probes, and that falls to 3%. So the raw test-based figure is an upper bound, and every comparison below is a ratio between agents and humans measured the same way, not a frequency.
The Bloat Is Mostly Tests
Here is what the extra lines actually are. On SWE-bench Verified, 61% of the extra edits are test-file changes, 13% are documentation, 21% are code, and 5% are comments and formatting. Four out of five agent patches touch a test file.
Take the tests out and the picture flattens. Outside test files, the median agent changes 1.09 times the developer’s lines. Count blocks instead of lines and the ratio is 0.86; the per-task median is exactly 1.00. By necessity, the agents’ code scores 0.887 against the developers’ 0.864. Eleven models leave significantly less unneeded code than the humans, four show no detectable difference, and three leave more: Gemini 3.6, 3.7, and 3.8 Flash.
That is the first place the paper contradicts the way the 2.33 figure gets used. Agents are not writing 2.3 times the code. They are writing roughly the code and more than twice the paperwork around it.
And the paperwork is good. The team ran mutation testing, injecting 1,962 small artificial bugs across 271 tasks and counting which tests caught them. The tests the agent added killed 68.1%, against 45.6% for the regression tests already in the repository. They caught 22.7% of the bugs that the benchmark’s own hidden tests missed. One caveat on process: most agents wrote those tests after the fix, and only 8.7% recorded a test that failed and then passed before the fix was complete, so these are mostly descriptions of what the code now does rather than specifications written first.
One honest wobble. Under the stricter oracle that adds the behavioral probes, the agent-versus-developer gap flips sign, from +2.3 points to −4.5. “Leaner than a human” depends on how you grade. “About the same” holds under both, and it is still a long way from “2.3 times the bloat.”
The Eleven Percent That Bites
The code that was not needed is the part that should change how you review. Of 3,987 unneeded code blocks, the behavioral probes ran on 3,559, and 89% changed behavior: an exception raised or swallowed on inputs near the ones the task tested. The remaining 11% were inert guards and duplicate checks.
This is why “unneeded” does not mean “ignore it.” A reviewer can skip a duplicate null check. A reviewer cannot skip a block that alters what happens on an edge case the tests never reached, precisely because the tests never reached it. Every one of those blocks is a decision the agent made that no test ratifies and no test forbids. Passing tests have never guaranteed that the code underneath is sound; this is the same gap measured block by block.
The Leaderboard Cannot See It
The second result should change how you pick a model. Across the 18 models, the correlation between resolve rate and code necessity on SWE-bench Verified is −0.10, which is to say none. Claude Sonnet 5 resolved 80.6% of tasks with a necessity of 0.922. Gemini 3.7 Flash resolved 81.4% with a necessity of 0.789. Within a point of each other on the score. The second leaves 3.6 times as many unneeded code blocks per task, 1.23 against 0.34.
On DeepSWE, the longer-horizon benchmark, the correlation goes the other way: −0.59. The models that solve more tasks leave more unneeded code. The composition of the bloat moves too. DeepSWE tasks are feature builds with about six times more blocks per patch, and there 58% of the extra edits are code, not tests. The longer the task, the more the excess migrates from the test file into the source.
The paper’s recommendation follows directly: benchmarks should report necessity next to resolve rate, with a developer baseline. The unit of proof has been moving from scores to merged diffs. This study says the diff needs its own score, because a benchmark number tells you how often a model finishes and nothing about how much of what it finishes you will have to read.
Cleanup Does Not Belong in the Loop
The third result kills a popular fix. If unneeded code were debugging leftover, the harness could catch it in the loop: revert exploratory edits, forbid scratch scripts, ask the agent to tidy before it submits. The attribution says that is the wrong place to look. Of the 3,987 unneeded code blocks, 154 came from debug steps. 83% came from the step that wrote the fix, and 11% from revisions to it. Scratch scripts and print statements almost never survive into a resolved patch.
Stopping at the first green run of the agent’s own tests confirms it. The early patch still passes the hidden tests 97.3% of the time, and its necessity moves from 0.700 to 0.710. The unneeded code was already there when the tests first went green. It is not scaffolding the agent forgot to remove. It is part of how the agent understood the fix.
Two Cleanups, Two Ways to Be Wrong
So the cleanup has to happen after the patch is written, and the paper tested two ways to do it without access to the hidden tests.
The first is to ask the model. Show it its own final diff and have it justify every block, dropping the ones it cannot. This is precise: 65.7% of what it drops is genuinely unneeded, and it breaks only 1.8% of patches. But it finds only 35.5% of the unneeded code. The model is good at recognizing junk and bad at hunting for it. It drops 40.5% of the unneeded blocks that behave like the patch without them, and only 14.7% of the ones that behave like the full patch. It finds the inert guards and misses the behavior changes, which are the ones that matter.
The second is to let the tests decide. Revert each block and keep the revert if the agent’s own test command and the repository’s existing regression tests still pass. This finds 67.3% of the unneeded code, nearly twice the self-audit, but only 46.3% of what it drops is really unneeded, and 89.1% of patches still resolve afterwards. It applied to 2,495 of 6,724 patches, because the rest had no standalone test command that could be rerun.
Run both and intersect the drops, and precision rises to 67.7% with 98.3% of patches intact. The tests find; the model confirms.
The false drops deserve a sentence of their own. Most of them, the authors write, are code that implements behavior neither the existing tests nor the agent’s tests exercise. That is not only a cleanup error. It is a map of where the test suite is blind, which is the same place the next bug will come from.
What to Do This Week
- Stop gating on diff size. Split test edits from code edits in whatever dashboard tracks your agents’ output. A 400-line diff that is 300 lines of tests is a different object from a 400-line diff that is 400 lines of source, and the first one is probably improving your regression coverage.
- Measure necessity on your own tasks before you trust a leaderboard. Pick twenty recent resolved agent patches, revert the code blocks one at a time, and rerun your suite. A day of work, and you learn more about a model’s review cost than its benchmark number will ever tell you.
- Put the audit after the fix, and run both kinds. Test-based reversion to find candidates, a model pass to confirm them, and a human look at whatever the tests wanted to drop. Expect the model to miss two-thirds and the tests to over-drop half.
- Keep the tests. Check their timing. The agent’s tests are the strongest in the repository by mutation score, and they catch bugs the official ones miss. If your harness can make the agent write them before the fix rather than after, you get a failing test as evidence the bug was reproduced.
- If you fine-tune, debloat the trajectories. The authors recommend dropping test-unneeded units from training patches before supervised fine-tuning. Over-editing is written into the fix step, so that is where training has to change it.
- Log every false drop. When test-based pruning wants to remove a block and a human keeps it, you have found a behavior your suite does not cover. Write the test.
In Harness Engineering: The Complete Guide to Agent-First Software Development, I argued that a harness is judged by what it makes reviewable. This study gives that word a measurement. Reviewable is not small. It is the share of the patch a test can defend, and the share of the rest that changes behavior anyway. The first is a number you can compute today. The second is the reason you still read the diff.