UNBIND: UNlearning By INference-time Directional Steering for Code LLMs
cs.SE, cs.AI
Submitted: 2026-09-28
Updated: 2026-09-28
License: http://creativecommons.org/licenses/by/4.0/
The gist: Code large language models acquire programming capabilities from large code corpora, but can also memorize implementations that later require removal.
Terminology
Abstract
Code large language models acquire programming capabilities from large code corpora, but can also memorize implementations that later require removal. Code unlearning is needed to control their continued reproduction when copyright or security concerns arise. However, targeted and retained code share computational patterns, creating a tension between forgetting specific implementations and preserving general programming ability. We propose UNBIND, a code unlearning framework that separately considers which hidden states correspond to the target code and how to suppress its reproduction. By constructing separate directions for these objectives, UNBIND achieves selective unlearning at inference time while keeping model weights fixed. Our evaluation covers fourteen baselines across two code models and two corpora. UNBIND achieves the highest joint forgetting and utility score in every setting. It reduces target code reproduction by 97.3% to 99.1% as measured by F-BLEU, with at most two fewer HumanEval+ and six fewer MBPP+ problems solved than the original models. In repeated extraction tests under a fixed budget, the number of targets yielding exact spans of at least 50 tokens falls from 188--262 to 0--2 out of 300 per setting. No extracted span reaches 100 tokens, and the mean best recovery ratio ranges from 0.43% to 6.45%. Multilingual and related-code evaluations further show effective forgetting with limited impact on useful programming capabilities, supporting UNBIND as a practical approach to selective code unlearning.
Sources
- Program Synthesis with Large Language Models
- Evaluating Large Language Models Trained on Code
- Inference-time Unlearning Using Conformal Prediction
- Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine Unlearning
- Qwen2.5-Coder Technical Report
- CodeSearchNet Challenge: Evaluating the State of Semantic Code Search
- TOFU: A Task of Fictitious Unlearning for LLMs
- Divergence Decoding: Inference-Time Unlearning via Auxiliary Models
- Code Llama: Open Foundation Models for Code
- SAGE: Signal-Amplified Guided Embeddings for LLM-based Vulnerability Detection
- Steering Language Models With Activation Engineering
- Attention Smoothing Is All You Need For Unlearning
- Negative Preference Optimization: From Catastrophic Collapse to Effective Unlearning
- Mitigating Memorization Where It Happens
- Representation Engineering: A Top-Down Approach to AI Transparency
Related papers
- Falsification-Based Verification of LLM-Generated Optimization Models: Sound Test Batteries and Their Detection Limits
- GitSkills: A Dataset of Agent Skills on GitHub
- SABER: Benchmarking Operational Safety of LLM Coding Agents in Stateful Project Workspaces
- PackMonitor: Enabling Zero Package Hallucinations Through Decoding-Time Monitoring
- IntentCoding: Amplifying User Intent in Code Generation
- Incentives and Outcomes in Bug Bounties