跳到正文
arXiv cs.CL· Tongyao Zhu, Wei Hern Lim, Min-Yen Kan·· 12 小时前AI 评分38

模型改代码改太多:LLM 最小代码编辑的保真度研究

When Models Edit Too Much: On the Fidelity of Minimal Code Edits

AI 导读

研究构建了基于 400 个 BigCodeBench 问题的评测框架,通过注入 AST 级损坏为每个修复任务提供已知最小补丁,发现过度编辑在前沿 LLM 中普遍存在,GPT-5.5 等强模型也能出现高 Pass@1 与大幅冗余改写并存。

正文 · 原文

View PDF HTML (experimental)

Abstract: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.
Comments: EMNLP 2026 (Main)
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI); Computation and Language (cs.CL)
Cite as: arXiv:2609.04061 [cs.SE]
  (or arXiv:2609.04061v2 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2609.04061

arXiv-issued DOI via DataCite

Submission history

From: Tongyao Zhu [view email]
[v1] Thu, 3 Sep 2026 16:36:05 UTC (390 KB)
[v2] Tue, 20 Oct 2026 04:56:46 UTC (390 KB)

来源:arXiv cs.CL · arxiv.org