Does Your Neural Code Completion Model Use My Code? A Membership Inference Approach
On the map: LLM safety and security → Membership inference attacks
Abstract (arXiv)
Recent years have witnessed significant progress in developing deep learning-based models for automated code completion. Although using source code in GitHub has been a common practice for training deep-learning-based models for code completion, it may induce some legal and ethical issues such as copyright infringement. In this paper, we investigate the legal and ethical issues of current neural code completion models by answering the following question: Is my code used to train your neural code completion model? To this end, we tailor a membership inference approach (termed CodeMI) that was originally crafted for classification tasks to a more challenging task of code completion. In particular, since the target code completion models perform as opaque black boxes, preventing access to their training data and parameters, we opt to train multiple shadow models to mimic their behavior. The acquired posteriors from these shadow models are subsequently employed to train a membership classifier. Subsequently, the membership classifier can be effectively employed to deduce the membership status of a given code sample based on the output of a target code completion model. We comprehensively evaluate the effectiveness of this adapted approach across a diverse array of neural code completion models, (i.e., LSTM-based, CodeGPT, CodeGen, and StarCoder). Experimental results reveal that the LSTM-based and CodeGPT models suffer the membership leakage issue, which can be easily detected by our proposed membership inference approach with an accuracy of 0.842, and 0.730, respectively. Interestingly, our experiments also show that the data membership of current large language models of code, e.g., CodeGen and StarCoder, is difficult to detect, leaving ampler space for further improvement. Finally, we also try to explain the findings from the perspective of model memorization.
Key facts. Cited by 9 papers in the map (data through 7 Oct 2026). Placed in Membership inference attacks, one of 12 directions in LLM safety and security. Builds on 35 of its 56 references that are in the map. First posted on arXiv 22 Apr 2024.
Builds on
35 of 56 references.
Closest ancestors · 1
Same direction, newest first
Other references · 34
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2014Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modelingcited by 2,341
- 2016Membership Inference Attacks against Machine Learning Modelscited by 2,221
- 2020Extracting Training Data from Large Language Modelscited by 2,144
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
- 2015Gated Graph Sequence Neural Networkscited by 792
- 2023StarCoder: may the source be with you!cited by 790
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2018ML-Leaks: Model and Data Independent Membership Inference Attacks and Defenses on Machine Learning Modelscited by 475
22 more
- 2022A Systematic Evaluation of Large Language Models of Codecited by 360
- 2022The Stack: 3 TB of permissively licensed source codecited by 354
- 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
- 2020Systematic Evaluation of Privacy Risks of Machine Learning Modelscited by 273
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 117
- 2020Code Prediction by Feeding Trees to Transformerscited by 70
- 2021A survey of deep neural network watermarking techniquescited by 69
- 2020Multi-task Learning based Pre-trained Language Model for Code Completioncited by 58
- 2019Pythia: AI-assisted Code Completion Systemcited by 54
- 2017Code Completion with Neural Attention and Pointer Networkscited by 49
- 2020FakeTagger: Robust Safeguards against DeepFake Dissemination via Provenance Trackingcited by 46
- 2022Compilable Neural Code Generation with Compiler Feedbackcited by 46
- 2021CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoningcited by 39
- 2018Digital Watermarking for Deep Neural Networkscited by 37
- 2021Code Completion by Modeling Flattened Abstract Syntax Trees as Graphscited by 30
- 2023CodeMark: Imperceptible Watermarking for Code Datasets against Neural Code Completion Modelscited by 28
- 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
- 2019A Self-Attentional Neural Architecture for Code Completion with Multi-Task Learningcited by 18
- 2024IRCoCo: Immediate Rewards-Guided Deep Reinforcement Learning for Code Completioncited by 13
- 2023Gotcha! This Model Uses My Code! Evaluating Membership Leakage Risks in Code Modelscited by 11
- 2020Sequence Model Design for Code Completion in the Modern IDEcited by 8
Built on by
Citing papers per year: 2025: 5; 2026: 4.
9 papers.
- 2025NES: An Instruction-Free, Low-Latency Next Edit Suggestion Framework Powered by Learned Historical Editing Trajectoriescited by 2
- 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMscited by 1
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Codecited by 1
- 2026Pretraining Data Exposure in Large Language Models: A Survey of Membership Inference, Data Contamination, and Security Implicationscited by 1
- 2025code_transformed: The Influence of Large Language Models on Codecited by 0
- 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
- 2026AST-PAC: AST-guided Membership Inference for Codecited by 0
- 2026Pretraining Data Exposure in Large Language Models: A Survey of Membership Inference, Data Contamination, and Security Implications21 May 2026
- 2026Bridging Generation and Training: A Systematic Review of Quality Issues in LLMs for Code6 May 2026
- 2026AST-PAC: AST-guided Membership Inference for Code30 Jan 2026
- 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMs15 Jan 2026
- 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
- 2025NES: An Instruction-Free, Low-Latency Next Edit Suggestion Framework Powered by Learned Historical Editing Trajectories4 Aug 2025
- 2025Are AI Coders Snitches? An Empirical Study of Pretraining Data Detection on Code Large Language Models23 Jul 2025
- 2025code_transformed: The Influence of Large Language Models on Code13 Jun 2025