Introduction
Code Pre-trained Language Models (CPLMs), such as GitHub Copilot and CodeLlama, have become transformative tools in software engineering. However, their development relies on massive amounts of open-source code, raising significant legal and ethical concerns regarding data infringement. The "black-box" nature of these models makes it difficult for developers to prove if their proprietary or specifically licensed code was included in a model's training set.
To address this, researchers have introduced Code Membership Inference (CMI), a task designed to identify whether a specific code snippet was part of a CPLM’s training data. This paper presents BUZZER, a framework that provides a technical path for detecting unauthorized data use and protecting intellectual property in AI-assisted coding.
Methodology
The BUZZER framework is designed to operate in both "white-box" (full model access) and "black-box" (limited access) settings. It consists of three primary pillars:
- Signal Extraction: Instead of relying solely on final outputs, BUZZER analyzes the loss values of the model during its original pre-training tasks (e.g., Masked Language Modeling). Models typically exhibit much lower error on data they have encountered before.
- Hard-to-Learn Sample Calibration: To distinguish between code that is naturally difficult to learn and code the model hasn't seen, BUZZER uses a separate Calibrate Model to normalize signals.
- Weighted Inference: The framework utilizes sub-networks with self-attention layers to weight signals from different pre-training tasks, producing a final membership confidence score.
In black-box scenarios, BUZZER employs a Shadow Model—trained to mimic the target model—to generate the necessary training data for the inference classifier.
Experimental Setup
The researchers evaluated BUZZER using two primary data sources:
- CodeSearchNet (CSN): Used to train and test CodeBERT and CodeT5.
- Magicoder-Evol-Instruct-110k (MEI): Used to evaluate larger models like DeepseekCoder and CodeLlama.
To ensure rigorous testing, the data was partitioned into three disjoint sets for the target, shadow, and calibration models, preventing any data leakage.
Key Results and Insights
The evaluation across representative CPLMs yielded several significant findings:
- High Detection Accuracy: For CodeLlama, BUZZER achieved an AUC of 0.98 in white-box settings and 0.979 in black-box settings, proving that auditing is viable even without internal model weights.
- The Memorization Effect: Larger models (e.g., CodeLlama-7B) were easier to audit than smaller ones, suggesting that increased parameter counts lead to "over-memorization" of training data.
- Calibration is Essential: Without calibration, inference accuracy drops significantly. By accounting for the inherent difficulty of code snippets, BUZZER effectively widens the gap between member and non-member scores.
In legal contexts where low false-positive rates are critical, BUZZER maintained a True Positive Rate (TPR) of over 41% at a strict 0.1% False Positive Rate (FPR) for CodeLlama, far outperforming simple distribution-based baselines.
Conclusion and Future Work
BUZZER demonstrates that code membership can be inferred with high precision, offering a tool for auditing large-scale language models. Future work will focus on extending this framework to multimodal models and addressing the practical challenges of collecting representative "non-member" data in real-world scenarios.
Summary updated