一句话:提出四种 token 概率特征区分代码 LLM 的真实与幻觉秘密,并设计两阶段解码方法 DeSec 提升真实秘密提取。
代码大语言模型在训练中会记忆敏感信息,带来严重隐私风险;现有基于提示工程的记忆研究易产生幻觉且提取效率低。本文从 token 概率出发刻画真实秘密与幻觉秘密,识别出四种区分性特征,并提出两阶段方法 DeSec:先利用代理代码 LLM 构建离线 token 打分模型,再用该模型重新分配 token 似然以引导解码过程。在四个先进代码 LLM 与多样化数据集上的实验表明,DeSec 相比现有基线取得更高的合理率并提取出更多真实秘密,说明 token 级方法能有效评估代码 LLM 的隐私泄露风险。
Code Large Language Models (LLMs) have demonstrated remarkable capabilities in generating, understanding, and manipulating programming code. However, their training process inadvertently leads to the memorization of sensitive information, posing severe privacy risks. Existing studies on memorization in LLMs primarily rely on prompt engineering techniques, which suffer from limitations such as widespread hallucination and inefficient extraction of the target sensitive information. In this paper, we present a novel approach to characterize real and fake secrets generated by Code LLMs based on token probabilities. We identify four key characteristics that differentiate genuine secrets from hallucinated ones, providing insights into distinguishing real and fake secrets. To overcome the limitations of existing works, we propose DeSec,a two-stage method that leverages token-level features derived from the identified characteristics to guide the token decoding process. DeSec consists of constructing an offline token scoring model using a proxy Code LLM and employing the scoring model to guide the decoding process by reassigning token likelihoods. Through extensive experiments on four state-of-the-art Code LLMs using a diverse dataset, we demonstrate the superior performance of DeSec in achieving a higher plausible rate and extracting more real secrets compared to existing baselines. Our findings highlight the effectiveness of our token-level approach in enabling an extensive assessment of the privacy leakage risks associated with Code LLMs.
DOI 原文 ·
@inproceedings{paperbot8920,
title = {Decoding Secret Memorization in Code LLMs Through Token-Level Characterization},
author = {Yuqing Nie and Chong Wang and Kailong Wang and Guoai Xu and Guosheng Xu and Haoyu Wang},
booktitle = {ICSE},
year = {2025},
doi = {10.1109/icse55347.2025.00229}
}