How much do language models memorize?

John X. Morris, Chawin Sitawarin, Chuan Guo, Narine Kokhlikyan, G. Edward Suh, Alexander M. Rush, Kamalika Chaudhuri, Saeed Mahloujifar · OpenReview

TL;DR

This paper introduces a novel method to quantify how much language models "memorize" specific training data, separating it from generalization. They estimate that modern GPT-style models have a capacity of about 3.6 bits per parameter, and observe that models memorize until this capacity is filled, after which they start to generalize.

What Problem Does This Paper Address?

Modern language models are trained on massive datasets, raising questions about how much of this data they actually "memorize" versus how much they learn general patterns. Previous research has struggled to disentangle these two aspects: a model might generate a specific piece of text, but it's unclear if this is due to memorizing it or due to good generalization capabilities. This paper aims to provide a precise, quantifiable way to measure this memorization, independent of the training algorithm, and to understand the capacity of models in terms of how much data they can store.

Methods

The authors propose a new definition of memorization based on information theory and compression. They formally separate "unintended memorization" (information about a specific dataset) from "generalization" (information about the underlying data-generation process). By eliminating generalization (e.g., by training on random bitstrings), they can measure unintended memorization and thus estimate a model's capacity. This is done by leveraging Kolmogorov complexity and approximating it using model likelihoods and compression algorithms like arithmetic coding. They train hundreds of transformer models of varying sizes and measure their memorization across different dataset sizes.

Datasets

The paper uses two main types of datasets:

  • Synthetic bitstrings: Uniformly sampled random bitstrings are used to eliminate generalization and precisely measure memorization and model capacity.
  • Real text: The FineWeb dataset, a large, deduplicated web text corpus, is used to study memorization and generalization in a more realistic setting.

Key Insights and Ideas

  • Quantifying Memorization: The core contribution is a principled way to measure "unintended memorization" as the amount of information a model stores about specific data points, distinct from general knowledge.
  • Model Capacity: This memorization measure allows for an estimation of a model's "capacity" – the total amount of information it can store.
  • Grokking and Capacity: The paper observes that models memorize data until they reach their capacity. Beyond this point, "grokking" begins, and memorization decreases as models shift towards generalization.
  • Scaling Laws: They establish scaling laws that relate model capacity, dataset size, and membership inference performance.
  • Membership Inference: The work provides insights into why membership inference attacks become difficult on large models trained on massive datasets, suggesting they are often unable to distinguish training data from unseen data.

Key Results

  • GPT-style models have ~3.6 bits/parameter capacity: Measurements suggest that GPT-family models can store approximately 3.6 bits of information per parameter.
  • Capacity is parameter-dependent: Model capacity scales smoothly with the number of parameters.
  • Double Descent Explained: The phenomenon of double descent (where performance initially worsens with more data before improving) is linked to models reaching their capacity and then being forced to generalize.
  • Membership Inference Difficulty: For models trained on very large datasets (relative to their capacity), membership inference becomes statistically indistinguishable from random guessing.

Limitations and Future Work

  • Environment Specificity: The results are specific to the proposed environment and may not generalize to all datasets, architectures, or training setups.
  • Approximation of Kolmogorov Complexity: The use of compression algorithms to approximate Kolmogorov complexity is an approximation, and the choice of compression scheme can influence results.
  • Future Work: The authors suggest exploring more sophisticated compression algorithms tailored for language models and investigating the impact of different model architectures and training strategies on memorization and capacity. They also highlight the need for further research into the theoretical underpinnings of memorization and generalization.

Summary updated

BibTeX
@inproceedings{morris2026how,
  author = {John X. Morris and Chawin Sitawarin and Chuan Guo and Narine Kokhlikyan and G. Edward Suh and Alexander M. Rush and Kamalika Chaudhuri and Saeed Mahloujifar},
  title = {{How much do language models memorize?}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=bA6BgSbaUi},
}
Figure