Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to Pretraining Data

Antonis Antoniades, Xinyi Wang, Yanai Elazar, Alfonso Amayuelas, Alon Albalak, Kexun Zhang, William Yang Wang

Introduction

The rapid advancement of Large Language Models (LLMs) has sparked a fundamental debate: are these models truly reasoning, or are they merely "stochastic parrots" expertly retrieving memorized patterns from their vast training corpora? While previous research focused on verbatim recall—the exact reproduction of training strings—this metric fails to capture how models handle high-level tasks like translation or mathematical reasoning, where exact matches are rare.

To address this, researchers have introduced the concept of distributional memorization. This framework allows for a more nuanced tracing of model capabilities back to pretraining data by analyzing the frequency of semantically related input-output pairs, or "task-grams," within the training set.

Methodology: The Task-Gram Framework

The core of this research lies in quantifying the relationship between a model's output probability and the prevalence of task-specific information in its training data.

Overview of the distributional memorization framework

The process involves three primary steps:

  1. Task-gram Identification: Instead of searching for long exact strings, the researchers identify pairs of related phrases (e.g., an English question and its Spanish answer).
  2. Search via WIMBD: Using the "What’s In My Big Data?" (WIMBD) tool, they count how often these pairs co-occur within the same document across massive datasets like The Pile.
  3. Statistical Analysis: They calculate the Spearman correlation between the LLM's prediction probability and the frequency of these task-grams in the training data. A high correlation indicates distributional memorization, while a low correlation coupled with high performance suggests distributional generalization.

Key Insights: Knowledge vs. Reasoning

The study evaluated the Pythia and OLMo model families across benchmarks including TriviaQA (factual knowledge), WMT (translation), MMLU (world knowledge), and GSM8K (math). The results reveal that a model's "strategy" for success depends heavily on the nature of the task.

Conceptual trends of memorization and generalization across task types

Factual Knowledge and Memorization

For knowledge-intensive tasks like TriviaQA, performance is tightly coupled with training data frequency. As models scale, they improve primarily by memorizing a larger volume of facts more effectively. This is evidenced by a strong "memorization score" that increases with parameter count.

Translation and Reasoning as Generalization

In contrast, reasoning-intensive tasks and machine translation show a distinct trend toward generalization. In translation (WMT), there is almost no significant correlation between performance and training data frequency. Furthermore, larger models generate a significantly higher number of "novel" n-grams—pairs that never appeared in the training corpus—proving that the model has learned a transferable skill rather than a lookup table.

Scaling and Strategy Shifts

A critical finding is that scaling doesn't just make models "smarter" in a uniform way. For MMLU, which contains both knowledge and reasoning components, the researchers found a split: history and other knowledge-heavy subjects rely on memorization, while physics and logic tasks show a clear shift toward generalization as model size increases.

Conclusion

By moving beyond verbatim recall to distributional memorization, this research provides a clearer picture of LLM "intelligence." While factual accuracy remains rooted in the model's ability to memorize its training data, the emergence of reasoning and translation capabilities represents a genuine leap into generalization. Future work will likely focus on the specific neural circuits that enable these models to construct novel reasoning paths from their training foundations.

Summary updated

BibTeX
@inproceedings{antoniades2025generalization,
  author = {Antonis Antoniades and Xinyi Wang and Yanai Elazar and Alfonso Amayuelas and Alon Albalak and Kexun Zhang and William Yang Wang},
  title = {{Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to Pretraining Data}},
  booktitle = {International Conference on Learning Representations},
  year = {2025},
  url = {https://openreview.net/forum?id=IQxBDLmVpT},
}
Figure