删除回避:LLM 代码编辑中的隐藏缺陷及缓解方法
原标题:To Add Is Machine, To Delete Is Human: Measuring and Mitigating Deletion Avoidance in LLM Code Editing
AI 摘要
Hugging Face 每日论文发布了一项研究,指出大型语言模型在代码编辑中存在“删除回避”问题,即系统性地保留本应删除的代码。研究显示,在 SWE-bench Verified 基准上,五个领先模型对开发者补丁的删除召回率最高仅 71.7%,且 29% 的通过补丁采用“Guard-and-Go”模式,通过保留代码并添加守卫来通过测试。研究者构建了 CanItDelete 基准(200 个任务),发现最佳模型仍有 21% 的任务失败,而通过后训练增加删除相关数据可将不完整删除率降低 13.9 点,并提升 SWE-bench Verified 分数 5.3 点,表明该行为可通过训练改善。
正文节选
To Add Is Machine, To Delete Is Human: Measuring and Mitigating Deletion Avoidance in LLM Code Editing 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 recal