Traces of Memorisation in Large Language Models for Code
Ali Al-Kaswan, Maliheh Izadi, Arie van Deursen
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 8 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMs 引用了 Membership Inference Attacks Against Machine Learning Models
- Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMs 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMs 引用了 API-Guided Dataset Synthesis to Finetune Large Code Models
- Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMs 引用了 Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
- Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMs 引用了 Extracting Training Data from Large Language Models
- API-Guided Dataset Synthesis to Finetune Large Code Models 引用了 Training language models to follow instructions with human feedback
- Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorization 引用了 Extracting Training Data from Large Language Models
- Effective Code Membership Inference for Code Completion Models via Adversarial Prompts 引用了 Membership Inference Attacks Against Machine Learning Models
- Effective Code Membership Inference for Code Completion Models via Adversarial Prompts 引用了 CodeBERT: A Pre-Trained Model for Programming and Natural Languages
- Effective Code Membership Inference for Code Completion Models via Adversarial Prompts 引用了 Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and Memorization
- Effective Code Membership Inference for Code Completion Models via Adversarial Prompts 引用了 Extracting Training Data from Large Language Models
- Chain-of-Thought Prompting Elicits Reasoning in Large Language Models 引用了 Training language models to follow instructions with human feedback
- Training language models to follow instructions with human feedback 引用了 Extracting Training Data from Large Language Models
- Extracting Training Data from Large Language Models 引用了 Membership Inference Attacks Against Machine Learning Models
引用它的顶会 Paper8
- Licoeval: Evaluating LLMs on License Compliance in Code GenerationWeiwei Xu, Kai Gao, Hao He, Minghui ZhouICSE 2025 · 6 次引用
- API-Guided Dataset Synthesis to Finetune Large Code ModelsZongjie Li, Daoyuan Wu, Shuai Wang, Zhendong SuOOPSLA 2025 · 6 次引用
- Promise and Peril of Collaborative Code Generation Models: Balancing Effectiveness and MemorizationZhi Chen, Lingxiao JiangASE 2024 · 4 次引用
- Differentiation-Based Extraction of Proprietary Data from Fine-Tuned LLMsZongjie Li, Daoyuan Wu, Shuai Wang, Zhendong SuCCS 2025 · 1 次引用
- Effective Code Membership Inference for Code Completion Models via Adversarial PromptsYuan Jiang, Zehao Li, Shan Huang, Christoph Treude 等ASE 2025 · 1 次引用
它引用的 Paper24
- Training language models to follow instructions with human feedbackLong Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida 等NeurIPS 2022 · 24,707 次引用
- Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma 等NeurIPS 2022 · 22,562 次引用
- Membership Inference Attacks Against Machine Learning ModelsReza Shokri, Marco Stronati, Congzheng Song, Vitaly ShmatikovS&P 2017 · 5,137 次引用
- Extracting Training Data from Large Language ModelsNicholas Carlini, Florian Tramèr, Eric Wallace, Matthew Jagielski 等USENIX Security 2021 · 2,866 次引用
- CodeBERT: A Pre-Trained Model for Programming and Natural LanguagesZhangyin Feng, Daya Guo, Duyu Tang, Nan Duan 等EMNLP Findings 2020 · 2,828 次引用
相关 Paper
- Quantifying Contamination in Evaluating Code Generation Capabilities of Language ModelsMartin Riddell, Ansong Ni, Arman CohanACL 2024
- Scalable Extraction of Training Data from Aligned, Production Language ModelsMilad Nasr, Javier Rando, Nicholas Carlini, Jonathan Hayase 等ICLR 2025
- Unveiling Memorization in Code ModelsZhou Yang, Zhipeng Zhao, Chenyu Wang, Jieke Shi 等ICSE 2024 · 33 次引用
- Quantifying and Analyzing Entity-Level Memorization in Large Language ModelsZhenhong Zhou, Jiuyang Xiang, Chaomeng Chen, Sen SuAAAI 2024 · 23 次引用
- Security Attacks on LLM-based Code Completion ToolsWen Cheng, Ke Sun, Xinyu Zhang, Wei WangAAAI 2025 · 21 次引用
