スクラブ・イット・アウト!機械学習の忘却技術を用いたコード言語モデルからの機密情報記憶の消去
Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine Unlearning
September 17, 2025
著者: Zhaoyang Chu, Yao Wan, Zhikun Zhang, Di Wang, Zhou Yang, Hongyu Zhang, Pan Zhou, Xuanhua Shi, Hai Jin, David Lo
cs.AI
要旨
コード言語モデル(CLM)は、コード生成や要約といったソフトウェアエンジニアリングタスクにおいて優れた性能を発揮しているが、最近の実証研究により、重大なプライバシーの脆弱性が明らかになっている。これらのモデルは、訓練データ中の機密情報を意図せず記憶しており、特定のプロンプトを与えるとその情報を逐語的に再現してしまう。この問題に対処するため、訓練データの重複排除や差分プライバシーの強化など、いくつかのアプローチが提案されている。しかし、これらの手法は、デプロイ済みのCLMに対してモデル全体の再訓練を必要とし、多大な計算コストがかかる。本論文では、以下の研究課題に答えることを目指す:CLMによって記憶された機密情報を効果的かつ効率的に消去することは可能か?
我々は、機械学習のアンラーニング(学習解除)を通じて、CLMにおける機密情報の記憶を消去する先駆的な調査を行った。アンラーニングは、モデル全体の再訓練を必要とせず、訓練済みモデルから特定の情報を除去する事後修正手法である。具体的には、まずCLMの訓練データセット内の機密データの記憶リスクを定量化し、5万件の高リスクな記憶サンプルをアンラーニングの対象として選定した。次に、広く使用されている勾配上昇法に基づく2つのアンラーニング手法(基本的な手法と制約付き手法)を検討し、CodeEraserという高度なバリアントを導入した。CodeEraserは、コードの構造的整合性と機能的正しさを維持しながら、機密情報が記憶されたセグメントを選択的に消去する。CodeParrot、CodeGen-Mono、Qwen2.5-Coderという3つのCLMファミリーを用いた広範な実験により、CodeEraserが対象とする機密情報の記憶を効果的かつ効率的に消去しつつ、モデルの有用性を維持することを検証した。
English
While Code Language Models (CLMs) have demonstrated superior performance in
software engineering tasks such as code generation and summarization, recent
empirical studies reveal a critical privacy vulnerability: these models exhibit
unintended memorization of sensitive training data, enabling verbatim
reproduction of confidential information when specifically prompted. To address
this issue, several approaches, including training data de-duplication and
differential privacy augmentation, have been proposed. However, these methods
require full-model retraining for deployed CLMs, which incurs substantial
computational costs. In this paper, we aim to answer the following research
question: Can sensitive information memorized by CLMs be erased effectively and
efficiently?
We conduct a pioneering investigation into erasing sensitive memorization in
CLMs through machine unlearning - a post-hoc modification method that removes
specific information from trained models without requiring full retraining.
Specifically, we first quantify the memorization risks of sensitive data within
CLM training datasets and curate a high-risk dataset of 50,000 sensitive
memorized samples as unlearning targets. We study two widely used gradient
ascent-based unlearning approaches: the vanilla and constraint-based methods,
and introduce CodeEraser, an advanced variant that selectively unlearns
sensitive memorized segments in code while preserving the structural integrity
and functional correctness of the surrounding code. Extensive experiments on
three families of CLMs, i.e., CodeParrot, CodeGen-Mono, and Qwen2.5-Coder,
validate the effectiveness and efficiency of CodeEraser in erasing targeted
sensitive memorization while maintaining model utility.