Emergent and Predictable Memorization in Large Language Models

Stella Biderman, Usvsn Sai Prashanth, Lintang Sutawika, Hailey Schoelkopf, Quentin Anthony, Shivanshu Purohit, Edward Raff

Introduction

Large Language Models (LLMs) possess a remarkable capacity to store and recall information from their training data. However, this capability often manifests as verbatim memorization, where a model outputs training sequences word-for-word. This phenomenon poses significant privacy and security risks, as models may inadvertently leak sensitive information such as social security numbers, private correspondence, or proprietary code.

For researchers and developers, the ideal solution is to identify high-risk sequences before committing to the massive computational expense of a full-scale training run. While "scaling laws" have proven effective at predicting a model's final loss or accuracy based on its size, it remains unclear if similar laws govern the memorization of specific data points. This paper investigates whether we can forecast which strings a 12B-parameter model will memorize by observing smaller "pilot" models or early training checkpoints.

Methodology

To study these dynamics, the researchers utilized the Pythia model suite, a collection of 16 models ranging from 70M to 12B parameters. Crucially, all models in the suite were trained on the exact same data—The Pile, an 800GB diverse English dataset—in the exact same order. This controlled environment allowed for precise tracking of memorization across both model scale and training time.

The study employed a metric known as $k$-extractability to quantify memorization:

  1. A 64-token sequence is selected from the training set.
  2. The model is provided with the first 32 tokens as a prompt.
  3. If the model's greedy generation exactly matches the remaining 32 tokens, the sequence is classified as "memorized."

The researchers evaluated two primary predictive strategies:

  • Cross-model extrapolation: Using a small model (e.g., 70M parameters) to predict the memorization behavior of a larger target model (e.g., 12B parameters).
  • Cross-time extrapolation: Using an early checkpoint of a model to predict its own state at the end of training.

Key Findings

High Precision, Dismal Recall

The study found that while small models are highly precise—if a 70M model memorizes a string, the 12B model almost certainly will too (Precision > 90%)—they suffer from poor recall. The 70M model only identified approximately 20% of the strings eventually memorized by the 12B model. This suggests that larger models do not simply memorize "more" of the same types of data; they memorize entirely different sets of sequences that smaller models ignore.

The Emergence of Memorization

Unlike general language proficiency, which typically improves linearly on log-log scales, memorization is often emergent. Many strings remain "invisible" to smaller models but suddenly become fixed in the weights once a model reaches a specific size threshold. Furthermore, the 12B Pythia model exhibited anomalous behavior, memorizing significantly more data than a linear extrapolation from smaller models would have predicted.

The "Equi-compute" Tradeoff

When operating under a fixed computational budget for pilot testing, researchers must choose between training a large model for a few steps or a small model for many steps. The findings indicate that to maximize recall—identifying as many potentially sensitive strings as possible—the most effective strategy is to use the smallest model possible that can process the entire target dataset.

Training Progress and Prediction

Predicting memorization using early checkpoints of the target model itself also proved difficult. The researchers found that a model must reach at least 40-50% of its total training compute before it becomes possible to reliably predict (with >80% recall) what it will have memorized by the end of the run.

Discussion and Limitations

While deduplicating training data reduces the total volume of memorized content, it does not change the underlying patterns of how memorization scales. However, this study is limited to the Pythia suite's architecture and The Pile's data distribution. It remains to be seen if these non-linear scaling behaviors hold for Mixture-of-Experts (MoE) architectures or specialized datasets like source code.

Furthermore, the focus on 32-token verbatim matches does not account for "fuzzy" memorization, where a model might paraphrase sensitive information. Future research is needed to determine if specific linguistic features or data properties make certain strings more prone to emergent memorization, which would allow for even more targeted pre-training interventions.

Summary updated

BibTeX
@inproceedings{biderman2023emergent,
  author = {Stella Biderman and USVSN Sai Prashanth and Lintang Sutawika and Hailey Schoelkopf and Quentin Anthony and Shivanshu Purohit and Edward Raff},
  title = {{Emergent and Predictable Memorization in Large Language Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=Iq0DvhB4Kf},
}
Figure