Skip to main content
QUICK REVIEW

[论文解读] Decoding Secret Memorization in Code LLMs Through Token-Level Characterization

Yuqing Nie, Chong Wang|arXiv (Cornell University)|Oct 11, 2024
Advanced Malware Detection Techniques被引用 4
一句话总结

本文提出 DeSec,一种两阶段方法,通过标记级别的概率分析来区分代码大语言模型中的真实秘密与幻觉秘密。通过识别真实秘密标记的四个关键特征——高且稳定的概率、更强的概率优势以及通过熵实现的早期可检测性,该方法引导解码过程,从而比基于提示的基线方法提取出更多真实且更可信的秘密。

ABSTRACT

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.

研究动机与目标

  • 为解决基于提示工程在检测代码大语言模型中记忆的秘密时存在的高幻觉和低效提取等局限性。
  • 识别代码生成中真实秘密与幻觉秘密之间的内在标记级别特征。
  • 开发一种利用这些特征来引导解码的方法,以提升秘密提取的准确率与多样性。
  • 实现对代码大语言模型中隐私泄露风险的更全面、更可靠的评估。

提出的方法

  • 识别真实秘密标记的四个区分特征:(C1) 概率稳定在高位,(C2) 整体概率更高,(C3) 概率优势更强,以及 (C4) 通过香农熵实现早期可检测性。
  • 利用代理代码大语言模型生成训练数据,构建离线标记评分模型,训练模型以预测某标记属于真实秘密的可能性。
  • 在在线解码过程中应用评分模型,通过将评分模型结果与原始大语言模型的概率相结合,重新分配标记的似然性,引导模型聚焦于真实秘密标记。
  • 采用掩码增强技术,抑制导致基线方法过早终止的无效标记(如 '&')。
  • 通过评分模型对概率进行重加权,提升解码过程中真实秘密标记的选择概率。
  • 在包含 1200 个代码文件、涵盖多种秘密类型的多样化数据集上,对五种最先进代码大语言模型验证该方法。

实验结果

研究问题

  • RQ1哪些标记级别的特征能够区分代码大语言模型中真实秘密与幻觉秘密?
  • RQ2在代理大语言模型上训练的标记级别评分模型,能否有效引导解码以提取真实秘密?
  • RQ3DeSec 在可信率与真实秘密提取方面相较于现有基于提示的基线方法表现如何?
  • RQ4该标记评分模型在不同代码大语言模型架构上的泛化能力如何?

主要发现

  • DeSec 在五种代码大语言模型上平均可信率(PR)达到 44.74%,显著优于 HCR(10.98%)和 BS-5(23.60%)。
  • DeSec 从目标模型中成功提取出 1076 个真实秘密,超过 HCR(230 个真实秘密)和 BS-5(845 个真实秘密)。
  • 对于 StarCoder2-15B,标记评分模型的精确率与 F1 分数均超过 0.90,表明其在代理模型上表现强劲。
  • 该方法通过掩码技术有效缓解了过早终止问题,案例研究显示 DeSec 能生成有效秘密,而 HCR 与 BS-5 则失败或产生不可信输出。
  • 评分模型在 DeepSeek-Coder-6.7B 上的表现受限于对非秘密示例(如 'AKIDz8krbsJ5yKBZQpn74WFkmLPx3EXAMPLE')的记忆,导致这些示例被错误分类为真实秘密。
  • 案例研究证实,DeSec 能生成可信且真实秘密,而 HCR 与 BS-5 则失败或产生不可信输出,验证了概率重加权与评分引导的有效性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。