Bigger AI Coding Patches Aren't Necessarily Worse. A New Study Shows Why

Bigger AI Coding Patches Aren't Necessarily Worse. A New Study Shows Why

●18 ●71
calendar_today ago • schedule5 min read

By Mahan Kenway

Cover: Original conceptual illustration created for this article. It does not depict the study's actual tools or interface.

A coding agent sends you a patch that is twice the size of the human fix. Is it doing unnecessary work, or did it add tests and documentation that the original developer never needed to include in the comparison?

A new Microsoft-authored research preprint suggests that the answer is more complicated than the diff size. The researchers examined 7,660 successful coding-agent trajectories across two software-engineering benchmarks, then tried reverting individual pieces of each patch to see what the tests actually required.

On one benchmark, the median model changed 2.33 times as many lines as the developer patch. But much of the extra material consisted of tests, and the comparison changed dramatically when the researchers looked only at code or used a stronger definition of a necessary edit. The practical message is not that large patches are safe. It is that patch size, test success, and code necessity measure different things.

What the researchers tested

The paper, posted November 25, 2026, comes from Aakash Goel, Benjamin Steenhoek and Yu Hu at Microsoft. It is a preprint, not an independently established finding across all coding tools.

The main experiment used GitHub Copilot CLI with 18 models. It analyzed 6,728 successful patches on SWE-bench Verified, a set of Python repository issues, and 932 successful patches on DeepSWE, which includes longer tasks in several languages. The authors also graded developer patches with the same approach for comparison. These are patches that passed the relevant benchmark checks, not a representative sample of every agent attempt in production.

The method, called Delta Residue Attribution, replays recorded agent actions and divides the final diff into units, typically contiguous blocks of changed lines. The researchers revert one unit at a time and rerun the task tests. If a unit can be removed and the tests still pass, it is labeled unnecessary for those tests. If removing it makes the tests fail, it is counted as needed by that test oracle.

That qualification is important. A test suite can miss useful behavior, and two changes can interact in ways that a one-at-a-time removal experiment does not capture. The label is a way to investigate review risk, not a verdict that a block is safe to delete.

Bigger diffs were often bigger for a reason

On SWE-bench Verified, the median model's patch changed 2.33 times as many lines as the developer patch. Restrict the comparison to non-test files, however, and the median ratio fell to 1.09. The paper also found that 61% of its extra edit units on this benchmark were test-file edits and 13% were documentation. Those are proportions of the paper's defined extra units, not percentages of all changed lines.

There is a subtle measurement issue here: SWE-bench's grading process resets test files, so the researchers could not judge agent-added tests with the same revert-and-rerun task oracle. They counted those test edits as ungraded extras, not as proven waste. A maintainer might welcome a new regression test even if it makes the diff larger.

The picture differed on DeepSWE. There, code accounted for 58% of extra edit units, while tests accounted for 26%. The result is a useful warning against turning the SWE-bench numbers into a universal rule: the task and benchmark can change what “extra” looks like.

Tests matter, but their verdict is not the whole truth

Under the task-test oracle, the average share of code units counted as necessary on SWE-bench Verified was 88.7% for agent patches, compared with 86.4% for developer patches. That does not establish that agent code is generally more disciplined than human code. Both figures are defined by the tests, and the paper says the test-only comparison can miss code that is useful but not covered.

To explore that blind spot, the authors used model-written behavioral probes and compared outcomes against the developer patch. Under this stronger, developer-informed oracle, the average necessity score on the probe cohort was 92.5% for agents and 97.0% for developers: the direction of the comparison reversed. The authors report that these probes are themselves generated by a model, so the strengthened measure is not a substitute for human review either. The paper's methods and probe breakdown make the dependence on the oracle explicit.

The probes also surfaced changes worth a closer look. Among 3,559 agent code units that the task tests alone labeled unnecessary and that could be probed, about 89% changed behavior when reverted on the generated probe inputs. Some of those changes matched behavior in the developer patch, while others did not. That is not evidence that 89% were bugs or malicious changes. It means a passing test suite can leave behavior-changing edits unexamined.

Are the extra tests useful?

The authors ran a separate mutation-testing experiment on 271 SWE-bench Verified instances, introducing 1,962 small artificial bugs. Agent-added or strengthened tests detected 68.1% of those mutants, compared with 77.1% detected by the benchmark task tests. They also caught 5.2% of all mutants that the task tests missed.

That is encouraging, but it is a bounded result. Mutants are deliberately introduced code changes, not a census of production defects; the subset and mutation choices matter. New tests can themselves be weak or encode an agent's mistaken assumption. Still, the experiment provides a concrete reason not to dismiss every additional test as diff noise.

Automatic cleanup can remove real behavior

The study compared several cleanup approaches on subsets of SWE-bench Verified. In one, the model was asked to justify its diff and drop unsupported hunks. Relative to the paper's strengthened oracle, 65.7% of the dropped code hunks were classified as unnecessary, but the audit found only 35.5% of the unnecessary hunks in its evaluated set. The authors report that 1.8% of the regraded patches no longer passed the benchmark task tests after drops.

Another approach repeatedly reverted code units as long as the agent's own tests and existing regression tests still passed. On the 2,495 eligible patches, it found 67.3% of the units the strengthened oracle considered unnecessary, at 46.3% precision. After pruning, 89.1% still passed the benchmark task tests. In other words, this approach found more candidates but also removed more code the stronger check considered needed; about one in nine of those patches no longer passed the task tests.

The cohorts and passing checks differ, so these numbers are not a simple head-to-head quality ranking. The operational lesson is clearer: do not automatically delete a change just because the tests still pass without it. A test-only cleanup system can erase an untested requirement.

A better review workflow

The paper points toward a practical review process, even without reproducing its experiment:

  1. Separate source edits from tests, docs and formatting. Large additions in a test file have a different review purpose from changes to production behavior.
  2. Start with the requested behavior. For each source-code hunk, ask which requirement, failure case or compatibility constraint it addresses. Ask the agent to explain, but check its answer against the code.
  3. Look beyond green tests. Inspect changed error handling, defaults, input validation and side effects. Add targeted tests for edge cases and for behavior outside the immediate happy path.
  4. Treat pruning as a proposal. Use a temporary branch to try removing questionable hunks, run the suite, and inspect the resulting behavior. A passing suite is evidence, not proof that the removed code was redundant.
  5. Keep the benchmark context in mind. The study's main runs use one agent harness and include only successful attempts. Results may not generalize to failed attempts, other repositories or production workflows.

The most useful conclusion is a modest one: a coding agent's larger patch deserves inspection, not an automatic rejection. A smaller patch deserves inspection too. What matters is whether each behavior and each test earns its place, including the parts a benchmark never happened to exercise.

Want more #ai & #software-development deep dives?

Join 6,098+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

More Posts

Frameworks Are Institutional Memory

Ken W. Algerverified - Sep 17

Dozens of email accounts: learning AI coding tools as a student

rahuldk1105 - Oct 27

The Sovereign Vault — A Comprehensive Guide to Protocol-Driven AI

Ken W. Algerverified - Jun 4

I’m a Senior Dev and I’ve Forgotten How to Think Without a Prompt

Karol Modelski - Mar 19

Your AI Doesn't Just Write Tests. It Runs Them Too.

Kevin Martinez - May 12
chevron_left
2.1k Points • 89 Badges
55Posts
0Comments
4Connections
I'm a Developer and an avid Gamer. I love exploring the intersection of Artificial Intelligence, Cyb... Show more

Related Jobs

View all jobs →

Commenters (This Week)

3 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!