mlsanityData to 7 Oct 2026

Does Your Neural Code Completion Model Use My Code? A Membership Inference Approach

arXiv 2404.14296 ↗First posted 22 Apr 2024cs.SE cs.AIcited by 9

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

  1. 2021Membership Inference Attacks on Machine Learning: A Survey14 Mar

Other references · 34

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2014Empirical Evaluation of Gated Recurrent Neural Networks on Sequence Modelingcited by 2,341
  4. 2016Membership Inference Attacks against Machine Learning Modelscited by 2,221
  5. 2020Extracting Training Data from Large Language Modelscited by 2,144
  6. 2023Code Llama: Open Foundation Models for Codecited by 2,105
  7. 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 876
  8. 2015Gated Graph Sequence Neural Networkscited by 792
  9. 2023StarCoder: may the source be with you!cited by 790
  10. 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 732
  11. 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
  12. 2018ML-Leaks: Model and Data Independent Membership Inference Attacks and Defenses on Machine Learning Modelscited by 475
22 more
  1. 2022A Systematic Evaluation of Large Language Models of Codecited by 360
  2. 2022The Stack: 3 TB of permissively licensed source codecited by 354
  3. 2023CodeT5+: Open Code Large Language Models for Code Understanding and Generationcited by 327
  4. 2020Systematic Evaluation of Privacy Risks of Machine Learning Modelscited by 273
  5. 2020IntelliCode Compose: Code Generation Using Transformercited by 225
  6. 2022ReACC: A Retrieval-Augmented Code Completion Frameworkcited by 117
  7. 2020Code Prediction by Feeding Trees to Transformerscited by 70
  8. 2021A survey of deep neural network watermarking techniquescited by 69
  9. 2020Multi-task Learning based Pre-trained Language Model for Code Completioncited by 58
  10. 2019Pythia: AI-assisted Code Completion Systemcited by 54
  11. 2017Code Completion with Neural Attention and Pointer Networkscited by 49
  12. 2020FakeTagger: Robust Safeguards against DeepFake Dissemination via Provenance Trackingcited by 46
  13. 2022Compilable Neural Code Generation with Compiler Feedbackcited by 46
  14. 2021CoProtector: Protect Open-Source Code against Unauthorized Training Usage with Data Poisoningcited by 39
  15. 2018Digital Watermarking for Deep Neural Networkscited by 37
  16. 2021Code Completion by Modeling Flattened Abstract Syntax Trees as Graphscited by 30
  17. 2023CodeMark: Imperceptible Watermarking for Code Datasets against Neural Code Completion Modelscited by 28
  18. 2023Deep Learning for Code Intelligence: Survey, Benchmark and Toolkitcited by 22
  19. 2019A Self-Attentional Neural Architecture for Code Completion with Multi-Task Learningcited by 18
  20. 2024IRCoCo: Immediate Rewards-Guided Deep Reinforcement Learning for Code Completioncited by 13
  21. 2023Gotcha! This Model Uses My Code! Evaluating Membership Leakage Risks in Code Modelscited by 11
  22. 2020Sequence Model Design for Code Completion in the Modern IDEcited by 8

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2025: 5; 2026: 4.

9 papers.