揭示大语言模型中的预训练代码:一种语法感知的归因方法 Uncovering Pretraining Code in LLMs: A Syntax-Aware Attribution Approach 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2025-11-10
👁️ 预览文献
💡 AI 中文简介
大语言模型可能未经授权使用了受版权保护的代码。本研究提出SynPrune方法,通过分析编程语言的语法结构,识别并排除那些由语法规则强制产生、不反映作者风格的代码片段,从而更准确地判断某段代码是否被用于模型训练。实验表明,该方法在检测准确率上持续优于现有技术,且对不同长度的函数和语法类别都保持稳定。
领域自然语言处理/大语言模型安全与隐私
适合谁读需要一定专业背景(了解大语言模型和成员推断攻击)
核心贡献1. 首次将编程语言的语法结构引入成员推断攻击,提出语法剪枝策略;2. 设计并实现SynPrune方法,在代码归属检测任务上超越现有最优方法。
关键数据SynPrune在多个评估指标上持续优于现有最优方法,且在不同函数长度和语法类别下均表现稳健。
推荐理由如果你关心大模型是否“偷用”了开源代码,这篇论文提供了一种巧妙的语法感知检测方法,既实用又新颖。
关键词["成员推断攻击", "大语言模型", "代码版权", "语法感知", "预训练数据检测"]

原文摘要

查看英文原文摘要

As large language models (LLMs) become increasingly capable, concerns over the unauthorized use of copyrighted and licensed content in their training data have grown, especially in the context of code. Open-source code, often protected by open source licenses (e.g, GPL), poses legal and ethical challenges when used in pretraining. Detecting whether specific code samples were included in LLM training data is thus critical for transparency, accountability, and copyright compliance. We propose SynPrune, a syntax-pruned membership inference attack method tailored for code. Unlike prior MIA approaches that treat code as plain text, SynPrune leverages the structured and rule-governed nature of programming languages. Specifically, it identifies and excludes consequent tokens that are syntactically required and not reflective of authorship, from attribution when computing membership scores. Experimental results show that SynPrune consistently outperforms the state-of-the-arts. Our method is also robust across varying function lengths and syntax categories.