Coding Agents Write Bigger Patches — But Mostly Tests

Human Verified

Share to: , and

A computer screen showing a code diff with green added lines under a magnifying glass, beside a small robot, illustrating a study of AI coding agents' patches.

Coding Agents Write Bigger Patches — But Mostly Tests

Microsoft researchers have an answer, in an unreviewed preprint posted this week, to a complaint about AI coding agents: their patches look bloated, but the extra lines are mostly tests and documentation. The code itself, they found, is about as lean as a human developer’s work on the same tasks.

Bigger patches, mostly tests

The team studied 7,660 completed runs of GitHub Copilot CLI, the terminal coding agent, across 18 frontier models. The tasks came from two benchmarks: SWE-bench Verified, with 6,728 runs, and DeepSWE, with 932. Every patch was graded with the same method as the human developers’ own fixes.

By raw size, the agents do write more. On SWE-bench Verified, the median model changed 2.33 times as many lines as the developer patch for the same task. Strip out the test files, though, and the gap nearly vanishes: outside tests, agents changed only 1.09 times as many lines.

How the study graded necessity

To judge whether the extra edits mattered, the researchers built a method called Delta Residue Attribution. It replays each agent’s run, traces every block of the patch to the step that wrote it, then removes each block in turn and reruns the tests to see if it was needed.

On SWE-bench Verified, 61 percent of the extra edits were new tests, and 13 percent were documentation. Code made up only about a fifth. The picture flips on DeepSWE, where tasks are larger feature builds: there, 58 percent of the extra edits were code, and tests accounted for 26 percent.

The residue that remains

The code agents add is not all needed: on average, 11 percent of a patch’s code units were unneeded, and 89 percent of those changed the behaviour. The tests agents wrote caught 68 percent of injected bugs, behind the task tests’ 77 percent — but 5 percent they missed.

The residue does not come from debugging. Only 154 of 3,987 unneeded code units were written during debug steps, and scratch scripts and debug prints almost never survived into finished patches. Fix steps wrote 83 percent of the unneeded code, with revision steps adding another 11 percent.

Which models over-edit

Models differ sharply. At nearly the same success rate, Claude Sonnet 5 left far less unneeded code than Gemini 3.7 Flash, which left about 3.6 times as much per task. Leaner code did not track solving more tasks — and on DeepSWE, the top solvers left the most residue.

Cleaning up afterwards is possible but imperfect. Asking a model to audit its own diff was precise yet found only about a third of the unneeded code. Pruning with the agent’s own tests found about two thirds, at lower precision — and roughly one patch in nine stopped passing.

Why It Matters

The finding reframes how teams should judge coding agents. Patch size alone is a poor quality signal — the tests agents add may be the most valuable part of the diff. Benchmarks should report code necessity next to success rate, and training should prune unneeded edits first.

Background

The study lands as coding agents move from writing snippets to owning whole pull requests, with Anthropic’s Claude Ship now reviewing and approving changes. A companion Microsoft Research paper this week found Copilot adoption cut junior hiring at large firms, showing the tools reshape code and careers alike.

Source: the arXiv preprint and CryptoBriefing’s report.

Share to: , and

Faheem R. Khattak

Senior automation engineer and AI marketing journo covering LLMs, algorithms, analytics, core updates, Bing search, and technical SEO.

0 Comments

Leave a Reply

Optional Take Tag:

🛡️ Spam protection: Honeypot + Time-Trap Active

This site uses Akismet to reduce spam. Learn how your comment data is processed.