The Commonplace
Home Papers Evidence Explore Trends Syntheses Digests References Docs 🎲 Workforce Futures
← Papers
Direction, evidence grade, and study type are AI-generated labels (gpt-5-mini), not human-verified. Syntheses are LLM-written. "Tensions" are machine-detected candidates, not confirmed contradictions. A research-acceleration tool, not peer review. How this is built →

Code-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.

When Models Edit Too Much: On the Fidelity of Minimal Code Edits
Tongyao Zhu, Wei Hern Lim, Min-Yen Kan · September 03, 2026
arxiv descriptive medium evidence 8/10 relevance Full text usable extracted full text Source PDF

Structured author observations

Linked only from stored provider relations; the raw author line above is never matched by name.

Arxiv

Latest observation:

  1. Tongyao Zhu unresolved corpus identity
  2. Wei Hern Lim unresolved corpus identity
  3. Min-Yen Kan unresolved corpus identity
LLMs commonly 'over-edit' when repairing localized bugs—making unnecessarily large or complex changes that pass tests—while an explicit 'preserve original code' prompt and reinforcement learning substantially reduce excess edits without harming functional performance.

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

Paper Typedescriptive Evidence Strengthmedium — The authors use a controlled benchmark of 400 Python functions with injected AST-level corruptions that give a known minimal repair, validate metrics with human annotators, and evaluate many frontier models and interventions (prompting, reasoning variants, SFT, RL). This provides strong internal evidence that over-editing is common and that preservation prompting and RL can reduce it. However, evidence is limited to synthetic, short, Python-only function repairs with small test suites and injected bugs rather than naturally occurring repository edits, which constrains external validity. Methods Rigorhigh — Design uses controlled corruption to know the minimal patch, token-level normalized Levenshtein and cognitive-complexity metrics, human validation of metrics, paired statistical comparisons, and multiple model families and training interventions. Limitations include synthetic bug construction, short-function scope, reliance on small test oracles, and potentially dataset/model selection effects. Sample400 Python problems sampled from BigCodeBench (average 10.4 executable lines, max 34), with 568 injected AST-level corruptions (232 examples with one corruption, 168 with two). Gold repairs are known (50.2% single-token, 91.8% ≤2 tokens). Evaluations span ~20 frontier LLMs (GPT-5.x series, Claude Opus, Gemini, DeepSeek, Grok, Qwen series, etc.), reasoning/non-reasoning variants, preservation vs generic prompts, temperature sampling, and post-training experiments (supervised fine-tuning and reinforcement learning). Metrics: Pass@1, normalized token Levenshtein excess relative to the gold repair, and added cognitive complexity; metrics validated by experienced annotators. Themeshuman_ai_collab productivity GeneralizabilitySynthetic, injected bugs in small functions may not reflect naturally occurring bugs in large repositories or multi-file edits, Benchmark limited to Python and short, single-function repairs (avg 10.4 lines), so results may not extend to other languages or larger codebases, Test suites per task are small (five tests), so some additional edits may be harmlessly undetected or conversely necessary in broader specifications, Models and their behaviors evolve rapidly; results are a snapshot of specific model releases and settings, Selection retained only examples where injected corruption caused test failures, which may bias the sample toward easily testable bugs, SFT overfitting and RL behavior may depend on training data and reward design; transfer to real-world repo fine-tuning is uncertain

Claims (10)

ClaimDirectionOutcomeConfidence & EvidenceDetails
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
0.18
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
0.18
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
0.18
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
0.18
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
0.18
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
0.18
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
0.18
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
0.18
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
0.18
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
0.18

Notes