atlas

Research map / Architectures and efficiency / Attention and transformers

Repeat After Me: Transformers are Better than State Space Models at Copying

ICML 2024 · Architectures and efficiency › Attention and transformers · approach: Transformer expressivity and learnability · 3 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 theoretically and empirically that transformers copy and retrieve from context far better than fixed-state generalized state space models (GSSMs such as Mamba and LSTM), using a depth-2 hash-based copy construction, synthetic training, and pretrained Pythia vs Mamba comparisons.

Problem

Whether fixed-size-state sequence models (GSSMs like SSMs, RNNs, linear attention) can match transformers at tasks requiring copying and retrieving arbitrary parts of the input context.

Approach

Proves a depth-2 transformer can copy exponentially long strings via hash-based n-gram lookup (with Hard-ALiBi positional encoding), while any GSSM with state size below L log D fails to copy uniform strings of length L; then validates the gap empirically in trained-from-scratch and pretrained models.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use a transformer instead of a GSSM for copyingModels trained on the copy task · Copy strings of length 300training samples required: 100x less samplesHelped
Use a transformer instead of a GSSMModels trained on the copy task · Length generalization from strings ≤ 50 to strings up to 1000string-level accuracyHelped
Use Hard-ALiBi positional encoding (ablation)Transformer trained on the copy task · Length generalization from strings ≤ 50 to strings up to 1000string-level accuracyHelped
Use ALiBi or NoPE instead of RoPE (ablation)Transformer trained on the copy task · Longer copy sequencesstring-level accuracyHelped
Introduce duplicate n-grams of 5 or more tokensHard-ALiBi transformer · Copy task with duplicated n-gramsstring-level accuracyHurt
Use suffix keys rather than prefix keys (ablation)GSSMs on n-gram lookup · Length generalization on n-gram lookupperformanceHurt
Use prefix keys rather than suffix keys (ablation)GSSMs on n-gram lookup · Length generalization on n-gram lookupperformanceHelped
Use GSSMs rather than NoPE or ALiBi transformersN-gram lookup with prefix keys · Length generalization on n-gram lookupperformanceHelped
Use a transformer instead of a GSSMPretrained models · Copy natural-language strings from C4string-level accuracyHelped
Shuffle the word order of the input strings (ablation)Pretrained Pythia and Mamba models · Copy strings from C4string-level accuracyHurt
Use a transformer instead of a GSSMPretrained models · Copy shuffled strings of length 300string-level accuracy: zero accuracyHelped
Use a transformer instead of a GSSMPretrained models · Phone-book lookupaccuracyHelped

Surprising findings

Limitations

Experimental setup

Datasets: C4 SQuAD The Pile (pretraining of Pythia and Mamba) synthetic copy and n-gram lookup data

Benchmarks: SQuAD synthetic copy task n-gram lookup task phone-book lookup C4 copy

Metrics: string-level accuracy character-level accuracy F1

Baselines: Mamba LSTM Pythia RoPE transformer NoPE transformer ALiBi transformer

Builds on: Mamba ALiBi Pythia induction heads FlashAttention

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