When Models Edit Too Much: On the Fidelity of Minimal Code Edits
LLMs used for code repair have a subtle but important failure mode: they fix the bug, but rewrite far more code than necessary, making diffs harder to review and introducing unintended complexity. This paper quantifies that problem and shows it's widespread even in top models like GPT-4.5 — high pass rates can coexist with bloated, over-engineered edits. The good news is that simply adding a 'preserve the original code' instruction meaningfully reduces over-editing, and reinforcement learning during post-training produces the best generalization for edit fidelity. For teams using LLMs in code review or automated repair workflows, edit minimality is a distinct quality axis worth explicitly measuring and optimizing.
Takeaways3
- High correctness (Pass@1) does not imply minimal edits — frontier models routinely over-rewrite code, adding cognitive complexity beyond what the fix requires.
- A simple preservation instruction in the prompt substantially reduces over-editing and even slightly improves correctness, making it a low-cost win for code repair pipelines.
- Reinforcement learning generalizes edit-fidelity better than supervised fine-tuning, which overfits to seen corruption patterns — important if you're considering fine-tuning models for code repair tasks.




















