Traces of Memorisation in Large Language Models for Code
On the map: LLM safety and security → Membership inference attacks
Abstract (arXiv)
Large language models have gained significant popularity because of their ability to generate human-like text and potential applications in various fields, such as Software Engineering. Large language models for code are commonly trained on large unsanitised corpora of source code scraped from the internet. The content of these datasets is memorised and can be extracted by attackers with data extraction attacks. In this work, we explore memorisation in large language models for code and compare the rate of memorisation with large language models trained on natural language. We adopt an existing benchmark for natural language and construct a benchmark for code by identifying samples that are vulnerable to attack. We run both benchmarks against a variety of models, and perform a data extraction attack. We find that large language models for code are vulnerable to data extraction attacks, like their natural language counterparts. From the training data that was identified to be potentially extractable we were able to extract 47% from a CodeGen-Mono-16B code completion model. We also observe that models memorise more, as their parameter count grows, and that their pre-training data are also vulnerable to attack. We also find that data carriers are memorised at a higher rate than regular code or documentation and that different model architectures memorise different samples. Data leakage has severe outcomes, so we urge the research community to further investigate the extent of this phenomenon using a wider range of models and extraction techniques in order to build safeguards to mitigate this issue.
Key facts. Cited by 29 papers in the map (data through 14 Oct 2026). Placed in Membership inference attacks, one of 12 directions in LLM safety and security. Builds on 37 of its 54 references that are in the map. First posted on arXiv 18 Dec 2023.
Builds on
37 of 54 references.
Closest ancestors · 7
Same direction, newest first
- 2023Overconfidence is a Dangerous Thing: Mitigating Membership Inference Attacks by Enforcing Less Confident Prediction4 Jul
- 2023Towards More Realistic Membership Inference Attacks on Large Diffusion Models22 Jun
- 2023Targeted Attack on GPT-Neo for the SATML Language Model Data Extraction Challenge13 Feb
- 2023Analyzing Leakage of Personally Identifiable Information in Language Models1 Feb
- 2022Quantifying Privacy Risks of Masked Language Models Using Membership Inference Attacks8 Mar
- 2021Membership Inference Attacks From First Principles7 Dec
- 2021Membership Inference Attacks on Machine Learning: A Survey14 Mar
Other references · 30
- 2022Training language models to follow instructions with human feedbackcited by 15,971
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,234
- 2020Extracting Training Data from Large Language Modelscited by 2,189
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,786
- 2020CodeBERT: A Pre-Trained Model for Programming and Natural Languagescited by 1,310
- 2021CodeT5: Identifier-aware Unified Pre-trained Encoder-Decoder Models for Code Understanding and Generationcited by 906
- 2022CodeGen: An Open Large Language Model for Code with Multi-Turn Program Synthesiscited by 885
- 2021CodeXGLUE: A Machine Learning Benchmark Dataset for Code Understanding and Generationcited by 744
- 2023Extracting Training Data from Diffusion Modelscited by 732
- 2021Deduplicating Training Data Makes Language Models Bettercited by 714
- 2022InCoder: A Generative Model for Code Infilling and Synthesiscited by 498
18 more
- 2019Does Learning Require Memorization? A Short Tale about a Long Tailcited by 460
- 2020Label-Only Membership Inference Attackscited by 388
- 2022A Systematic Evaluation of Large Language Models of Codecited by 363
- 2022Deduplicating Training Data Mitigates Privacy Risks in Language Modelscited by 314
- 2022Memorization Without Overfitting: Analyzing the Training Dynamics of Large Language Modelscited by 220
- 2022Are Large Pre-Trained Language Models Leaking Your Personal Information?cited by 200
- 2022What Does it Mean for a Language Model to Preserve Privacy?cited by 195
- 2023Emergent and Predictable Memorization in Large Language Modelscited by 148
- 2022The Privacy Onion Effect: Memorization is Relativecited by 136
- 2019Reconstruction and Membership Inference Attacks against Generative Modelscited by 122
- 2022CERT: Continual Pre-Training on Sketches for Library-Oriented Code Generationcited by 87
- 2019Membership Inference Attacks on Sequence-to-Sequence Models: Is My Data In Your Machine Translation System?cited by 71
- 2022CodeFill: Multi-token Code Completion by Jointly Learning from Structure and Naming Sequencescited by 50
- 2023Training Data Extraction From Pre-trained Language Models: A Surveycited by 45
- 2022Codex Hacks HackerRank: Memorization Issues and a Framework for Code Synthesis Evaluationcited by 14
- 2023The (ab)use of Open Source Code to Train Large Language Modelscited by 10
- 2023SecretBench: A Dataset of Software Secretscited by 5
- 2023Whose Text Is It Anyway? Exploring BigCode, Intellectual Property, and Ethicscited by 3
Built on by
Citing papers per year: 2024: 6; 2025: 14; 2026: 9.
29 papers.
Sort:
By area:
- 2024A Survey on Large Language Models for Code Generationcited by 658
- 2024LiCoEval: Evaluating LLMs on License Compliance in Code Generationcited by 14
- 2024API-guided Dataset Synthesis to Finetune Large Code Modelscited by 11
- 2024An Exploratory Investigation into Code License Infringements in Large Language Model Training Datasetscited by 9
- 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewritingcited by 7
- 2025Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine Unlearningcited by 7
- 2025Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMscited by 6
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agentscited by 6
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Qualitycited by 4
- 2024CodeCipher: Learning to Obfuscate Source Code Against LLMscited by 3
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuningcited by 3
- 2024Can Large Language Models put 2 and 2 together? Probing for Entailed Arithmetical Relationshipscited by 1
17 more
- 2025Low-Perplexity LLM-Generated Sequences and Where To Find Themcited by 1
- 2025Breaking Memorization Barriers in LLM Code Fine-Tuning via Information Bottleneck for Improved Generalizationcited by 1
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Promptscited by 1
- 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMscited by 1
- 2026The Next Challenge for Agentic Cybersecurity: A Realistic, Contamination-Free Reverse Engineering Benchmarkcited by 1
- 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generationcited by 0
- 2025Contamination Means Overestimation? A Fine-Grained Empirical Study in Code Intelligencecited by 0
- 2025Are AI Coders Snitches? An Empirical Study of Pretraining Data Detection on Code Large Language Modelscited by 0
- 2025DevLicOps: A Framework for Mitigating Licensing Risks in AI-Generated Codecited by 0
- 2025Towards Privacy-Preserving Code Generation: Differentially Private Code Language Modelscited by 0
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Casescited by 0
- 2026Exploring Approaches for Detecting Memorization of Recommender System Data in Large Language Modelscited by 0
- 2026SERSEM: Selective Entropy-Weighted Scoring for Membership Inference in Code Language Modelscited by 0
- 2026A Metamorphic Testing Approach to Diagnosing Memorization in LLM-Based Program Repaircited by 0
- 2026Feedback-Normalized Developer Memory for Reinforcement-Learning Coding Agents: A Safety-Gated MCP Architecturecited by 0
- 2026Characterizing the Quality Profile of AI-Generated C++ in Productioncited by 0
- 2026Keep Evaluation Fair: Detecting Data Leakage in Code Generation Benchmarks via Membership Inference Attackscited by 0
- 2026Keep Evaluation Fair: Detecting Data Leakage in Code Generation Benchmarks via Membership Inference Attacks9 Sep 2026
- 2026The Next Challenge for Agentic Cybersecurity: A Realistic, Contamination-Free Reverse Engineering Benchmark11 Aug 2026
- 2026Characterizing the Quality Profile of AI-Generated C++ in Production6 Aug 2026
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agents3 Jun 2026
- 2026Feedback-Normalized Developer Memory for Reinforcement-Learning Coding Agents: A Safety-Gated MCP Architecture2 May 2026
- 2026A Metamorphic Testing Approach to Diagnosing Memorization in LLM-Based Program Repair23 Apr 2026
- 2026SERSEM: Selective Entropy-Weighted Scoring for Membership Inference in Code Language Models1 Apr 2026
- 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMs15 Jan 2026
- 2026Exploring Approaches for Detecting Memorization of Recommender System Data in Large Language Models5 Jan 2026
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Cases20 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
17 more
- 2025Breaking Memorization Barriers in LLM Code Fine-Tuning via Information Bottleneck for Improved Generalization15 Oct 2025
- 2025Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine Unlearning17 Sep 2025
- 2025DevLicOps: A Framework for Mitigating Licensing Risks in AI-Generated Code23 Aug 2025
- 2025Are AI Coders Snitches? An Empirical Study of Pretraining Data Detection on Code Large Language Models23 Jul 2025
- 2025Low-Perplexity LLM-Generated Sequences and Where To Find Them2 Jul 2025
- 2025Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMs20 Jun 2025
- 2025Contamination Means Overestimation? A Fine-Grained Empirical Study in Code Intelligence3 Jun 2025
- 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generation27 Mar 2025
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Quality7 Mar 2025
- 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewriting4 Mar 2025
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuning29 Jan 2025
- 2024CodeCipher: Learning to Obfuscate Source Code Against LLMs8 Oct 2024
- 2024API-guided Dataset Synthesis to Finetune Large Code Models15 Aug 2024
- 2024LiCoEval: Evaluating LLMs on License Compliance in Code Generation5 Aug 2024
- 2024A Survey on Large Language Models for Code Generation1 Jun 2024
- 2024Can Large Language Models put 2 and 2 together? Probing for Entailed Arithmetical Relationships30 Apr 2024
- 2024An Exploratory Investigation into Code License Infringements in Large Language Model Training Datasets22 Mar 2024
- 2025Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine Unlearningcited by 7
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuningcited by 3
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Promptscited by 1
- 2026Exploring Approaches for Detecting Memorization of Recommender System Data in Large Language Modelscited by 0
- 2026SERSEM: Selective Entropy-Weighted Scoring for Membership Inference in Code Language Modelscited by 0
- 2026Keep Evaluation Fair: Detecting Data Leakage in Code Generation Benchmarks via Membership Inference Attackscited by 0
- 2026Keep Evaluation Fair: Detecting Data Leakage in Code Generation Benchmarks via Membership Inference Attacks9 Sep 2026
- 2026SERSEM: Selective Entropy-Weighted Scoring for Membership Inference in Code Language Models1 Apr 2026
- 2026Exploring Approaches for Detecting Memorization of Recommender System Data in Large Language Models5 Jan 2026
- 2025Effective Code Membership Inference for Code Completion Models via Adversarial Prompts19 Nov 2025
- 2025Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine Unlearning17 Sep 2025
- 2025How Much Do Code Language Models Remember? An Investigation on Data Extraction Attacks before and after Fine-tuning29 Jan 2025
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agentscited by 6
- 2026The Next Challenge for Agentic Cybersecurity: A Realistic, Contamination-Free Reverse Engineering Benchmarkcited by 1
- 2026Feedback-Normalized Developer Memory for Reinforcement-Learning Coding Agents: A Safety-Gated MCP Architecturecited by 0
- 2026The Next Challenge for Agentic Cybersecurity: A Realistic, Contamination-Free Reverse Engineering Benchmark11 Aug 2026
- 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agents3 Jun 2026
- 2026Feedback-Normalized Developer Memory for Reinforcement-Learning Coding Agents: A Safety-Gated MCP Architecture2 May 2026
- 2024A Survey on Large Language Models for Code Generationcited by 658
- 2024LiCoEval: Evaluating LLMs on License Compliance in Code Generationcited by 14
- 2024API-guided Dataset Synthesis to Finetune Large Code Modelscited by 11
- 2024An Exploratory Investigation into Code License Infringements in Large Language Model Training Datasetscited by 9
- 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewritingcited by 7
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Qualitycited by 4
- 2024CodeCipher: Learning to Obfuscate Source Code Against LLMscited by 3
- 2024Can Large Language Models put 2 and 2 together? Probing for Entailed Arithmetical Relationshipscited by 1
- 2025Low-Perplexity LLM-Generated Sequences and Where To Find Themcited by 1
- 2025Breaking Memorization Barriers in LLM Code Fine-Tuning via Information Bottleneck for Improved Generalizationcited by 1
- 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMscited by 1
- 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generationcited by 0
12 most cited of 19 All 19 (JSON)
- 2026Characterizing the Quality Profile of AI-Generated C++ in Production6 Aug 2026
- 2026A Metamorphic Testing Approach to Diagnosing Memorization in LLM-Based Program Repair23 Apr 2026
- 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMs15 Jan 2026
- 2025SoK: Understanding (New) Security Issues Across AI4Code Use Cases20 Dec 2025
- 2025Towards Privacy-Preserving Code Generation: Differentially Private Code Language Models12 Dec 2025
- 2025Breaking Memorization Barriers in LLM Code Fine-Tuning via Information Bottleneck for Improved Generalization15 Oct 2025
- 2025DevLicOps: A Framework for Mitigating Licensing Risks in AI-Generated Code23 Aug 2025
- 2025Are AI Coders Snitches? An Empirical Study of Pretraining Data Detection on Code Large Language Models23 Jul 2025
- 2025Low-Perplexity LLM-Generated Sequences and Where To Find Them2 Jul 2025
- 2025Contamination Means Overestimation? A Fine-Grained Empirical Study in Code Intelligence3 Jun 2025
- 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generation27 Mar 2025
- 2025Benchmarking AI Models in Software Engineering: A Review, Search Tool, and Unified Approach for Elevating Benchmark Quality7 Mar 2025
12 newest of 19 All 19 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2024Undesirable Memorization in Large Language Models: A Survey
- 2026Detecting Functional Memorization in Code Language Models
- 2025A Survey on Model Extraction Attacks and Defenses for Large Language Models
- 2023On Extracting Specialized Code Abilities from Large Language Models: A Feasibility Study
- 2024Measuring Impacts of Poisoning on Model Parameters and Embeddings for Large Language Models of Code
- 2026A Lifecycle and Application-Stack Survey of Large Language Model Vulnerabilities: Attacks, Risks, Defenses, and Open Problems
- 2023Latent Jailbreak: A Benchmark for Evaluating Text Safety and Output Robustness of Large Language Models
- 2024Breaking Down the Defenses: A Comparative Survey of Attacks on Large Language Models