Gotcha! This Model Uses My Code! Evaluating Membership Leakage Risks in Code Models
Not on the map. Why?
Abstract (arXiv)
Given large-scale source code datasets available in open-source projects and advanced large language models, recent code models have been proposed to address a series of critical software engineering tasks, such as program repair and code completion. The training data of the code models come from various sources, not only the publicly available source code, e.g., open-source projects on GitHub but also the private data such as the confidential source code from companies, which may contain sensitive information (for example, SSH keys and personal information). As a result, the use of these code models may raise new privacy concerns. In this paper, we focus on a critical yet not well-explored question on using code models: what is the risk of membership information leakage in code models? Membership information leakage refers to the risk that an attacker can infer whether a given data point is included in (i.e., a member of) the training data. To answer this question, we propose Gotcha, a novel membership inference attack method specifically for code models. We investigate the membership leakage risk of code models. Our results reveal a worrying fact that the risk of membership leakage is high: although the previous attack methods are close to random guessing, Gotcha can predict the data membership with a high true positive rate of 0.95 and a low false positive rate of 0.10. We also show that the attacker's knowledge of the victim model (e.g., the model architecture and the pre-training data) impacts the success rate of attacks. Further analysis demonstrates that changing the decoding strategy can mitigate the risk of membership leakage. This study calls for more attention to understanding the privacy of code models and developing more effective countermeasures against such attacks.
Key facts. Cited by 11 papers in the map (data through 7 Oct 2026). First posted on arXiv 2 Oct 2023.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2023: 1; 2024: 4; 2025: 5; 2026: 1.
11 papers.
- 2023Exploring ChatGPT's Capabilities on Vulnerability Managementcited by 19
- 2024Does Your Neural Code Completion Model Use My Code? A Membership Inference Approachcited by 9
- 2024Trained Without My Consent: Detecting Code Inclusion In Language Models Trained on Codecited by 8
- 2024An Exploratory Investigation into Code License Infringements in Large Language Model Training Datasetscited by 8
- 2024Developer Perspectives on Licensing and Copyright Issues Arising from Generative AI for Software Developmentcited by 2
- 2026Pretraining Data Exposure in Large Language Models: A Survey of Membership Inference, Data Contamination, and Security Implicationscited by 1
- 2025Are AI Coders Snitches? An Empirical Study of Pretraining Data Detection on Code Large Language Modelscited by 0
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Promptscited by 0
- 2025Towards Privacy-Preserving Code Generation: Differentially Private Code Language Modelscited by 0
- 2025How Do Semantically Equivalent Code Transformations Impact Membership Inference on LLMs for Code?cited by 0
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Casescited by 0
- 2026Pretraining Data Exposure in Large Language Models: A Survey of Membership Inference, Data Contamination, and Security Implications21 May 2026
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Cases20 Dec 2025
- 2025How Do Semantically Equivalent Code Transformations Impact Membership Inference on LLMs for Code?17 Dec 2025
- 2025Towards Privacy-Preserving Code Generation: Differentially Private Code Language Models12 Dec 2025
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Prompts19 Nov 2025
- 2025Are AI Coders Snitches? An Empirical Study of Pretraining Data Detection on Code Large Language Models23 Jul 2025
- 2024Developer Perspectives on Licensing and Copyright Issues Arising from Generative AI for Software Development16 Nov 2024
- 2024Does Your Neural Code Completion Model Use My Code? A Membership Inference Approach22 Apr 2024
- 2024An Exploratory Investigation into Code License Infringements in Large Language Model Training Datasets22 Mar 2024
- 2024Trained Without My Consent: Detecting Code Inclusion In Language Models Trained on Code14 Feb 2024
- 2023Exploring ChatGPT's Capabilities on Vulnerability Management11 Nov 2023