mlsanityData to 7 Oct 2026

Unveiling Memorization in Code Models

arXiv 2308.09932 ↗First posted 19 Aug 2023cs.SEcited by 29

Not on the map. Why?

Abstract (arXiv)

The availability of large-scale datasets, advanced architectures, and powerful computational resources have led to effective code models that automate diverse software engineering activities. The datasets usually consist of billions of lines of code from both open-source and private repositories. A code model memorizes and produces source code verbatim, which potentially contains vulnerabilities, sensitive information, or code with strict licenses, leading to potential security and privacy issues. This paper investigates an important problem: to what extent do code models memorize their training data? We conduct an empirical study to explore memorization in large pre-trained code models. Our study highlights that simply extracting 20,000 outputs (each having 512 tokens) from a code model can produce over 40,125 code snippets that are memorized from the training data. To provide a better understanding, we build a taxonomy of memorized contents with 3 categories and 14 subcategories. The results show that the prompts sent to the code models affect the distribution of memorized contents. We identify several key factors of memorization. Specifically, given the same architecture, larger models suffer more from memorization problems. A code model produces more memorization when it is allowed to generate longer outputs. We also find a strong positive correlation between the number of an output's occurrences in the training data and that in the generated outputs, which indicates that a potential way to reduce memorization is to remove duplicates in the training data. We then identify effective metrics that infer whether an output contains memorization accurately. We also make suggestions to deal with memorization.

Key facts. Cited by 29 papers in the map (data through 7 Oct 2026). First posted on arXiv 19 Aug 2023.

Builds on

No reference list yet.

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 6; 2025: 17; 2026: 6.

29 papers.

Sort:

By area:

  1. 2025LessLeak-Bench: A First Investigation of Data Leakage in LLMs Across 83 Software Engineering Benchmarkscited by 34
  2. 2024Recite, Reconstruct, Recollect: Memorization in LMs as a Multifaceted Phenomenoncited by 30
  3. 2025A Survey on Model Extraction Attacks and Defenses for Large Language Modelscited by 18
  4. 2025Beyond Final Code: A Process-Oriented Error Analysis of Software Development Agents in Real-World GitHub Scenarioscited by 14
  5. 2024LiCoEval: Evaluating LLMs on License Compliance in Code Generationcited by 13
  6. 2024The Fault in our Stars: Quality Assessment of Code Generation Benchmarkscited by 9
  7. 2024An Empirical Study on Capability of Large Language Models in Understanding Code Semanticscited by 7
  8. 2025Memorize or Generalize? Evaluating LLM Code Generation with Code Rewritingcited by 6
  9. 2026Human oversight of agentic systems in practice: Examining the oversight work, challenges, and heuristics of developers using software agentscited by 6
  10. 2025Memorization in Large Language Models in Medicine: Prevalence, Characteristics, and Implicationscited by 5
  11. 2024Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorizationcited by 4
  12. 2025"My productivity is boosted, but ..." Demystifying Users' Perception on AI Coding Assistantscited by 4
17 more
  1. 2025The Fools are Certain; the Wise are Doubtful: Exploring LLM Confidence in Code Completioncited by 3
  2. 2025Trust Me, I Know This Function: Hijacking LLM Static Analysis using Biascited by 3
  3. 2025Scrub It Out! Erasing Sensitive Memorization in Code Language Models via Machine Unlearningcited by 3
  4. 2024Developer Perspectives on Licensing and Copyright Issues Arising from Generative AI for Software Developmentcited by 2
  5. 2026AscendOptimizer: Episodic Agent for Ascend NPU Operator Optimizationcited by 2
  6. 2025Layer-Wise Perturbations via Sparse Autoencoders for Adversarial Text Generationcited by 1
  7. 2025Breaking Memorization Barriers in LLM Code Fine-Tuning via Information Bottleneck for Improved Generalizationcited by 1
  8. 2026Model See, Model Do? Exposure-Aware Evaluation of Bug-vs-Fix Preference in Code LLMscited by 1
  9. 2026RustMizan: A Compilable, Contamination-Aware Benchmarking Framework for Rust Vulnerabilitiescited by 1
  10. 2025Malicious and Unintentional Disclosure Risks in Large Language Models for Code Generationcited by 0
  11. 2025Contamination Means Overestimation? A Fine-Grained Empirical Study in Code Intelligencecited by 0
  12. 2025Benchmarking Web API Integration Code Generationcited by 0
  13. 2025CodeGenLink: A Tool to Find the Likely Origin and License of Automatically Generated Codecited by 0
  14. 2025Effective Code Membership Inference for Code Completion Models via Adversarial Promptscited by 0
  15. 2025How Do Semantically Equivalent Code Transformations Impact Membership Inference on LLMs for Code?cited by 0
  16. 2026Predicting Program Exit Code with LLMs and Programming Language Semanticscited by 0
  17. 2026PatchBench: Evaluating AI Agents for Vulnerability Patchingcited by 0