On this page
AI Coding Agents Write Bigger Patches: Microsoft Study Finds
tl;dr
Agent patches change 2.33 times more lines than human patches, but most extra edits are tests and documentation. Agent code is also more necessary on average, though 11% of unneeded units change behavior.
Microsoft researchers analyzed 7,660 resolved GitHub Copilot CLI trajectories from 18 frontier models and found agent patches change a median of 2.33 times more lines than developer patches for the same problems on SWE-bench Verified. The study, a preprint dated November 25, 2026, introduces Delta Residue Attribution (DRA) to trace every diff block back to the step that wrote it and measure whether it’s actually needed. What they found upends the standard assumption that bigger patches mean sloppier code — agents’ code necessity scores edge out humans on average, but the unneeded fraction carries real behavioral risk.
How much bigger are agent patches really?
On SWE-bench Verified, agent patches changed a median of 2.33 times more lines than the patches developers wrote for the same problems. The breakdown of those extra lines is revealing: 61% were tests and another 13% were documentation. On the harder DeepSWE benchmark, the mix flips — 58% of extra edits were code modifications rather than tests. This isn’t just a line-count artifact; the researchers traced 6,728 trajectories on SWE-bench Verified and 932 on DeepSWE across 18 models, all running through GitHub Copilot CLI.
The raw size difference has been visible for a while. What’s new is knowing what those lines actually are. Most of the bulk on the standard benchmark comes from test files, not bloated application logic. That distinction matters because it changes where you should focus review attention. If you’re scanning a 500-line PR and 300 lines are new tests, your review strategy differs from one where 300 lines touch core business logic.
Are those extra lines actually needed?
The team built DRA to answer exactly that. It replays each trajectory, splits the final patch into independent units, reverts each unit, and reruns the task tests to see if the fix still passes. On SWE-bench Verified, agents averaged a code necessity score (NP_code) of 0.887 versus 0.864 for human developers, with 11 of 18 models leaving a smaller share of unneeded code than humans. On DeepSWE, agents still edged out developers on average (0.797 vs. 0.785).
But the aggregate hides a concrete risk: 11% of agent code units on SWE-bench Verified are unneeded, and 89% of those unneeded units change program behavior rather than being harmless formatting or comments. Debug steps write almost none of the unneeded code — it’s primarily written during fix steps. That contradicts the common mental model that over-editing is trial-and-error residue from exploration. The waste comes from the implementation phase itself.
What does this mean for code review?
The review bottleneck was already visible before this study. 45% of organizations name code review capacity as the single biggest bottleneck in software delivery, and 67% say pull requests have grown in size since adopting AI coding tools. 82% of respondents say developers still manually review most or all AI-generated code before it’s merged, according to the CodeRabbit-sponsored LeadDev survey. Meanwhile, 54% of respondents at AI-using organizations estimate that more than 60% of AI-generated engineering work needs significant human rework before release, per the Sourcegraph 2026 Big Code report.
The Microsoft data explains why. When 11% of code units are unneeded and nearly all of those change behavior, every PR carries landmines that tests don’t catch. The agent’s own tests detect 68% of injected bugs versus 77% for the task tests, and only 5% of all injected bugs are caught by the agent’s new tests but missed by the task tests. That’s a thin safety margin. SWEPatchTest joint validation rate — requiring reproduction, acceptance of correct patches, and rejection of incorrect ones — sits at just 9.21% for the best configuration. And 68% of repositories with agent test activity contain agent-added mocks that validate real interactions poorly.
| Aspect | SWE-bench Verified | DeepSWE | Human Baseline |
|---|---|---|---|
| Median lines changed (agent vs human) | 2.33× more | Not reported | 1× (reference) |
| Extra edits: tests | 61% | Not reported | — |
| Extra edits: documentation | 13% | Not reported | — |
| Extra edits: code modifications | Not reported | 58% | — |
| Code necessity (NP_code) | 0.887 | 0.797 | 0.864 / 0.785 |
| Unneeded code units | 11% | Not reported | Not reported |
| Unneeded units changing behavior | 89% | Not reported | Not reported |
| DRA pruning recall / precision | 67% / 46% | Not tested | — |
| Agent self-audit recall / precision | 36% / 66% | Not tested | — |
Can automated pruning help?
DRA pruning using only the tests the agent can see (its own tests plus the repository’s) achieves 67% recall and 46% precision — it removes most unneeded code but also cuts needed code. Still, 89% of pruned patches still resolve the task. Asking the agent to audit its own diff is more precise (66% precision) but far less effective at finding the waste (36% recall). Neither approach is a silver bullet, and the paper emphasizes DRA is new and unvalidated on other tools and codebases. This is a preprint that hasn’t undergone formal peer review.
The tradeoff is stark: aggressive pruning risks breaking the fix, conservative pruning leaves behavioral landmines. For teams adopting agents now, the practical takeaway is that harness-level pruning needs to be part of the pipeline, not an afterthought. But you can’t just bolt it on — the precision/recall numbers mean you’ll need human-in-the-loop validation for the foreseeable future.
What should teams do differently?
Benchmarks and engineering teams that report resolve rate without code necessity are optimizing for patch volume, not software quality. Code necessity is unrelated to resolve rate on SWE-bench Verified but negatively correlated with it on DeepSWE (Spearman -0.59, p=0.01). On harder tasks, better resolvers write dirtier code. That’s a pattern I’ve observed: the Review Overhang — generation has outpaced validation, and the unneeded remainder changes behavior in ways that tests, review, and CI cannot filter at agent scale.
Three things follow. First, necessity must be a first-class metric alongside pass/fail in any agent evaluation. Second, test quality gates matter more than test quantity — 61% of extra edits are tests, but agent-generated tests are weak discriminators (SWEPatchTest JVR 9.21%, over-mocked in 68% of active repos). Third, review workflows need to shift from line-by-line inspection to architectural guardrails and automated necessity checks. The data suggests we’re past the point where human review alone can absorb the volume.
The Microsoft study gives us the first rigorous measurement of this problem at scale. It’s not that agents are sloppy — their code is more necessary than humans’ on average. It’s that the minority of unneeded edits carries disproportionate risk, and our current validation stack (tests, review, CI) wasn’t built for this volume or this failure mode. Teams that treat resolve rate as the north star will ship more code that behaves differently than intended. Teams that measure necessity alongside correctness will catch the 11% that changes behavior before it reaches production.
Recommended Reading
-
AI Code Review vs Human Review: The 2026 Tradeoff
AI code review speeds PR generation but overwhelms human reviewers, raising review time by 441%. Cheaper constrained models beat premium agents on security and cost, yet human judgment remains essential for business logic. Teams should route mechanical checks to AI and reserve humans for contextual decisions.
-
The Best AI Coding Extensions for VS Code in 2026
GitHub Copilot leads VS Code AI extensions by installs, but token-based AI Credits now meter agent sessions as a separate cost. Open-source Cline and Kilo Code charge no seat fees, billing only provider inference rates instead.
-
Autonomous Coding Agents in 2026: Cloud vs IDE Agents
Cloud agents are best for persistent, fire-and-forget tasks that survive closed laptops. Local IDE agents are better when you need VPN access, private registries, or interactive debugging. Choose based on where your agent runs, not benchmark scores.