atlas

Research map / Architectures and efficiency / Attention and transformers

Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality

ICML 2024 · Architectures and efficiency › Attention and transformers · approach: Sparse efficient transformers for long context

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 that selective SSMs (with scalar-identity A) and masked linear attention are duals via semiseparable matrices, and uses this to design the SSD block-decomposition algorithm and the Mamba-2 architecture, which is 2-8x faster than Mamba's scan.

Problem

Structured state space models (SSMs) like Mamba and attention variants have been developed separately, making SSMs harder to train efficiently and to analyze with the tools developed for Transformers; a unified theory and efficient algorithm are needed.

Approach

Connects SSMs to semiseparable matrices, so that SSM computation is a structured matrix multiplication; generalizes linear attention to structured masked attention (SMA) and shows that 1-semiseparable SMA with scalar-identity SSMs are duals (state space duality). A block decomposition (chunked) algorithm combines the linear recurrence across chunks with quadratic attention-style matmuls within chu

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Use the SSD block-decomposition algorithm instead of the optimized selective scanSSM computation · SSM computationspeed: 2-8$\times$ fasterHelped
Use SSD instead of softmax attentionSSM computation · Sequence length 16Kspeed: 6$\times$ fasterHelped
Use SSD instead of softmax attentionSSM computation · Sequence length 2Kspeed: crossing over at sequence length 2KMixed
Increase recurrent state sizeSSD · SSM computationspeed: $8\times$ the size of Mamba or even higher, with minimal slowdownNo clear effect
Use the modified parallel Mamba block with SSD as the inner SSM layerMamba-2 · Chinchilla scaling lawsperplexity and wall-clock timeHelped
Train Mamba-2 2.7B on the Pile for 300B tokensMamba-2 2.7B · The Pile, 300B tokensdownstream evaluationsHelped

Surprising findings

Limitations

Experimental setup

Datasets: The Pile

Benchmarks: The Pile perplexity LAMBADA HellaSwag PIQA ARC-Easy ARC-Challenge WinoGrande OpenBookQA multi-query associative recall

Metrics: perplexity accuracy training wall-clock time kernel runtime

Baselines: Mamba Transformer++ Pythia FlashAttention-2 GPT-3

Builds on: Mamba linear attention S4 FlashAttention-2 RetNet

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