cs.SESep 28, 2026

UNBIND: UNlearning By INference-time Directional Steering for Code LLMs

Authors: Zhengyang Shan, Jiayun Xin, Yanjun Lin, Xu Qian, Zhiang Liu, Minghui Xu, Yue Zhang, Qin Hu, +2 more

Organizations: Department of Computer Science and Technology Shandong University Qingdao, China

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 \textbf{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.

Figures & tables

Appendix figures & tables4 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. ZeroUnlearn: Few-Shot Knowledge Unlearning in Large Language Models

    May 16, 2026Yujie Lin, Chengyi Yang, Zhishang Xiang +2Large Language Model UnlearningMachine Unlearning

  2. RapidUn: Influence-Driven Parameter Reweighting for Efficient Large Language Model Unlearning

    Dec 4, 2025Guoshenghui Zhao, Huawei Lin, Weijie ZhaoLarge Language Model UnlearningReweighting

  3. RepSelect: Robust LLM Unlearning via Representation Selectivity

    Jun 15, 2026Filip Sondej, Yushi Yang, Adam MahdiLarge Language Model UnlearningSelectivity