Mamba: Linear-Time Sequence Modeling with Selective State Spaces
1. Research problem
Transformers scale quadratically with sequence length, while earlier state-space models were fast but could not selectively retain or ignore information.
2. Motivation
The authors wanted a linear-time sequence model whose state dynamics depend on the input, giving it content-based selection like attention.
3. Previous approaches
S4 used structured state-space matrices with input-independent dynamics; RNNs offered input dependence but at the cost of sequential computation.
4. Core contribution
Introduced selective state-space models with input-dependent discretization and parameters, plus a hardware-aware parallel scan that makes them efficient in practice.
5. Mathematical formulation
A continuous state equation x'(t) = A x(t) + B u(t), y(t) = C x(t) is discretized with input-dependent step size delta; a selective scan computes the recurrence in parallel on hardware.
6. Methodology
Make A, B, C functions of the input, derive an efficient associative scan, and stack Mamba blocks in a simple architecture without attention or MLP blocks in some variants.
7. Architecture
Gated Mamba blocks combining selective SSM mixing with feedforward transformations, used as a drop-in sequence mixer.
8. Experimental setup
Language modeling perplexity, long-context synthetic tasks, and DNA sequence modeling.
9. Datasets
The Pile-style language corpora, Long Range Arena-like tasks, genomic sequences.
10. Results
Matched or exceeded transformers of similar size on language modeling while scaling linearly with sequence length and running much faster at inference.
11. Limitations
Hardware-aware implementation is complex; empirical evidence at the scale of the largest transformers was initially limited; recall-heavy tasks can still favor attention.
12. Critical analysis
A serious alternative to attention whose key idea is making state-space dynamics input-dependent, reviving recurrent modeling with modern systems support.
13. Implementation tasks
- 1.Implement a selective scan on a synthetic sequence task and compare with a linear recurrence.
- 2.Benchmark runtime and memory against self-attention as sequence length grows.
- 3.Ablate input-dependent parameters to see what selection buys.
14. Follow-up work
- 1.Efficiently Modeling Long Sequences with Structured State Spaces (Gu et al., 2021)
- 2.Jamba and hybrid attention-SSM architectures
15. Open research questions
- 1.Can pure SSMs match attention on retrieval-heavy language tasks?
- 2.Which tasks benefit from hybrid attention and state-space layers?