0 cumulative citations
View corpus contextCode-writing AIs often rewrite more than they must when fixing bugs, increasing review burden; a simple preservation prompt cuts excess edits and slightly raises test-passing rates, and reinforcement learning can teach models to prefer minimal, faithful repairs.
Citation observations
Cumulative provider counts captured on specific dates; providers are never combined.
Large language models (LLMs) are increasingly used to edit existing code, but correctness alone is not enough: useful repairs should also be minimal, reviewable, and faithful to the original implementation. We study over-editing, the tendency of a model to rewrite code beyond what is required to fix a bug. We construct an evaluation framework from 400 BigCodeBench problems by injecting controlled AST-level corruptions into reference solutions, giving each repair task a known minimal patch. Across frontier LLMs, over-editing is widespread even among strong models like GPT-5.5: high Pass@1 can coexist with unnecessarily large edits and added cognitive complexity. A preservation instruction substantially reduces this behavior, lowering average excess Levenshtein distance from 0.195 to 0.131, reducing added cognitive complexity by 26.6%, and increasing Pass@1 by 2.3 points. However, these gains do not simply follow from a larger reasoning budget or larger models. We next ask whether minimal editing can be learned directly during post-training. We observe that supervised fine-tuning overfits to seen corruption patterns, whereas reinforcement learning gives the best out-of-domain edit-fidelity and performance-retention trade-off. These results position edit fidelity as a distinct axis of code-repair quality and show that it can be measured and learned.
Summary
Main Finding
Large language models commonly “over-edit” code when asked to repair localized bugs: they produce functionally correct patches that change substantially more of the original implementation than the minimal required edit. Over-editing is measurable, widespread across frontier LLMs, can be substantially reduced by a simple preservation prompt, and can be learned during post-training (RL outperforms naive supervised fine-tuning for out-of-domain edit-fidelity without degrading general coding ability).
Key Points
- Definition: over-editing = a passing repair that changes more code than the known minimal fix (measured as excess normalized token-level Levenshtein distance relative to the injected minimal repair).
- Benchmark and scope: focused on local, function-level repairs (brownfield setting). Open-ended refactors or feature additions are outside the scope.
- Prevalence: many state-of-the-art coding models achieve high Pass@1 while still making large, unnecessary edits (examples include large excess edits from GPT-5.x and other frontier models).
- Prompting: adding a short preservation instruction (“keep as much of the original code as possible”) reduced aggregate excess Levenshtein distance from 0.195 to 0.131, lowered added cognitive complexity by 26.6%, and increased Pass@1 by 2.3 percentage points.
- Reasoning and scale: enabling chain-of-thought/reasoning or increasing model size does not reliably reduce over-editing; effects are model-specific and non-monotonic.
- Post-training: supervised fine-tuning tends to overfit to corruption patterns seen in training; reinforcement learning produced the best out-of-domain trade-off — reported example: 0.782 out-of-domain Pass@1 with 0.050 excess Levenshtein distance and no loss in general coding ability.
- Nature of over-editing: often a granularity mismatch — models identify the bug but rewrite data flow, add defensive checks, or restructure code instead of performing the small local change.
- Human validation: metrics align well with developer judgments — excess Levenshtein matched human majority on reviewability in ~95% of cases; audit showed ~82% of high-excess passing repairs contained genuinely unnecessary edits.
Data & Methods
- Benchmark construction:
- Base: 400 problems sampled from BigCodeBench (Python functions with executable tests).
- Corruptions: inject 1–2 controlled AST-level corruptions per reference solution from a predefined corruption set; keep only examples where corrupted solutions fail the original tests. Total = 568 corruption applications.
- Characteristics: functions average 10.4 executable lines; gold repairs are intentionally tiny (50.2% require 1 token edit, 91.8% ≤ 2 tokens, none > 2 lines).
- Code and data: authors provide code (link in paper).
- Metrics:
- Functional success: Pass@1 (task passes all tests).
- Edit size: token-level normalized Levenshtein distance on function bodies. Define Dgold = d(G,C) (minimal repair size) and Dmodel = d(M,C). Excess = ELev = Dmodel − Dgold (positive → over-editing).
- Structural overhead: added cognitive complexity (Δ cognitive complexity between model output M and gold G).
- Evaluations:
- Compared many frontier models (reasoning and non-reasoning variants) under generic and explicit preservation prompts.
- Human annotation: three experienced developers annotated blind pairs for reviewability and faithfulness to validate metrics; also a targeted audit of high-excess cases.
- Analyses:
- Prompt ablation (generic vs. preservation).
- Reasoning vs. non-reasoning variants within model families.
- Size scaling study on Qwen2.5-Coder-Instruct family (0.5B → 32B).
- Error-type breakdown showing over-editing concentrated for ambiguous, boundary, and list/conditional bugs.
- Post-training experiments: supervised fine-tuning vs. RL for minimizing excess edits while preserving overall performance.
Implications for AI Economics
- New quality axis affects adoption economics: edit fidelity (minimal, reviewable fixes) is distinct from functional correctness and materially impacts developer review costs, time-to-merge, and operational risk in brownfield maintenance.
- Over-edited patches increase reviewer cognitive load and diff churn, which raises human labor costs and slows integration — these are measurable hidden costs not captured by Pass@1 alone.
- Procurement and evaluation: organizations buying or deploying coding models should include edit-fidelity metrics (excess edit distance, added cognitive complexity) in evaluation and SLAs, not just Pass@k. Procurement decisions that ignore fidelity risk underestimating the total cost of model-assisted maintenance.
- Incentives for providers: model providers can gain value by optimizing for edit fidelity (via prompting, RL fine-tuning, or offering “preservation-aware” modes). This can reduce downstream human review costs and improve product-market fit in maintenance-heavy enterprise settings.
- Cost-benefit of post-training: simple supervised fine-tuning may overfit to specific corruption patterns and not generalize, potentially wasting investment; RL-style fine-tuning appears to yield better out-of-domain fidelity without degrading coding performance. Firms should weigh the additional engineering/training costs of RL against expected savings in review time and reduced risk.
- Product design and workflow changes: integrating preservation prompts or “minimal-edit” modes into developer tooling (patch suggestions, PR bots) is a low-cost intervention with measurable gains and could be adopted quickly to lower friction. Vendors can surface a fidelity toggle (conservative vs. robust fix) to match user needs.
- Risk management: unseen over-editing (passing tests but changing large swaths) can introduce latent regressions in production—risk models and expected cost of faults should account for over-editing-induced regression probability. Monitoring and post-hoc audits should track edit-fidelity as a risk signal.
- Benchmarking & marketplace effects: standardized fidelity benchmarks will reshape competition — models that preserve code succinctly will command premium in maintenance contexts. This also signals an economic opportunity for niche models or fine-tuned variants targeted at brownfield repair tasks.
Limits noted by authors (relevant for economic interpretation): - Benchmark focuses on local repairs; intentional refactors or feature changes that legitimately edit broadly are out of scope. - Minimal repair objective assumes the injected corruption’s reversal is the best/desired fix; real-world fixes can validly differ (but the controlled setup isolates over-editing behavior).
Overall, the paper argues that edit fidelity is measurable, economically relevant, and actionable: simple prompts and appropriate post-training (especially RL) can reduce unnecessary edits and their downstream costs.
Assessment
Claims (10)
| Claim | Direction | Outcome | Confidence & Evidence | Details |
|---|---|---|---|---|
| Frontier LLMs frequently over-edit code: they can pass the repair tests while changing substantially more code than the known minimal repair. Output Quality | negative | Edit fidelity and functional code-repair quality |
Reading fidelity
high
Study strength
medium
|
n=400
|
| GPT-5.5 High achieves Pass@1 of 0.823 while having excess edit distance more than four times that of Claude Opus 4.7. Output Quality | mixed | Functional repair success and edit fidelity |
Reading fidelity
high
Study strength
medium
|
n=400
Pass@1 = 0.823; excess distance more than 4× Claude Opus 4.7's
|
| Adding an explicit instruction to preserve the original code reduces aggregate excess normalized Levenshtein distance from 0.195 to 0.131. Output Quality | positive | Excess normalized token-level Levenshtein distance |
Reading fidelity
high
Study strength
medium
|
n=50
0.195 to 0.131
|
| Preservation prompting reduces added cognitive complexity by 26.6%. Output Quality | positive | Added cognitive complexity of repaired code |
Reading fidelity
high
Study strength
medium
|
n=50
26.6% reduction
|
| Preservation prompting increases aggregate Pass@1 by 2.3 percentage points. Output Quality | positive | Functional code-repair success rate |
Reading fidelity
high
Study strength
medium
|
n=50
2.3 percentage points
|
| The preservation instruction improves Pass@1 in 40 of 50 frontier model settings. Output Quality | positive | Functional code-repair success rate |
Reading fidelity
high
Study strength
medium
|
n=50
40 of 50 settings
|
| Reasoning does not universally reduce over-editing; its effect on excess edits and added cognitive complexity varies by model and prompt. Output Quality | mixed | Excess edit distance and added cognitive complexity |
Reading fidelity
high
Study strength
medium
|
n=7
|
| Increasing model size does not monotonically reduce excess edit distance or added cognitive complexity among successful repairs. Output Quality | null_result | Excess edit distance and added cognitive complexity |
Reading fidelity
high
Study strength
medium
|
n=400
Excess distance rises from 0.108 at 14B to 0.127 at 32B under the generic prompt
|
| Slice-boundary corruptions have the highest reported excess edit distance among the listed corruption types, despite a high Pass@1. Output Quality | mixed | Functional repair success and excess edit distance by bug type |
Reading fidelity
high
Study strength
medium
|
n=400
Pass@1 = 0.874; excess Levenshtein distance = 0.353
|
| Excess Levenshtein distance aligns closely with human judgments of reviewability and faithfulness. Output Quality | positive | Human-perceived code reviewability and faithfulness |
Reading fidelity
high
Study strength
medium
|
n=100
94.8% agreement for reviewability; 96.9% for faithfulness
|