paper-with-me

홈 › Papers

Memorization Capacity of Multi-Head Attention in Transformers

2023-06-03 · Sadegh Mahdavi, Renjie Liao, Christos Thrampoulidis

Transformers have become the go-to architecture for language and vision tasks, yet their theoretical properties, especially memorization capacity, remain elusive. This paper investigates the memorization abilities of multi-head attention mechanisms, examining how many example sequences they can memorize, as a function of the number of heads and sequence length. Motivated by experimental findings on vision transformers, we introduce novel assumptions about the linear independence of input data, distinct from the commonly used general-position assumption. Under these assumptions, we demonstrate that an attention layer with $H$ heads, dimension $d$, and context size $n < d$, featuring $\Theta(Hd^2)$ parameters, can memorize $\Omega(Hn)$ examples. Our analysis sheds light on how different attention heads handle various example sequences, aided by the softmax operator's saturation property. We validate our findings through experiments on synthetic data.

📄 PDF Abstract BibTeX arXiv:2306.02010

Code (1)

smahdavi4/attention-memorization 공식 구현 pytorch

Tasks

Image ClassificationMemorizationPosition

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Label Smoothing Label Smoothing is a regularization technique that introduces noise for the labels. This accounts for the fact that datasets may have mistakes in them, so maximizing the…
Adam 설명 없음
Absolute Position Encodings Absolute Position Encodings are a type of position embeddings for [Transformer-based models] where positional encodings are…
Residual Connection 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Dropout Dropout is a regularization technique for neural networks that drops a unit (along with connections) at training time with a specified probability $p$ (a common value is…
Position-Wise Feed-Forward Layer 설명 없음

Similar Papers 제목 키워드 기반

Memorization in Attention-only Transformers

2024-11-15 · Léo Dana, Muni Sreenivas Pydi, Yann Chevaleyre

Recent research has explored the memorization capacity of multi-head attention, but these findings are constrained by unrealistic limitations on the context size. We present a novel proof for language-based Transformers …

Memorization

Are Transformers with One Layer Self-Attention Using Low-Rank Weight Matrices Universal Approximators?

2023-07-26 · Tokio Kajitsuka, Issei Sato

Existing analyses of the expressive capacity of Transformer models have required excessively deep layers for data memorization, leading to a discrepancy with the Transformers actually used in practice. This is primarily …

Memorization

Optimal Memorization Capacity of Transformers

2024-09-26 · Tokio Kajitsuka, Issei Sato

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…

Memorization

Next-token prediction capacity: general upper bounds and a lower bound for transformers

2024-05-22 · Liam Madden, Curtis Fox, Christos Thrampoulidis

Given a sequence of tokens, such as words, the task of next-token prediction is to predict the next-token conditional probability distribution. Decoder-only transformers have become effective models for this task, but th…

DecoderMemorization

Weight Decay Regimes in Grokking Transformers: Cheap Online Diagnostics

2026-05-19 · Lucky Verma arxiv

Transformers trained on modular arithmetic exhibit sharp transitions between memorization, generalization, and collapse. We show that weight decay acts as a scalar empirical control parameter for these regimes, and intro…