ChatPaper.aiChatPaper

「追加するは機械、削除するは人間:LLMコード編集における削除回避の測定と緩和」

To Add Is Machine, To Delete Is Human: Measuring and Mitigating Deletion Avoidance in LLM Code Editing

July 30, 2026
著者: Amir M. Ebrahimi, Mohammed Mehedi Hasan, Aaditya Bhatia, Gopi Krishnan Rajbahadur, Ahmed E. Hassan
cs.AI

要旨

大規模言語モデルは、本番コードの作成や修正にますます活用されている。しかし、テストに合格するパッチがコードベースの保守を難しくしているという証拠が増えつつある。我々はその具体的な原因の一つとして、削除回避、すなわち意図した編集が削除を必要とするコードを保持しようとする系統的な傾向を特定した。公式SWE-bench Verifiedリーダーボードの上位5モデルでは、5モデルすべてが解けるタスクであっても、開発者パッチに対する削除再現率は最大で71.7%にとどまる。さらに、モデルは必要な削除の92%以上で正しいファイルに到達する一方、正確な行を削除できるのは52%未満の場合のみである。実際には、テストを通過するパッチの29.0%が、対象のコードをガードまたはフォールバックで包んでおり、我々はこれを「ガード・アンド・ゴー」と呼ぶ。このようなパッチが合格するのは、元のテストが削除をほとんど検証しないためである。対象コードが残っていると失敗するテストをVerifiedタスク34件に後付けしたところ、クローズドおよびオープンウェイトにわたる4つのフロンティアモデルの成功率は63.2%から41.9%に低下した。実際の修正では削除と追加が混在するため、我々は、必要な編集がすべて削除であるタスクを実際のコミットから抽出した200タスクからなるベンチマーク「CanItDelete」を構築した。追加作業がなくなっても、最良のモデルでも5タスクに1つは失敗し、小規模なオープンモデルでは成功率が18.0%にまで落ち込む。次に、GPT-5.6 Solに対して4つの累積プロンプトでアブレーションを行った。正確な行を供給するまでは成功率はほとんど変わらない。正確な行を供給すると不完全な削除はほぼなくなるが、成功率は80.5%にしか上がらない。これは、モデルが指定範囲を超えて削除したり、代わりにコードを追加したりするためである。最後に、パイロット研究を通じて一つの可能な改善策を示す。ポストトレーニング中に削除を学習させることで削除回避が減り、より広範なコード編集性能が向上する。これは、この挙動が手の届かないものではなく、訓練不足によるものであることを示唆している。
English
Large language models increasingly write and repair production code, yet evidence is mounting that their test-passing patches leave codebases harder to maintain. We identify one concrete source: deletion avoidance, the systematic tendency to retain code that an intended edit requires removing. Across the five leading models on the official SWE-bench Verified leaderboard, deletion recall against the developer patch reaches at most 71.7% even on tasks all five solve, and models reach the right file for over 92% of required deletions but cut the exact line in under 52% of cases. Instead, 29.0% of passing patches wrap the targeted code in a guard or fallback, a pattern we call Guard-and-Go. Such patches pass because the original tests rarely check removal: when we retrofit 34 Verified tasks with tests that fail if the targeted code remains, four frontier models spanning closed and open weights fall from 63.2% to 41.9%. Because real repairs mix removal with addition, we curate CanItDelete, a benchmark of 200 tasks mined from real commits whose entire required edit is deletion. Even with the addition work gone, the best model still fails one task in five, and smaller open models fall to 18.0%. We then ablate GPT-5.6 Sol under four cumulative prompts; success moves little until we supply the exact lines, which nearly eliminate incomplete deletion yet raise success only to 80.5% because the model then deletes beyond the spans or adds code instead. Finally, through a pilot study we show one potential fix: teaching deletion during post-training reduces deletion avoidance and improves broader code-editing performance, suggesting the behavior is undertrained rather than beyond reach.