一句话:系统研究语义等价代码变换对代码大模型成员推断的影响,发现变量重命名可把检测成功率降低约10%。
大型代码语言模型的训练依赖海量代码,其中可能混入受许可证限制的私有代码,成员推断(membership inference, MI)被用于检测此类未授权使用。本文系统考察保持语义的代码变换能否被用来规避 MI 检测:作者对代码数据集施加多种语义等价变换规则,微调代码大模型后测量模型准确率与 MI 攻击成功率的变化,并用因果分析量化各规则的因果效应。结果表明,每条规则在最坏情况下仅使模型准确率下降 1.5%,说明变换后的数据仍可作为微调替代;其中 RenameVariable 使 MI 成功率下降 10.19%,因果分析证实变量重命名对破坏 MI 的因果效应最强;而组合多个变换并不会进一步削弱 MI。该工作揭示了代码大模型许可证合规执法中的关键漏洞。
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.
@inproceedings{paperbot11673,
title = {How Do Semantically Equivalent Code Transformations Impact Membership Inference on LLMs for Code?},
author = {Hua Yang and Alejandro Velasco and Thanh Le-Cong and Md Nazmul Haque and Bowen Xu and Denys Poshyvanyk},
booktitle = {ICSE},
year = {2026},
doi = {10.1145/3744916.3787843}
}