TL;DR
This paper presents the first comprehensive, cross-family comparative analysis of LLM memorization, evaluating 20 models across 6 open-source families. The authors reveal that while certain statistical properties—like the log-linear scaling of memorization with model size—are universal, the internal mechanisms driving memorization form a distinct "structural fingerprint" unique to each model family's training recipe.
What Problem Does This Paper Address?
Large Language Models (LLMs) have a well-documented tendency to memorize and regurgitate exact segments of their pre-training data, raising significant concerns around privacy, copyright, and security. However, because proprietary models keep their training data strictly confidential, most mechanistic studies of memorization have been restricted to a single "sandbox" model series.
This reliance on isolated observations makes it impossible to tell which findings are universal properties of the Transformer architecture and which are merely artifacts of a specific training setup. This paper addresses this gap by conducting a massive comparative study across multiple open-source model families where the pre-training data is fully known.
Methods
The authors evaluate memorization using a combination of behavioral statistics and internal mechanistic probing:
- Memorization Score: A standard metric where a model is prompted with 32 tokens from its training corpus; if greedy decoding exactly reproduces the next 32 tokens, the sequence is considered fully memorized.
- Compression Ratio: The minimum fraction of the original context tokens required to still trigger the exact memorized output.
- Noise Injection: Injecting relative Gaussian noise into the first layer's residual stream to test the robustness of memorized vs. unmemorized computational pathways.
- Logit-Lens: Probing intermediate layers to track how token decoding probabilities evolve from the first layer to the last.
- Attention Head Ablation: Systematically neutralizing individual attention heads to calculate a "Head Importance Score" and isolate the specific circuits responsible for recalling data.
Datasets
The study evaluates 20 models ranging from 1B to 32B parameters across 6 open-source families with transparent training corpora:
- Pythia (trained on The Pile)
- OLMo 1 (trained on Dolma)
- OLMo 2 (trained on OLMo-Mix and Domino)
- OLMo 3 (trained on Dolma3)
- OpenLLaMA (trained on RedPajama)
- StarCoder (trained on The Stack)
For each model family, the authors sampled 300,000 sequences per domain to ensure a broad coverage of text types (e.g., code, natural language, legal documents).
Key Insights and Ideas
- Scaling Shifts What is Memorized: Small models predominantly memorize highly structured text like code and mathematical expressions. However, as models scale up, they memorize significantly more "free text" (natural language). This suggests that advanced language understanding actually helps models form semantic hooks that facilitate verbatim memorization.
- Memorization Pathways are Fragile: Internal noise injection experiments reveal that memorized sequences are surprisingly more sensitive to perturbations than unmemorized ones. While LLMs possess general error-correction (denoising) capabilities in their later layers, once a memorized pathway is disrupted, the denoising mechanism fails to recover the exact sequence.
- Inherited Training "DNA": Attention head ablation reveals that the layer-wise distribution of important heads forms a distinct structural fingerprint. This distribution is remarkably consistent within a model family across different parameter sizes (e.g., OLMo 1B vs. 7B) but diverges sharply between families, reflecting the permanent signature left by a family's unique training recipe.
Key Results
- Log-Linear Scaling & Compressibility: Within any given family, the memorization rate scales log-linearly with model size. Furthermore, memorized sequences are highly compressed; in families like Pythia and StarCoder, providing less than 50% of the original context tokens is enough to trigger full recall.
- The 100x Divergence: Stronger model capacity does not automatically mean more memorization. The authors observed up to a 100x divergence in memorization rates across different families (e.g., StarCoder at ~10% vs. OLMo 1 at <1%), heavily dictated by the nature of their pre-training corpora.
- Universal Memorization Heads: Despite cross-family differences, a tiny, domain-irrelevant subset of attention heads (e.g., ~1.4% of heads in OLMo3-32B) remains universally critical for memorization across all text domains.
Limitations and Future Work
The most prominent limitation is that this methodology cannot be applied to the most popular state-of-the-art models (such as LLaMA 3, Qwen, or DeepSeek) because their exact pre-training data mixtures are proprietary. Additionally, due to the astronomical storage and compute costs of processing multi-trillion-token corpora, the authors had to rely on sampled subsets of data.
The authors suggest that future work should leverage these family-specific internal fingerprints to design more effective, targeted data-deduplication and machine-unlearning algorithms.
Summary updated