Extracting Training Data from Large Language Models
Written for the Research library (claude-opus-5-5) from the paper text, in our own words: the license "arXiv — non-exclusive licence to distribute" does not allow redistributing the text itself. Original — arxiv.org/pdf/2012.07805
Summary
Large language models are often assumed not to leak their training data, because they are trained on huge deduplicated corpora for few epochs and barely overfit. The authors challenge this assumption. They show that an attacker who can only query a model as a black box can still recover exact training sequences. The attack works in two steps. First, it draws a large, varied set of high-likelihood generations from the model using three sampling strategies. Second, it ranks those generations with six metrics that compare the target model's likelihood against a separate reference model, so text the target finds unusually probable rises to the top. The authors attacked GPT-2 because the model and its data source were already public. They recovered hundreds of verbatim training strings, confirmed together with OpenAI. These included one real person's contact details, IRC logs, source code and UUIDs, and some strings came from a single training document. Larger models memorized more. This makes data extraction a practical privacy risk for any LM trained on sensitive text.
Key points
- Target: GPT-2 XL (1.5B parameters), with the Small (124M) and Medium (334M) variants used for comparison. It was trained on about 40GB of text from web pages linked from Reddit, and its training loss is only about 10% lower than its test loss.
- 3 sampling strategies × 6 ranking metrics give 18 configurations. With 100 candidates per configuration, that makes 1,800 samples, and over 600 of them (604) turned out to be verbatim training data.
- The strongest configuration reached 67% precision. Among 600,000 generated samples, at least 0.1% contained memorized text, which the authors see as a loose lower bound.
- Memorization does not require overfitting. A few individual training examples get abnormally low loss even when the train–test gap is small on average.
- Suggested mitigations are differentially private training (costly in time and utility), careful deduplication, and auditing models for memorization. None of these fully solves the problem.
Cited by
- PaLM 2 Technical Report
- Program Synthesis with Large Language Models
- On the Opportunities and Risks of Foundation Models
- Evaluating Large Language Models Trained on Code
- GLaM: Efficient Scaling of Language Models with Mixture-of-Experts
- Red Teaming Language Models to Reduce Harms: Methods, Scaling Behaviors, and Lessons Learned
- Time Travel in LLMs: Tracing Data Contamination in Large Language Models
- Towards a Unified View of Parameter-Efficient Transfer Learning
- Large Language Models Cannot Self-Correct Reasoning Yet
- A Survey on Hallucination in Large Language Models: Principles, Taxonomy, Challenges, and Open Questions
- TrustLLM: Trustworthiness in Large Language Models
- Knowledge Unlearning for Mitigating Privacy Risks in Language Models
- Survey of Hallucination in Natural Language Generation
- A Survey on Large Language Models for Code Generation
- Challenges and Applications of Large Language Models
- Deduplicating Training Data Mitigates Privacy Risks in Language Models
- Large Language Models Struggle to Learn Long-Tail Knowledge
- Paraphrasing evades detectors of AI-generated text, but retrieval is an effective defense
- MADLAD-400: A Multilingual And Document-Level Large Audited Dataset
- Competition-Level Code Generation with AlphaCode
- CAMEL: Communicative Agents for "Mind" Exploration of Large Language Model Society
- Multi-step Jailbreaking Privacy Attacks on ChatGPT
- From Crowdsourced Data to High-Quality Benchmarks: Arena-Hard and BenchBuilder Pipeline
- DataComp-LM: In search of the next generation of training sets for language models
- Trustworthy LLMs: a Survey and Guideline for Evaluating Large Language Models' Alignment
- TOFU: A Task of Fictitious Unlearning for LLMs
- Tree of Attacks: Jailbreaking Black-Box LLMs Automatically
- Scalable Extraction of Training Data from (Production) Language Models
- GPT-4 Technical Report
- Discovering Language Model Behaviors with Model-Written Evaluations
- Ignore Previous Prompt: Attack Techniques For Language Models
- Red Teaming Language Models with Language Models
- Tool Learning with Foundation Models
- NLP Evaluation in trouble: On the Need to Measure LLM Data Contamination for each Benchmark
- "Do Anything Now": Characterizing and Evaluating In-The-Wild Jailbreak Prompts on Large Language Models
- Societal Biases in Language Generation: Progress and Challenges
- Beyond the Imitation Game: Quantifying and extrapolating the capabilities of language models
- LaMDA: Language Models for Dialog Applications
- Memorization Without Overfitting: Analyzing the Training Dynamics of Large Language Models
- DecodingTrust: A Comprehensive Assessment of Trustworthiness in GPT Models
- Emergent Abilities of Large Language Models
- Jailbroken: How Does LLM Safety Training Fail?
- Ethical and social risks of harm from Language Models
- BloombergGPT: A Large Language Model for Finance
- Adaptive Chameleon or Stubborn Sloth: Revealing the Behavior of Large Language Models in Knowledge Conflicts
- Magpie: Alignment Data Synthesis from Scratch by Prompting Aligned LLMs with Nothing
- Rethinking Benchmark and Contamination for Language Models with Rephrased Samples
- Large Language Model Unlearning
- A Survey on Large Language Model (LLM) Security and Privacy: The Good, the Bad, and the Ugly
- Negative Preference Optimization: From Catastrophic Collapse to Effective Unlearning
- LMSYS-Chat-1M: A Large-Scale Real-World LLM Conversation Dataset
- Can Large Language Models Transform Computational Social Science?
- Representation Engineering: A Top-Down Approach to AI Transparency
Cite
@misc{carlini2020extracting,
title = {{Extracting Training Data from Large Language Models}},
author = {Carlini, Nicholas and Tramer, Florian and Wallace, Eric and Jagielski, Matthew and Herbert-Voss, Ariel and Lee, Katherine and Roberts, Adam and Brown, Tom and Song, Dawn and Erlingsson, Ulfar and Oprea, Alina and Raffel, Colin},
year = {2020},
doi = {10.48550/arxiv.2012.07805},
eprint = {2012.07805},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.2012.07805}
}References
- Martín Abadi, Andy Chu, Ian Goodfellow, H Brendan McMahan, Ilya Mironov, Kunal Talwar, and Li Zhang. Deep learning with differential privacy. In ACM CCS, 2016. find
- Daniel Adiwardana, Minh-Thang Luong, David R So, Jamie Hall, Noah Fiedel, Romal Thoppilan, Zi Yang, Apoorv Kulshreshtha, Gaurav Nemade, Yifeng Lu, et al. Towards a human-like open-domain chatbot. arXiv preprint arXiv:2001.09977, 2020. find our card
- Jay Alammar. The illustrated transformer. Visualizing Machine Learning One Concept at a Time, 2018. find
- Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. Neural machine translation by jointly learning to align and translate. In ICLR, 2015. find our card
- Yoshua Bengio, Réjean Ducharme, Pascal Vincent, and Christian Jauvin. A neural probabilistic language model. JMLR, 2003. find
- Gavin Brown, Mark Bun, Vitaly Feldman, Adam Smith, and Kunal Talwar. When is memorization of irrelevant training data necessary for high-accuracy learning? arXiv preprint arXiv:2012.06421, 2020. — [arXiv:2012.06421](https://arxiv.org/abs/2012.06421) find
- Tom B Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020. find
- Nicholas Carlini, Chang Liu, Úlfar Erlingsson, Jernej Kos, and Dawn Song. The secret sharer: Evaluating and testing unintended memorization in neural networks. In USENIX Security Symposium, 2019. find our card
- Kamalika Chaudhuri and Claire Monteleoni. Privacy-preserving logistic regression. In NIPS, 2009. find
- Mia Xu Chen, Benjamin N Lee, Gagan Bansal, Yuan Cao, Shuyuan Zhang, Justin Lu, Jackie Tsay, Yinan Wang, Andrew M Dai, Zhifeng Chen, Timothy Sohn, and Yonghui Wu. Gmail smart compose: Real-Time assisted writing. In KDD, 2019. find
- Andrea Continella, Yanick Fratantonio, Martina Lindorfer, Alessandro Puccetti, Ali Zand, Christopher Kruegel, and Giovanni Vigna. Obfuscation-Resilient Privacy Leak Detection for Mobile Apps Through Differential Analysis. In NDSS, 2017. find
- Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In NAACL, 2019. find
- C Dwork, F McSherry, K Nissim, and A Smith. Calibrating noise to sensitivity in private data analysis. In TCC, 2006. find
- Cynthia Dwork. Differential privacy: A survey of results. In TAMC, 2008. find
- Úlfar Erlingsson, Vasyl Pihur, and Aleksandra Korolova. RAPPOR: Randomized aggregatable privacy-preserving ordinal response. In ACM CCS, 2014. find
- Andre Esteva, Brett Kuprel, Roberto A Novoa, Justin Ko, Susan M Swetter, Helen M Blau, and Sebastian Thrun. Dermatologist-level classification of skin cancer with deep neural networks. Nature, 2017. find
- Facebook. Opacus. https://github.com/pytorch/opacus. ↗
- Angela Fan, Mike Lewis, and Yann Dauphin. Hierarchical neural story generation. In ACL, 2018. find
- Vitaly Feldman. Does learning require memorization? A short tale about a long tail. In STOC, 2020. find
- Vitaly Feldman and Chiyuan Zhang. What neural networks memorize and why: Discovering the long tail via influence estimation. In NeurIPS, 2020. find
- Matt Fredrikson, Somesh Jha, and Thomas Ristenpart. Model inversion attacks that exploit confidence information and basic countermeasures. In ACM CCS, 2015. find
- Philip Gage. A new algorithm for data compression. C Users Journal, 12(2):23–38, 1994. find
- Aaron Gokaslan and Vanya Cohen. OpenWeb-Text corpus. http://Skylion007.github.io/OpenWebTextCorpus, 2019. ↗
- Shafi Goldwasser, Silvio Micali, and Charles Rackoff. The knowledge complexity of interactive proof systems. SICOMP, 1989. find
- Google. Tensorflow Privacy. https://github.com/tensorflow/privacy. ↗
- Alex Graves. Generating sequences with recurrent neural networks. arXiv preprint arXiv:1308.0850, 2013. find
- Peter Henderson, Koustuv Sinha, Nicolas Angelard-Gontier, Nan Rosemary Ke, Genevieve Fried, Ryan Lowe, and Joelle Pineau. Ethical challenges in data-driven dialogue systems. In Proceedings of the 2018 AAAI/ACM Conference on AI, Ethics, and Society, pages 123–129, 2018. find
- Sorami Hisamoto, Matt Post, and Kevin Duh. Membership inference attacks on sequence-to-sequence models: Is my data in your machine translation system? In TACL, 2020. find
- Andrew Hoang, Antoine Bosselut, Asli Celikyilmaz, and Yejin Choi. Efficient adaptation of pretrained transformers for abstractive summarization. arXiv preprint arXiv:1906.00138, 2019. — [arXiv:1906.00138](https://arxiv.org/abs/1906.00138) find
- Ari Holtzman, Jan Buys, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In ICLR, 2020. find
- Jeremy Howard and Sebastian Ruder. Universal language model fine-tuning for text classification. In ACL, 2018. find
- Daphne Ippolito, Daniel Duckworth, Chris Callison-Burch, and Douglas Eck. Automatic detection of generated text is easiest when humans are fooled. In ACL. find our card
- Matthew Jagielski, Jonathan Ullman, and Alina Oprea. Auditing differentially private machine learning: How private is private SGD? In NeurIPS, 2020. find
- Bargav Jayaraman and David Evans. Evaluating differentially private machine learning in practice. In USENIX Security Symposium, 2019. find
- Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei. Scaling laws for neural language models. arXiv preprint arXiv:2001.08361, 2020. find
- Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019. find our card
- Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. In NAACL, 2016. find our card
- Zhuohan Li, Eric Wallace, Sheng Shen, Kevin Lin, Kurt Keutzer, Dan Klein, and Joseph E Gonzalez. Train large, then compress: Rethinking model size for efficient training and inference of transformers. In ICML, 2020. find
- Yinhan Liu, Myle Ott, Naman Goyal, Jingfei Du, Mandar Joshi, Danqi Chen, Omer Levy, Mike Lewis, Luke Zettlemoyer, and Veselin Stoyanov. RoBERTa: A robustly optimized BERT pretraining approach. arXiv preprint arXiv:1907.11692, 2019. find
- Yunhui Long, Vincent Bindschaedler, Lei Wang, Diyue Bu, Xiaofeng Wang, Haixu Tang, Carl A Gunter, and Kai Chen. Understanding membership inferences on well-generalized learning models. arXiv preprint arXiv:1802.04889, 2018. — [arXiv:1802.04889](https://arxiv.org/abs/1802.04889) find
- Jean loup Gailly and Mark Adler. zlib compression library. find
- Michael McCloskey and Neal J Cohen. Catastrophic interference in connectionist networks: The sequential learning problem. In Psychology of learning and motivation. 1989. find
- H Brendan McMahan, Daniel Ramage, Kunal Talwar, and Li Zhang. Learning differentially private recurrent language models. In ICLR, 2018. find
- Tomas Mikolov, Martin Karafiát, Lukas Burget, Jan Cernockỳ, and Sanjeev Khudanpur. Recurrent neural network based language model. In Interspeech, 2010. find
- Randall Munroe. Predictive models. https://xkcd. com/2169/, 2019. find
- Milad Nasr, Reza Shokri, and Amir Houmansadr. Machine learning with membership privacy using adversarial regularization. In ACM SIGSAC, 2018. find
- Milad Nasr, Reza Shokri, and Amir Houmansadr. Comprehensive privacy analysis of deep learning: Passive and active white-box inference attacks against centralized and federated learning. In IEEE S&P, 2019. find
- Helen Nissenbaum. Privacy as contextual integrity. Washington Law Review, 2004. find
- OpenAI. Language models are few-shot learners. https://github.com/openai/gpt-3, 2020. ↗
- Matthew E Peters, Mark Neumann, Mohit Iyyer, Matt Gardner, Christopher Clark, Kenton Lee, and Luke Zettlemoyer. Deep contextualized word representations. In NAACL, 2018. find
- Fabio Petroni, Tim Rocktäschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, and Sebastian Riedel. Language models as knowledge bases? In EMNLP, 2019. find our card
- Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training, 2018. find
- Alec Radford, Jeffrey Wu, Dario Amodei, Daniela Amodei, Jack Clark, Miles Brundage, and Ilya Sutskever. Better language models and their implications. OpenAI Blog, 2019. find
- Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners, 2019. find
- Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. In JMLR, 2020. find
- Swaroop Ramaswamy, Om Thakkar, Rajiv Mathews, Galen Andrew, H Brendan McMahan, and Françoise Beaufays. Training production language models without memorizing user data. arXiv preprint arXiv:2009.10031, 2020. — [arXiv:2009.10031](https://arxiv.org/abs/2009.10031) find
- Roger Ratcliff. Connectionist models of recognition memory: constraints imposed by learning and forgetting functions. Psychological review, 1990. find
- Jingjing Ren, Ashwin Rao, Martina Lindorfer, Arnaud Legout, and David Choffnes. ReCon: Revealing and controlling PII leaks in mobile network traffic. In MobiSys, 2016. find
- Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of a language model? In EMNLP, 2020. find
- Benjamin IP Rubinstein, Peter L Bartlett, Ling Huang, and Nina Taft. Learning in a large function space: Privacy-preserving mechanisms for SVM learning. Privacy and Confidentiality, 2012. find
- Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. In ACL, 2016. find
- Taylor Shin, Yasaman Razeghi, Robert L Logan IV, Eric Wallace, and Sameer Singh. AutoPrompt: Eliciting knowledge from language models with automatically generated prompts. In EMNLP, 2020. find our card
- Mohammad Shoeybi, Mostofa Patwary, Raul Puri, Patrick LeGresley, Jared Casper, and Bryan Catanzaro. Megatron-lm: Training multi-billion parameter language models using model parallelism. arXiv preprint arXiv:1909.08053, 2019. find
- Reza Shokri and Vitaly Shmatikov. Privacy-preserving deep learning. In ACM CCS, 2015. find
- Reza Shokri, Marco Stronati, Congzheng Song, and Vitaly Shmatikov. Membership inference attacks against machine learning models. In IEEE S&P, 2017. find our card
- Congzheng Song and Ananth Raghunathan. Information leakage in embedding models. In ACM CCS, 2020. find
- Congzheng Song and Vitaly Shmatikov. Auditing data provenance in text-generation models. In KDD, 2018. find
- Om Thakkar, Swaroop Ramaswamy, Rajiv Mathews, and Françoise Beaufays. Understanding unintended memorization in federated learning. arXiv preprint arXiv:2006.07490, 2020. — [arXiv:2006.07490](https://arxiv.org/abs/2006.07490) find
- Abhradeep Guha Thakurta, Andrew H. Vyrros, Umesh S. Vaishampayan, Gaurav Kapoor, Julien Freudi-ger, Vivek Rangarajan Sridhar, and Doug Davidson. Learning new words, 2017. US Patent 9,594,741. find
- Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NIPS, 2017. find
- Kit Walsh. USPTO request for comments on intellectual property protection for artificial intelligence innovation – public comment by the electronic frontier foundation. https://www.uspto.gov/sites/default/files/documents/Electronic%20Frontier% 20Foundation\_RFC-84-FR-58141.PDF, 2020. ↗
- Samuel Yeom, Irene Giacomelli, Matt Fredrikson, and Somesh Jha. Privacy risk in machine learning: Analyzing the connection to overfitting. In IEEE CSF, 2018. find
- Santiago Zanella-Béguelin, Lukas Wutschitz, Shruti Tople, Victor Rühle, Andrew Paverd, Olga Ohrimenko, Boris Köpf, and Marc Brockschmidt. Analyzing information leakage of updates to natural language models. In ACM CCS, 2020. find
- Rowan Zellers, Ari Holtzman, Hannah Rashkin, Yonatan Bisk, Ali Farhadi, Franziska Roesner, and Yejin Choi. Defending against neural fake news. In NeurIPS, 2019. find our card
- Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning requires rethinking generalization. ICLR, 2017. find
- Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, and Bill Dolan. DialoGPT: Large-scale generative pre-training for conversational response generation. In ACL Demo Track, 2020. find our card