atlas

Research map / Architectures and efficiency / Attention and transformers

On the Optimal Memorization Capacity of Transformers

ICLR 2025 · Architectures and efficiency › Attention and transformers · approach: Transformer expressivity and learnability · 0 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Shows Transformers memorize N sequences of length n with Õ(√N) parameters in next-token prediction (optimal up to log factors), and Õ(√(nN)) in seq-to-seq, with a matching lower bound only for hardmax Transformers.

Problem

How parameter-efficient Transformers are at memorizing N labeled input sequences of length n, i.e., their memorization capacity in terms of parameters, in next-token and sequence-to-sequence settings.

Approach

Builds a memorization construction in which a single uniform-averaging self-attention layer, combined with feed-forward networks that map an averaged sequence-id-like sum to labels, achieves Õ(√N) parameters independent of n; lower bounds are derived via VC/polynomial-partition arguments on parameters, and extended to hardmax seq-to-seq Transformers.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use parameter sharing with one uniform-attention layerTransformer for next-token prediction · Next-token predictionparameters required for memorization: d \times n -> \tilde{O}(\sqrt{N})Helped
Use a single self-attention layer as an averaging operationTransformer for next-token prediction · Next-token predictionparameters required for memorization: \tilde{O}(\sqrt{N})Helped
Memorize token-level labels rather than one label per sequenceTransformer · Sequence-to-sequence predictionparameters required for memorization: \tilde{O}(\sqrt{N}) -> \tilde{O}(\sqrt{nN})Hurt
Use hardmax attention for the sequence-to-sequence lower-bound analysisTransformer · Sequence-to-sequence predictionparameters required for memorization (lower bound): \Omega\left(\sqrt{\frac{nN}{\log (nN)}}\right)Hurt

Surprising findings

Limitations

Experimental setup

Datasets: two real-world datasets randomly generated dataset

Metrics: number of parameters bit complexity

Baselines: Kim et al. 2023 Transformer memorization Kajitsuka and Sato 2024 Vardi et al. 2021

Builds on: Vardi et al. memorization of ReLU networks Kim et al. Transformer memorization Bartlett VC dimension of ReLU networks Yun et al. Transformers are universal approximators

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy