跳到正文
原文
HuggingFace Daily Papers(社区热门论文)· HuggingFace Daily Papers(社区热门论文)·· 2026-07-30精选AI 评分73

删除回避:LLM 代码编辑中的系统性缺陷与缓解之道

AI 导读

研究发现,领先模型在 SWE-bench Verified 上对开发者补丁的删除召回率最高仅 71.7%,29.0% 的通过补丁采用 Guard-and-Go 模式保留目标代码。新基准 CanItDelete 含 200 个纯删除任务,最佳模型仍失败 19.5%。在 7B 模型后训练中加入 12.8k 删除示例(占 0.7% token)可将删除回避降低 13.9 个百分点。

推荐理由

这项研究将代码AI补丁的可维护性痛点归结为一种系统性偏差,其基准和训练方法为团队在实际采纳前评估模型提供了更具体的指标。

正文

View PDF HTML (experimental)

Abstract: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.
Subjects: Software Engineering (cs.SE); Artificial Intelligence (cs.AI); Machine Learning (cs.LG)
Cite as: arXiv:2607.28887 [cs.SE]
  (or arXiv:2607.28887v1 [cs.SE] for this version)
  https://doi.org/10.48550/arXiv.2607.28887

arXiv-issued DOI via DataCite

Submission history

From: Amir M. Ebrahimi [view email]
[v1] Thu, 30 Jul 2026 23:07:51 UTC (15,566 KB)

来源:HuggingFace Daily Papers(社区热门论文) · arxiv.org