TRANSMISSION // 2611.34875v1
Do AI Coding Agents Change More Code Than Needed?
Source published
A study of 7,660 coding-agent trajectories finds that patch size can exaggerate over-editing: extra changes often include tests and documentation, while estimates of unnecessary code depend on the tests used to judge it.

A large patch can look wasteful—but size alone cannot show whether its changes are necessary. Researchers traced edits across coding-agent work sessions, then tested what happened when individual blocks were removed. Their results offer a more nuanced picture, along with important caveats about how “needed” is measured.
A fix that changes many lines can be harder to review than one that changes only a few. But a large patch is not automatically over-edited: it may include useful tests or documentation, or code that matters in cases the benchmark’s tests do not cover. To separate patch size from necessity, Aakash Goel, Benjamin Steenhoek and Yu Hu developed a method for checking what individual parts of coding-agent patches contribute.
The team studied 7,660 resolved task trajectories produced through GitHub Copilot CLI by 18 models. The tasks came from SWE-bench Verified, a benchmark of Python repository issues, and DeepSWE, a set of longer-horizon tasks across several programming languages. They also graded developer patches using the same method, providing a comparison under the same testing rules.
Their approach, called Delta Residue Attribution (DRA), replays an agent’s work step by step and splits its final patch into blocks of changed lines. Researchers trace each block to the step that introduced it, then remove the block and rerun the task tests. If the patch still passes, the block is labelled unneeded by that test-based measure. The authors also use language-model-written behavioral probes: differential calls run on the agent’s patch, the patch with a block reverted, and the developer patch. These probes examine whether removing a block changes behavior and how that behavior relates to the developer patch; they provide evidence, not proof of correctness.
Bigger patches do not tell the whole story
On SWE-bench Verified, agent patches changed more lines than developer patches. Yet the additional edits were not mostly source code: 61% were test-file edits and 13% documentation. Test edits were not graded for necessity in this comparison, because the benchmark resets test files during evaluation. On DeepSWE, the pattern differed: code made up 58% of extra edits.
Looking specifically at code blocks, the researchers’ main test-based measure found that agents’ code was, on average, at least as necessary as developers’ code on both benchmarks. On SWE-bench Verified, 11 of the 18 models had less code classified as unneeded than the developer baseline; for four, the study did not detect a significant difference, and three had more. On DeepSWE, mean code necessity was 0.797 for agents and 0.785 for developer patches. That numerical difference does not establish that the two are equivalent.
On SWE-bench Verified, the task tests classified about 11% of an agent patch’s code blocks as unneeded. The probes examined 3,559 of these test-unneeded blocks; 3,151, or 88.5%, changed behavior when removed. This result applies to the probed subset, not every block classified as unneeded by the tests. Nor does a behavioral change alone show that an edit was unnecessary: some code may implement behavior the task tests miss. In 35.5% of the probed units, the developer patch matched the full agent patch’s behavior rather than the reverted version, so the strengthened assessment treated those edits as needed.
The timing—and the trade-offs of cleanup
The study also traced when unneeded code entered the patch. Debugging steps contributed very little: only 154 of 3,987 test-unneeded code blocks were attributed to debugging. Most were written during steps labelled as applying or refining the fix. This suggests that simply removing leftover debug code may not address most unnecessary source changes in these resolved patches.
The relationship with task-solving success was not consistent across benchmarks. On SWE-bench Verified, code necessity did not correlate with a model’s resolve rate. On DeepSWE, the researchers found a negative correlation: models with higher resolve rates tended to have less necessary code by this measure. These are associations across models, not evidence that adding unnecessary code causes better or worse task performance.
The authors tried two cleanup approaches on SWE-bench Verified and assessed them against a strengthened oracle, O+, which combines task tests with behavioral probes. Asking an agent to audit its own diff was more selective: 65.7% of removed blocks were judged unneeded, but the audit found only 35.5% of unneeded code. Test-based pruning using the agent’s tests plus repository regression tests found 67.3% of unneeded code, with 46.3% precision. These pruning results cover 2,495 eligible patches. In that group, 89.1% of patches still passed the task tests after pruning with both test sources. The approaches therefore trade off finding more flagged code against risking removal of code the oracle considers needed; neither establishes that automated pruning is safe in general.
What “unneeded” can and cannot mean
DRA measures whether a block can be removed without failing a particular set of tests, one block at a time. Tests can miss behavior that matters, and the authors note that an edit the tests do not require may still serve the developer’s intent. Behavioral probes help, but they are written and judged by language models rather than validated through human review of every block. The study also uses one main agent harness, focuses on resolved trajectories, and notes that some trajectories could not be replayed exactly or fully traced. Blocks that are jointly necessary may also be misclassified when tested individually.
The paper is a preprint, so its findings should be treated as provisional rather than as settled consensus. Its central contribution is a way to ask a sharper question than “How large is the patch?”—while showing that the answer depends on the benchmark, the tests, and the definition of necessity. The authors recommend reporting code necessity alongside task resolve rates and exploring both model training and harness-level pruning to reduce unnecessary edits.
- AI coding agents
- software engineering
- code patches
- software testing
- SWE-bench
- over-editing
Reviewed cross-references
These connections were reviewed by a model, not independently fact-checked by a human. Similarity does not imply agreement; consult the original papers and the evidence below.
Why Passing Tests May Not Prove an AI Patch Is Correct
Supporting evidence: Both studies show limits to treating test outcomes as proof of correctness: DRA notes that benchmark tests can miss needed behavior when grading whether patch units are necessary, while SWE-Proof reports counterexamples in nearly a third of test-passing patches. The evidence is complementary, not a direct replication: DRA studies resolved agent patches across SWE-bench Verified and DeepSWE using unit removal and tests, whereas SWE-Proof evaluates Claude Opus 4.8 on a 500-issue benchmark with formal specifications and proofs.
Model review: · openai-codex/gpt-6-luna
Evidence and provenance
Selected excerpts, not complete papers. PDF extraction can omit figures or damage equations, tables and reading order; sources may be preprints.
2611.34875v1 — Original paper
Excerpt reference:
static/papers/2611.34875v1.md:15-79
Basis: Paper text
Source SHA-256:87bc89a33fb7b09212201ac9b078403c2b57b2d0998f3b99ed0882dc0107f20d2609.21190v3 — Original paper
Excerpt reference:
static/papers/2609.21190v3.md:15-69
Basis: Paper text
Source SHA-256:deec578e59f477760ba19741fc72e9ba7c5ef33285d8895b6a9dc694e976ae1b
Related reading
Automatically matched by shared topic keywords. These links do not imply that the sources agree or establish a consensus.
Why Passing Tests May Not Prove an AI Patch Is Correct
Source published
Shared keywords: ai coding agents, software testing
When Coding Benchmarks Reject Valid Fixes
Source published
Shared keywords: ai coding agents, software testing, swe bench
How Much Effort Helps an AI Code Reviewer?
Source published
Shared keywords: software testing, swe bench
A staged training recipe for AI software repair
Source published
Shared keywords: ai coding agents, swe bench
A Proposed Way to Secure Coding-Agent Benchmarks
Source published
Shared keywords: ai coding agents, software testing