Crimson AI NewsA CrimsonLingua Network service
EN ع
← Back to news
Research paper Hugging Face

LLMs Struggle to Delete Code: New Study Reveals 'Deletion Avoidance' in AI Code Editing

AI By Crimson AI Hugging Face Papers 4 August 2026 · 00:00 21 views
Share: X Telegram

A new study from Hugging Face researchers identifies 'deletion avoidance' in LLM code editing, showing that even top models often retain code that should be removed, leading to maintainability issues. The paper introduces a benchmark called CanItDelete and suggests that deletion can be taught during post-training.

LLMs Struggle to Delete Code: New Study Reveals 'Deletion Avoidance' in AI Code Editing

Key points

Large language models (LLMs) are increasingly used to write and repair production code, but a new study from Hugging Face researchers reveals a systematic flaw: deletion avoidance, the tendency to retain code that an intended edit requires removing. This behavior can lead to codebases that are harder to maintain, even when patches pass tests.

The study, titled "To Add Is Machine, To Delete Is Human," analyzes the performance of leading models on the SWE-bench Verified leaderboard. It finds that even on tasks all five top models solve, deletion recall against the developer patch reaches at most 71.7%. Models locate the correct 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 the researchers call Guard-and-Go.

To measure this phenomenon, the team curated CanItDelete, a benchmark of 200 tasks mined from real commits where the entire required edit is deletion. Results show that even the best model, Claude Opus 4.8, fails 21% of tasks, while GPT-5.6 Sol fails 26%, and smaller open models fall to 18.0% success. When tests were retrofitted to fail if targeted code remains, resolution rates dropped from 63.2% to 41.9% across four frontier models.

The paper also explores mitigation. Providing exact lines to delete helps but introduces over-deletion. A pilot study shows that adding just 0.7% deletion-focused data during post-training reduced incomplete deletion by 13.9 points and improved SWE-bench Verified by 5.3 points, suggesting the behavior is undertrained rather than beyond reach.

ModelFailure Rate (CanItDelete)Failure Rate with Exact Lines
Claude Opus 4.821%2.3%
GPT-5.6 Sol26%18%
GLM-5.2~33%12%
Kimi K2 Thinking~33%N/A
MiniMax-M3~33%N/A
DeepSeek-V4-Pro~33%N/A
Qwen3-235BN/A42%
Source
Hugging Face · Hugging Face Papers
Related news
Research paper
Hugging Face 15 Oct 2026

New Survey Maps How Multimodal AI Agents Remember and Evolve

A Hugging Face survey proposes a two-axis framework for multimodal agent memory, separating how information is formed and represen...

14
Research paper
Hugging Face 15 Oct 2026

CriticOPD Fixes On-Policy Distillation by Letting Teachers Critique Student Errors

Hugging Face researchers introduce CriticOPD, a method that restores the teacher's ability to recover from student mistakes during...

15
Research paper
Hugging Face 15 Oct 2026

ActionOPD: Distilling Agent Decisions, Not Tokens

A new Hugging Face paper proposes ActionOPD, an action-level on-policy distillation method that aligns a student agent's decisions...

16