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 12 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 31 Aug 2026

Hugging Face Unveils StepGuard: Step-Level Guardrails for Safer AI Agents

StepGuard, a new step-level guard model from Hugging Face, audits agent actions before execution, reducing attack success rates by...

1
Research paper
Hugging Face 31 Aug 2026

Hugging Face Researchers Unveil ABot-Recon for Stable Long-Horizon 3D Reconstruction

ABot-Recon, a new streaming 3D reconstruction model from Hugging Face, achieves stable long-horizon performance using only local t...

1
Research paper
Hugging Face 31 Aug 2026

ContextPilot: Teaching Agents Proactive Context Management via Fine-Grained RL

Hugging Face researchers introduce ContextPilot, a framework that enhances long-horizon agent reasoning by expanding context-editi...

1