语义等价的代码变换如何影响代码大模型的成员推理? How Do Semantically Equivalent Code Transformations Impact Membership Inference on LLMs for Code? 预印本

⚠️ 本文为 预印本(arXiv 公开版本),尚未经过正式同行评审。作者自发公开,结论未经期刊审稿验证,阅读时请知悉。
发布时间:2025-12-17
👁️ 预览文献
💡 AI 中文简介
大模型训练常使用受版权保护的代码,成员推理技术可检测未授权使用,但语义等价的代码变换可能规避检测。本文系统研究了多种代码变换规则对成员推理的影响,发现最差情况下模型准确率仅下降1.5%,变换后的数据集可有效替代原始数据微调;其中变量重命名规则使成员推理成功率降低10.19%,因果分析证实其干扰效果最强,且组合多种变换不会进一步降低检测效果。这揭示了许可证合规执行中的关键漏洞。
领域大语言模型安全与隐私 / 代码智能
适合谁读需要一定专业背景(了解大模型、成员推理和代码分析)
核心贡献1. 首次系统评估语义等价代码变换对成员推理检测的规避效果;2. 通过因果分析确认变量重命名是干扰成员推理的最强因素,并发现组合变换无叠加效应。
关键数据最差情况下模型准确率仅下降1.5%;变量重命名使成员推理成功率降低10.19%;组合多种变换未进一步降低成员推理效果。
推荐理由如果你关心大模型训练中的代码版权合规问题,这篇论文揭示了现有检测技术的一个致命漏洞,值得一读。
关键词["成员推理", "代码大模型", "语义等价变换", "许可证合规", "因果分析"]

原文摘要

查看英文原文摘要

The success of large language models for code relies on vast amounts of code data, including public open-source repositories, such as GitHub, and private, confidential code from companies. This raises concerns about intellectual property compliance and the potential unauthorized use of license-restricted code. While membership inference (MI) techniques have been proposed to detect such unauthorized usage, their effectiveness can be undermined by semantically equivalent code transformation techniques, which modify code syntax while preserving semantic. In this work, we systematically investigate whether semantically equivalent code transformation rules might be leveraged to evade MI detection. The results reveal that model accuracy drops by only 1.5% in the worst case for each rule, demonstrating that transformed datasets can effectively serve as substitutes for fine-tuning. Additionally, we find that one of the rules (RenameVariable) reduces MI success by 10.19%, highlighting its potential to obscure the presence of restricted code. To validate these findings, we conduct a causal analysis confirming that variable renaming has the strongest causal effect in disrupting MI detection. Notably, we find that combining multiple transformations does not further reduce MI effectiveness. Our results expose a critical loophole in license compliance enforcement for training large language models for code, showing that MI detection can be substantially weakened by transformation-based obfuscation techniques.