Latest Findings · ASI Lab

Surgical Model Editing Keeps Code LLMs Current Without the Cost of Retraining

Code assistants powered by large language models often keep recommending APIs that libraries have already retired, because their training data is out of date. Instead of retraining a whole model, this work surgically edits only the layers that store the knowledge for one API, bringing a model up to date in seconds while leaving everything else untouched.

Guancheng Lin, Xiao Yu, Jacky Keung, Xing Hu, Xin Xia, Alex X. Liu
Agentic Software Intelligence Research Lab · Department of Computer Science, City University of Hong Kong
PACMSE · 2026

Code assistants powered by large language models often keep recommending APIs that libraries have already retired, because their training data is out of date. Instead of retraining a whole model, this work surgically edits only the layers that store the knowledge for one API, bringing a model up to date in seconds while leaving everything else untouched.

![Grouped bar chart comparing Pre-edit, AdaLoRA, and AdaLoRA-L on four metrics across three sizes of Qwen2.5-Coder]
Performance of the proposed AdaLoRA-L method versus plain AdaLoRA and the unedited model across Effectiveness, Generalization, Portability, and Specificity, for Qwen2.5-Coder at 1.5B, 3B, and 7B scales.

Why it matters

Large language models trained on code learn from snapshots of real projects. When a library replaces torch.svd with torch.linalg.svd, the model keeps recommending the old call, even though the old call will soon stop working. Prior work found that over 37 percent of one popular model's API predictions pointed at deprecated APIs, so stale recommendations are frequent, not rare. Each one can quietly break a build or hand developers code that will not survive the next library update.

The obvious fix, retraining the model on fresh code, is like using a cannon to kill a fly. Retraining a modern code model is slow and expensive, and libraries update constantly, so it is impractical to repeat it every time an API changes. Model editing offers a lighter path: change only the small slice of knowledge that is wrong. This work shows that the right editing target matters, and that a targeted edit can lift a model from near zero accuracy on up to date API calls to near perfect, in a few seconds on one GPU.

Key findings

Correct API knowledge in seconds, not a full retrain

What it means for practitioners

For teams shipping code assistants backed by open source models, this work makes continuous API freshness affordable. Instead of retraining a model each time a library changes, you edit only the layers that hold knowledge for the affected API. The edit runs in seconds on one GPU and the onetime layer identification is amortized to about 0.1 second per edit, so it can be run as part of a regular maintenance cycle.

The method also fits interactive settings like IDE autocomplete. Because it fixes knowledge inside the model, it produces the API in a single pass at roughly half the inference cost of detection and regeneration approaches, and it tends to generate complete parameter correct calls rather than only swapping a name. Teams should still reach for non invasive name swap approaches when the model is closed source or when preserving unrelated behavior matters above all else.

Related reading

Get the paper & cite it

Download full PDF ↓ View at DOI

Official citation: Guancheng Lin, Xiao Yu, Jacky Keung, Xing Hu, Xin Xia, Alex X. Liu (2026). Don't Use a Cannon to Kill a Fly: Lightweight Model Editing for LLMs to Correct Deprecated API Recommendations. Proceedings of the ACM on Software Engineering. DOI: 10.1145/3832130.

model editing deprecated API LLM code generation software maintenance