Researchers from Microsoft have developed a new method, Delta Residue Attribution (DRA), to analyze the necessity of edits in code patches generated by AI agents. The study, detailed in a paper published on arXiv, examined 7,660 GitHub Copilot CLI trajectories from 18 different AI models on the SWE-bench Verified and DeepSWE benchmarks. Their findings indicate that agent-generated patches contain a notable amount of "over-editing" compared to human developers. The DRA method works by replaying an agent's trajectory, tracing each block of the final patch to the step that wrote it, reverting each unit, and then re-running task tests to determine if the unit was necessary. This approach allowed the researchers to move beyond simply measuring patch size and to understand the nature and origin of extra edits. The study found that agent patches are, on average, 2.33 times larger than those produced by human developers when measured by lines of code. However, the composition of these extra edits varies depending on the benchmark. On SWE-bench Verified, the majority of the additional edits (61%) were additions of tests, with documentation accounting for another 13%. In contrast, on the DeepSWE benchmark, code constituted 58% of the extra edits. Despite the larger patch sizes, the study also observed that the code written by agents was, on average, at least as necessary as that written by developers. On SWE-bench Verified, 11 out of 18 models left less unneeded code than developers, with an average "necessity percentage" (NP) for code of 0.887 for agents versus 0.864 for developers. On DeepSWE, agents performed comparably to developers, with an NP of 0.797 for agents against 0.785 for developers. On average, 11% of an agent patch's code units on SWE-bench Verified were still unneeded, and 89% of those unneeded units changed behavior. The researchers also investigated the utility of the tests added by agents. They found that agent-added tests caught 73.2% of mutants in needed code and 31.2% in unneeded code. Furthermore, these agent-generated tests occasionally identified bugs that the original task tests missed; 22.7% of mutants that eluded the task tests were caught by tests added or strengthened by the agent. Most agent tests were written after the primary code fix, and few showed a failing-then-passing run, according to the paper. The study's authors, Aakash Goel, Benjamin Steenhoek, and Yu Hu, all from Microsoft, suggest that while agents produce larger patches, a significant portion of the additional content contributes to improved testing and documentation rather than solely redundant code. The introduction of DRA provides a granular method for assessing the actual necessity of each edit within an agent-generated patch, offering a more nuanced understanding of agent performance beyond simple line counts.
Coding Agents Over-Edit With Tests and Documentation, Study Finds
A new study introduces Delta Residue Attribution (DRA) to quantify "over-editing" in code generated by AI agents, finding that agent patches are significantly larger than human-written ones. The research indicates that these additional edits frequently involve adding tests and documentation rather than core functional code changes.