SrDetection: A Self-Referential Framework for Data Leakage Detection in Code Large Language Models
作者: Shuaimin Li, Liyang Fan, Zeyang Li, Zhuoyue Wan, Yufang Lin, Shiwen Ni, Feiteng Fang, Hamid Alinejad-Rokny, Yuanfeng Song, Kun Jing, Chen Jason Zhang, Min Yang
分类: cs.CL
发布日期: 2026-06-29
🔗 代码/项目: GITHUB
💡 一句话要点
提出SrDetection以解决代码大语言模型中的数据泄露检测问题
🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)
关键词: 数据泄露检测 代码大语言模型 自引用框架 机器学习安全 模型评估
📋 核心要点
- 现有的数据泄露检测方法依赖于专有数据或不可靠的启发式规则,难以实现普适性和准确性。
- SrDetection通过生成语义等价的样本变体,比较模型在原始样本与变体上的表现,提供了一种新的检测思路。
- 在实验中,SrDetection在灰箱和黑箱设置下的F1分数分别提升了21.52和14.46点,显示出其优越的检测能力。
📝 摘要(中文)
评估代码大语言模型(Code LLMs)需要可靠的数据泄露检测,以防止基准性能因在预训练期间接触基准数据而被人为抬高。现有方法要么假设可以访问专有训练语料,要么依赖于脆弱的启发式方法(如时间戳过滤),或使用手动调整的外部参考集,且这些阈值缺乏通用性。为了解决这些局限性,本文提出了SrDetection,一个统一的自引用泄露检测框架,适用于灰箱(访问模型logits)和黑箱(访问模型输出)设置。SrDetection通过生成基准样本的语义等价变体,并对比模型在原始样本与其变体上的行为,来检测泄露。实验结果表明,SrDetection在不同模型和训练阶段的灰箱设置中平均F1提升21.52点,在黑箱设置中提升14.46点,展示了其强大的、独立于阈值的泄露检测能力。
🔬 方法详解
问题定义:本文旨在解决代码大语言模型中的数据泄露检测问题,现有方法往往依赖于专有数据或不可靠的启发式规则,导致检测效果不佳。
核心思路:SrDetection的核心思路是生成与基准样本语义等价的变体,通过比较模型在原始样本与变体上的表现,来识别数据泄露的情况。这样设计可以有效避免对专有数据的依赖,同时提高检测的准确性。
技术框架:SrDetection框架包括两个主要模块:样本变体生成模块和泄露检测模块。样本变体生成模块负责生成语义等价的样本变体,而泄露检测模块则通过对比模型在原始样本与变体上的输出,来判断是否存在数据泄露。
关键创新:SrDetection的主要创新在于其自引用的检测机制,通过生成变体并进行对比,克服了传统方法对专有数据和手动阈值的依赖,提供了一种更为通用和有效的检测手段。
关键设计:在关键设计上,SrDetection采用了灵活的样本变体生成策略,确保生成的变体在语义上与原样本一致。同时,检测模块设计为不依赖于固定阈值,使得其在不同模型和数据集上均能保持良好的性能。
🖼️ 关键图片
📊 实验亮点
在实验中,SrDetection在灰箱设置下的平均F1分数提升了21.52点,在黑箱设置下提升了14.46点,显著优于现有强基线,展示了其在数据泄露检测中的有效性和鲁棒性。
🎯 应用场景
SrDetection的研究成果在多个领域具有潜在应用价值,尤其是在软件开发和代码审查中,可以有效识别和防止数据泄露问题。此外,该框架的通用性使其能够扩展到其他类型的模型和数据集,为机器学习模型的安全性提供保障。
📄 摘要(原文)
Evaluating code large language models (Code LLMs) requires reliable detection of data leakage, where benchmark performance is artificially inflated by exposure to benchmark data during pre-training. Existing approaches either assume access to proprietary training corpora, rely on brittle heuristics such as timestamp filtering, or use external reference sets with manually tuned, non-generalizable thresholds. To address these limitations, we introduce \textbf{SrDetection}, a unified \textbf{s}elf-\textbf{r}eferential leakage detection framework for both gray-box (access to model logits) and black-box (access to model outputs) settings. SrDetection generates semantically equivalent variants of a benchmark sample and detects leakage by contrasting the model's behavior on the original versus its variants, flagging cases where the original is disproportionately easier for the model. We further design a controlled leakage detection testbed and evaluate SrDetection in this environment. Across different models and training stages, SrDetection improves average F1 by 21.52 points in the gray-box setting and 14.46 points in the black-box setting over strong baselines, demonstrating robust, threshold-independent leakage detection. Finally, a gray-box study of 15 widely used Code LLMs on four popular benchmarks reveals benchmark-specific leakage patterns beyond prior overlap-based analyses\footnote{\footnotesize Source code and data are available at https://github.com/SMinL/SrDetectionCode