Lune

ICLR2025Top-tier venue

On the Optimal Memorization Capacity of Transformers

Tokio Kajitsuka, Issei Sato

Abstract

Recent research in the field of machine learning has increasingly focused on the memorization capacity of Transformers, but how efficient they are is not yet well understood. We demonstrate that Transformers can memorize labels with Õ( √ N ) parameters in a next-token prediction setting for N input sequences of length n, which is proved to be optimal up to logarithmic factors. This indicates that Transformers can efficiently perform memorization with little influence from the input length n owing to the benefit of parameter sharing. We also analyze the memorization capacity in the sequence-to-sequence setting, and find that Õ( √ nN ) parameters are not only sufficient, but also necessary at least for Transformers with hardmax. These results suggest that while self-attention mechanisms can efficiently identify input sequences, the feed-forward network becomes a bottleneck when associating a label to each token.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

5 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Approximation Error Upper and Lower Bounds for Hölder Class with Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Approximation Error Upper and Lower Bounds for Hölder Class with Transformers cites Approximation Bounds for Transformer Networks with Application to Regression
  • Scalable Diffusion Models with Transformers cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • Approximation Bounds for Transformer Networks with Application to Regression cites Scalable Diffusion Models with Transformers
  • Approximation Bounds for Transformer Networks with Application to Regression cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
  • MetaFormer is Actually What You Need for Vision cites An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers5

  1. Unveiling the Basin-Like Loss Landscape in Large Language ModelsHuanran Chen, Zeming Wei, Yao Huang, Yichi Zhang et al.ICLR 2026 · 14 citations
  2. Approximation Bounds for Transformer Networks with Application to RegressionYuling Jiao, Yanming Lai, Defeng Sun, Yang Wang et al.ICML 2026 · 6 citations
  3. Analyzing the Power of Chain of Thought through Memorization CapabilitiesLijia Yu, Xiao-Shan Gao, Lijun ZhangNeurIPS 2025 · 2 citations
  4. A Capacity-Based Rationale for Multi-Head AttentionMicah AdlerICML 2026 · 2 citations
  5. Approximation Error Upper and Lower Bounds for Hölder Class with TransformersXin He, Yuling Jiao, Xiliang Lu, Jerry YangICML 2026

Builds on18

  1. An Image is Worth 16x16 Words: Transformers for Image Recognition at ScaleAlexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn et al.ICLR 2021 · 21,477 citations
  2. Scalable Diffusion Models with TransformersWilliam Peebles, Saining XieICCV 2023 · 5,568 citations
  3. Big Bird: Transformers for Longer SequencesManzil Zaheer, Guru Guruganesh, Kumar Avinava Dubey, Joshua Ainslie et al.NeurIPS 2020 · 3,159 citations
  4. MetaFormer is Actually What You Need for VisionWeihao Yu, Mi Luo, Pan Zhou, Chenyang Si et al.CVPR 2022 · 1,114 citations
  5. Deep Double Descent: Where Bigger Models and More Data HurtPreetum Nakkiran, Gal Kaplun, Yamini Bansal, Tristan Yang et al.ICLR 2020 · 1,108 citations

Related papers

  1. Provable Memorization Capacity of TransformersJunghwan Kim, Michelle Kim, Barzan MozafariICLR 2023
  2. Memorization Capacity of Multi-Head Attention in TransformersSadegh Mahdavi, Renjie Liao, Christos ThrampoulidisICLR 2024 · 34 citations
  3. Understanding the Expressive Power and Mechanisms of Transformer for Sequence ModelingMingze Wang, Weinan ENeurIPS 2024 · 32 citations
  4. Are Transformers with One Layer Self-Attention Using Low-Rank Weight Matrices Universal Approximators?Tokio Kajitsuka, Issei SatoICLR 2024 · 31 citations
  5. The Effect of Attention Head Count on Transformer ApproximationPenghao Yu, Haotian Jiang, Zeyu Bao, Ruoxi Yu et al.ICLR 2026 · 5 citations
Dusk over the sea between two cliffs drawn in fine vertical lines