A lot of AI-generated patches feel like slop because frontier models still struggle with something we barely consider a task at all for a software engineer: 𝗱𝗲𝗹𝗲𝘁𝗶𝗻𝗴 𝘁𝗵𝗲 𝗿𝗶𝗴𝗵𝘁 𝗰𝗼𝗱𝗲 𝗮𝗻𝗱 𝘀𝘁𝗼𝗽𝗽𝗶𝗻𝗴.</p>\n<p>We built CanItDelete, 200 tasks from real commits where deletion is the entire edit. No rewiring. No replacement logic. It diagnoses retention, partial deletion, over-deletion, and boundary errors.</p>\n<p>Claude Opus 4.8 still failed 21% of tasks, GPT-5.6 Sol 26%, and GLM-5.2, Kimi K2 Thinking, MiniMax-M3, and DeepSeek-V4-Pro roughly one in three. Most failures left required code behind.</p>\n<p>Giving models the exact lines helped, but exposed another problem. Claude reached 97.7%, while GLM-5.2 still failed 12%, GPT-5.6 Sol 18%, and Qwen3-235B 42%. For some models, better localization traded incomplete deletion for over-editing.</p>\n<p>In real repository work, this becomes 𝙂𝙪𝙖𝙧𝙙-𝙖𝙣𝙙-𝙂𝙤. Instead of removing obsolete logic, models keep it live behind a guard or fallback, often as the default path for inputs the guard does not catch. Across five leading SWE-bench Verified submissions, 29% of passing patches did this.</p>\n<p>That can pass tests. It is not merge-ready.</p>\n<p>When we required the code to actually be gone on deletion-heavy tasks, resolution fell 21.3 points, and a third of accepted patches failed.</p>\n<p>The hopeful result is that deletion can be taught. Adding just 0.7% deletion-focused data cut incomplete deletion by 13.9 points and improved SWE-bench Verified by 5.3 points. Over-deletion also rose, showing that completing a removal and stopping at its boundary are distinct skills.</p>\n<p>𝗜𝗳 𝗰𝗼𝗱𝗶𝗻𝗴 𝗮𝗴𝗲𝗻𝘁𝘀 𝗮𝗿𝗲 𝘁𝗼 𝗽𝗿𝗼𝗱𝘂𝗰𝗲 𝗺𝗲𝗿𝗴𝗲-𝗿𝗲𝗮𝗱𝘆 𝗰𝗼𝗱𝗲, 𝘄𝗲 𝗻𝗲𝗲𝗱 𝘁𝗼 𝘁𝗿𝗮𝗶𝗻 𝘁𝗵𝗲𝗺 𝗹𝗶𝗸𝗲 𝘀𝗼𝗳𝘁𝘄𝗮𝗿𝗲 𝗲𝗻𝗴𝗶𝗻𝗲𝗲𝗿𝘀. 𝗡𝗼𝘁 𝗼𝗻𝗹𝘆 𝘄𝗵𝗮𝘁 𝘁𝗼 𝘄𝗿𝗶𝘁𝗲, 𝗯𝘂𝘁 𝘄𝗵𝗮𝘁 𝗺𝘂𝘀𝘁 𝗻𝗼 𝗹𝗼𝗻𝗴𝗲𝗿 𝗲𝘅𝗶𝘀𝘁.</p>\n","updatedAt":"2026-08-04T16:41:26.358Z","author":{"_id":"679bb3a518279c15eb512f08","avatarUrl":"/avatars/390c7abfa9b69c425c2cb4b370aec8f9.svg","fullname":"Gopi Krishnan Rajbahadur","name":"gopirajbahadur","type":"user","isPro":false,"isHf":false,"isHfAdmin":false,"isMod":false,"followerCount":0,"isUserFollowing":false}},"numEdits":0,"identifiedLanguage":{"language":"en","probability":0.9170010089874268},"editors":["gopirajbahadur"],"editorAvatarUrls":["/avatars/390c7abfa9b69c425c2cb4b370aec8f9.svg"],"reactions":[],"isReport":false}}],"primaryEmailConfirmed":false,"paper":{"id":"2607.28887","authors":[{"_id":"6a7214f41a375f948521c237","name":"Amir M. Ebrahimi","hidden":false},{"_id":"6a7214f41a375f948521c238","name":"Mohammed Mehedi Hasan","hidden":false},{"_id":"6a7214f41a375f948521c239","name":"Aaditya Bhatia","hidden":false},{"_id":"6a7214f41a375f948521c23a","name":"Gopi Krishnan Rajbahadur","hidden":false},{"_id":"6a7214f41a375f948521c23b","name":"Ahmed E. Hassan","hidden":false}],"publishedAt":"2026-07-30T00:00:00.000Z","submittedOnDailyAt":"2026-08-04T00:00:00.000Z","title":"To Add Is Machine, To Delete Is Human: Measuring and Mitigating Deletion Avoidance in LLM Code Editing","submittedOnDailyBy":{"_id":"679bb3a518279c15eb512f08","avatarUrl":"/avatars/390c7abfa9b69c425c2cb4b370aec8f9.svg","isPro":false,"fullname":"Gopi Krishnan Rajbahadur","user":"gopirajbahadur","type":"user","name":"gopirajbahadur"},"summary":"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.","upvotes":18,"discussionId":"6a7214f41a375f948521c23c","organization":{"_id":"6a6b5deeb1af62127993f240","name":"centre-for-swe","fullname":"Centre for Software Excellence","avatar":"https://cdn-avatars.huggingface.co/v1/production/uploads/641eb5df2c631e05c2ce1a14/9wRESEKkkYDb_nyTAHNZs.jpeg"}},"canReadDatabase":false,"canManagePapers":false,"canSubmit":false,"hasHfLevelAccess":false,"upvoted":false,"upvoters":[{"_id":"679bb3a518279c15eb512f08","avatarUrl":"/avatars/390c7abfa9b69c425c2cb4b370aec8f9.svg","isPro":false,"fullname":"Gopi Krishnan Rajbahadur","user":"gopirajbahadur","type":"user"},{"_id":"6890f86e5094247d860f994b","avatarUrl":"https://cdn-avatars.huggingface.co/v1/production/uploads/no-auth/KV6KsbQZcw1dt-jlZIdeW.png","isPro":false,"fullname":"kc","user":"kcmnd","type":"user"},{"_id":"656e856d69c864caa8316ec1","avatarUrl":"/avatars/2534d5320d62153ed2cfd6d5657f13aa.svg","isPro":false,"fullname":"Mohammed Mehedi Hasan","user":"talismanic","type":"user"},{"_id":"6a6b879c23300cbfc3fcfe68","avatarUrl":"/avatars/1074cd49a69a00a74deb73bd96c08135.svg","isPro":false,"fullname":"disconnectedpiz","user":"disconnectedpiz","type":"user"},{"_id":"6642337172bf301490ac1db3","avatarUrl":"/avatars/be1e4c42ff862466a6162831a007686d.svg","isPro":false,"fullname":"Arthur Leung","user":"arcyleung","type":"user"},{"_id":"6a077cdfd9561466dbc76ba9","avatarUrl":"/avatars/03903ef591c7693ba85db61607529402.svg","isPro":false,"fullname":"Zhe Chen","user":"sirumcz","type":"user"},{"_id":"66a519f02b460286b0791db1","avatarUrl":"/avatars/470a6351e73c657df11b082f654749ad.svg","isPro":true,"fullname":"Boyuan Chen","user":"nemocbb","type":"user"},{"_id":"65df7e27f3764d5a79274300","avatarUrl":"/avatars/9e3f45e275b4f4092fb90228c6bcfd55.svg","isPro":false,"fullname":"Lin","user":"justina777","type":"user"},{"_id":"685b069c664acf4e82ff3ca1","avatarUrl":"/avatars/5f80a093a82facc7f6e2349610c3e370.svg","isPro":false,"fullname":"Gustavo Oliva","user":"golivax","type":"user"},{"_id":"691f4cf51968af2d31dc42ca","avatarUrl":"/avatars/c4b8db877fbb0b8b10de51e80854bb70.svg","isPro":false,"fullname":"Feng Lin","user":"fenglin1hpartners","type":"user"},{"_id":"65e1380962dc88375763e77f","avatarUrl":"/avatars/87cd7a69c9d12b295ee67c9b1b90ef03.svg","isPro":false,"fullname":"Ben Rombaut","user":"brombaut","type":"user"},{"_id":"641eb5df2c631e05c2ce1a14","avatarUrl":"/avatars/eec57b042c92b77b66894af4ec358602.svg","isPro":false,"fullname":"Yihao Chen","user":"Superskyyy","type":"user"}],"acceptLanguages":["en"],"dailyPaperRank":0,"organization":{"_id":"6a6b5deeb1af62127993f240","name":"centre-for-swe","fullname":"Centre for Software Excellence","avatar":"https://cdn-avatars.huggingface.co/v1/production/uploads/641eb5df2c631e05c2ce1a14/9wRESEKkkYDb_nyTAHNZs.jpeg"},"markdownContentUrl":"https://huggingface.co/buckets/huggingchat/papers-content/resolve/2607/2607.28887.md","query":{}}">
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 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.
Community
A lot of AI-generated patches feel like slop because frontier models still struggle with something we barely consider a task at all for a software engineer: 𝗱𝗲𝗹𝗲𝘁𝗶𝗻𝗴 𝘁𝗵𝗲 𝗿𝗶𝗴𝗵𝘁 𝗰𝗼𝗱𝗲 𝗮𝗻𝗱 𝘀𝘁𝗼𝗽𝗽𝗶𝗻𝗴.
We built CanItDelete, 200 tasks from real commits where deletion is the entire edit. No rewiring. No replacement logic. It diagnoses retention, partial deletion, over-deletion, and boundary errors.
Claude Opus 4.8 still failed 21% of tasks, GPT-5.6 Sol 26%, and GLM-5.2, Kimi K2 Thinking, MiniMax-M3, and DeepSeek-V4-Pro roughly one in three. Most failures left required code behind.
Giving models the exact lines helped, but exposed another problem. Claude reached 97.7%, while GLM-5.2 still failed 12%, GPT-5.6 Sol 18%, and Qwen3-235B 42%. For some models, better localization traded incomplete deletion for over-editing.
In real repository work, this becomes 𝙂𝙪𝙖𝙧𝙙-𝙖𝙣𝙙-𝙂𝙤. Instead of removing obsolete logic, models keep it live behind a guard or fallback, often as the default path for inputs the guard does not catch. Across five leading SWE-bench Verified submissions, 29% of passing patches did this.
That can pass tests. It is not merge-ready.
When we required the code to actually be gone on deletion-heavy tasks, resolution fell 21.3 points, and a third of accepted patches failed.
The hopeful result is that deletion can be taught. Adding just 0.7% deletion-focused data cut incomplete deletion by 13.9 points and improved SWE-bench Verified by 5.3 points. Over-deletion also rose, showing that completing a removal and stopping at its boundary are distinct skills.
𝗜𝗳 𝗰𝗼𝗱𝗶𝗻𝗴 𝗮𝗴𝗲𝗻𝘁𝘀 𝗮𝗿𝗲 𝘁𝗼 𝗽𝗿𝗼𝗱𝘂𝗰𝗲 𝗺𝗲𝗿𝗴𝗲-𝗿𝗲𝗮𝗱𝘆 𝗰𝗼𝗱𝗲, 𝘄𝗲 𝗻𝗲𝗲𝗱 𝘁𝗼 𝘁𝗿𝗮𝗶𝗻 𝘁𝗵𝗲𝗺 𝗹𝗶𝗸𝗲 𝘀𝗼𝗳𝘁𝘄𝗮𝗿𝗲 𝗲𝗻𝗴𝗶𝗻𝗲𝗲𝗿𝘀. 𝗡𝗼𝘁 𝗼𝗻𝗹𝘆 𝘄𝗵𝗮𝘁 𝘁𝗼 𝘄𝗿𝗶𝘁𝗲, 𝗯𝘂𝘁 𝘄𝗵𝗮𝘁 𝗺𝘂𝘀𝘁 𝗻𝗼 𝗹𝗼𝗻𝗴𝗲𝗿 𝗲𝘅𝗶𝘀𝘁.
Upload images, audio, and videos by dragging in the text input, pasting, or clicking here.
Tap or paste here to upload images
Cite arxiv.org/abs/2607.28887 in a model README.md to link it from this page.
Cite arxiv.org/abs/2607.28887 in a dataset README.md to link it from this page.
Cite arxiv.org/abs/2607.28887 in a Space README.md to link it from this page.
Discussion (0)
Sign in to join the discussion. Free account, 30 seconds — email code or GitHub.
Sign in →No comments yet. Sign in and be the first to say something.