「モデルが過剰に編集するとき:最小限のコード編集の忠実性について」
When Models Edit Too Much: On the Fidelity of Minimal Code Edits
September 3, 2026
著者: Tongyao Zhu, Wei Hern Lim, Min-Yen Kan
cs.AI
要旨
大規模言語モデル(LLM)は既存コードの編集にますます用いられているが、正確さだけでは十分ではない。有用な修正は、最小限であり、レビュー可能であり、元の実装に忠実であることも求められる。我々は、モデルがバグ修正に必要な範囲を超えてコードを書き換える傾向である「過剰編集」を研究する。参照解法に制御されたASTレベルの破壊を注入することで、400件のBigCodeBench問題から評価フレームワークを構築し、各修正タスクに既知の最小パッチを与える。最先端のLLMの間では、GPT-5.5のような強力なモデルであっても過剰編集は広く見られ、高いPass@1が不必要に大きな編集や認知複雑性の増加と共存し得る。保存指示はこの挙動を大幅に低減し、平均超過レーベンシュタイン距離を0.195から0.131に低下させ、追加された認知複雑性を26.6%削減し、Pass@1を2.3ポイント向上させる。しかし、これらの改善は、より大きな推論予算やより大きなモデルから単純にもたらされるわけではない。次に、最小限の編集がポストトレーニング中に直接学習され得るかを問う。教師ありファインチューニングは既知の破壊パターンに過適合する一方で、強化学習は領域外の編集忠実性と性能維持のトレードオフにおいて最良の結果をもたらすことを観察する。これらの結果は、編集忠実性をコード修正品質の独立した軸として位置づけ、それが測定可能かつ学習可能であることを示す。
English
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.