atlas

Research map / Architectures and efficiency / Attention and transformers

Memorization Capacity of Multi-Head Attention in Transformers

ICLR 2024 · Architectures and efficiency › Attention and transformers · approach: Attention head mechanisms · 1 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.

Proves that a single multi-head attention layer with H heads and context size n<d can memorize Omega(Hmin(n,d_h)) examples under linear-independence assumptions (Kruskal rank of queries, full-rank contexts), and validates the assumptions on ViT and with synthetic experiments.

Problem

How many examples a multi-head attention layer can memorize as a function of number of heads and context length, given that the commonly used General Position assumption fails for transformer inputs.

Approach

Replace General Position with two relaxed linear-independence assumptions (query Kruskal rank at least n; each context matrix full rank n), and show each head can be made responsible for min(n,d_h)-1 examples by exploiting softmax saturation, so ranks add up linearly across heads.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
increase the number of attention heads Hsingle-layer MHA · synthetic classificationmemorization accuracyHelped
increase context size nsingle-layer MHA · synthetic classificationmemorization accuracyHelped
increase head dimension d_h while d_h ≤ nsingle-layer MHA · synthetic classificationmemorization accuracyHelped
increase head dimension d_h beyond nsingle-layer MHA · synthetic classificationmemorization fractionNo clear effect
apply one randomly initialized Self-Attention layerViT embedding-layer representations · ImageNetquery-vector Kruskal-rank assumption validityHelped
use the embedding layer without an Attention layerViT embedding-layer representations · ImageNetquery-vector Kruskal-rank assumption validityHurt
increase the number of attention heads Hsingle-layer MHA · under the paper's linear-independence assumptionsmemorization capacityHelped
increase context size nsingle-layer MHA · under the paper's linear-independence assumptionsmemorization capacityHelped
increase head dimension d_h beyond nsingle-layer MHA · under the paper's linear-independence assumptionsmemorization capacityNo clear effect

Surprising findings

Limitations

Experimental setup

Datasets: ImageNet synthetic uniform random data

Benchmarks: synthetic memorization tasks (classification with 100 classes, regression) ImageNet assumption tests on ViT variants

Metrics: average accuracy MSE rank test pass rate R^2 of linear fit

Baselines: two-layer ReLU network (upper bound comparison)

Builds on: Vision Transformer Kruskal rank General Position memorization results for FCNs

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