For Better or for Worse, Transformers Seek Patterns for Memorization

Madhur Panwar, Gail Weiss, Navin Goyal, Antoine Bosselut
1/1/2025
transformer-attention

No confident code implementation found for this paper.

Abstract

Memorization in language models is a critical yet poorly understood phenomenon. In this work, we investigate memorization in transformer-based language models by analyzing their memorization dynamics during training over multiple epochs.

Show full abstract

We find that memorization is neither a constant accumulation of sequences nor simply dictated by the recency of exposure to these sequences. Instead, much like generalization, memorization appears to be driven by pattern recognition. Tracking memorization dynamics in mixed datasets, we observe that models memorize different sub-datasets in distinct bursts, suggesting that each subset is associated with unique underlying patterns, and that the model prefers to learn these patterns in a consistent order. We also find that easily learnable patterns tend to support generalization on unseen data, while more complex patterns do not. Furthermore, in datasets with weak or absent patterns, larger models may delay memorization relative to smaller ones, a behavior we term overthinking . Our results show that the subset of sequences memorized by a model over time is not arbitrary, and give insights into the internal processes a model goes through during training. Our code is available at: https://github.com/mdrpanwar/memorization-patterns .

DOISemantic Scholar

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{panwar2025better,
  title  = {For Better or for Worse, Transformers Seek Patterns for Memorization},
  author = {Madhur Panwar and Gail Weiss and Navin Goyal and Antoine Bosselut},
  year   = {2025},
  doi    = {10.52202/085713-3473},
  url    = {https://doi.org/10.52202/085713-3473},
  journal = {Neural Information Processing Systems}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/acec68d98305737a85b4f00676422cc15dea1a51.svg)](https://codeofpaper.com/paper/acec68d98305737a85b4f00676422cc15dea1a51)

Discussion