Mamba-2

The paper introduces structured state space duality, connecting SSMs and attention through structured semiseparable matrices, and uses that view to design the faster Mamba-2 architecture.

Metadata

FieldValue
PaperTransformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality
AuthorsTri Dao, Albert Gu
Year2024
VenueICML 2024
arXiv2405.21060
Codestate-spaces/mamba
Statusfull note started

Question

Mamba showed that a selective state-space model can be a serious alternative to attention for sequence modeling:

Transformers use a very different surface form:

Mamba-2 asks a deeper architecture question:

The paper’s answer is structured state space duality:

Main Claim

The durable claim is not merely that Mamba-2 is faster. The more important claim is:

This framework leads to a new core layer:

The paper reports that Mamba-2 refines Mamba’s selective SSM core layer and is 2-8x faster while remaining competitive with Transformers on language modeling.

For this wiki, the key architecture lesson is:

Architecture Contract

ItemContract
Inputcausal token sequence
Outputcontextual token representations or language-model logits
Main objectsequence mixing operator
Theoretical bridgestructured state space duality
Matrix classstructured semiseparable matrices
New architectureMamba-2 / SSD layer
Practical targetfaster SSM-style sequence modeling while staying competitive with Transformer language models

Mamba-2 belongs near Mamba, S4, RetNet, Mega, Hyena, and Attention Is All You Need.

Matrix Mixer View

A causal sequence layer can often be read as:

where is a lower-triangular mixing matrix. Different architectures define differently.

FamilyMixer View
attentioncontent-dependent token-token matrix
linear attentionkernelized low-rank or recurrent form
SSMrecurrence-induced structured lower-triangular matrix
retentiondecayed key-value matrix with recurrent form
Mamba-2SSD matrix mixer with efficient dual algorithms

For an SSM, the recurrence expands into:

This means the sequence layer has implicit entries:

That is the bridge: recurrence defines a structured causal matrix.

Structured Semiseparable Matrices

The paper connects SSMs and attention-like mechanisms through structured semiseparable matrices.

The useful reading is:

This matters because efficient algorithms can exploit the structure. The same sequence transformation may have:

ViewStrength
recurrent viewstreaming and linear-time inference
matrix viewparallel training and relationship to attention
block/chunk viewhardware-aware efficient computation

This is the same kind of lesson as FlashAttention: a model family is partly mathematical and partly algorithmic.

Mamba-2 vs Mamba

Mamba-1 introduced selective SSMs:

Mamba-2 refines the core layer using SSD. The paper’s practical claim is that this refinement improves algorithmic efficiency while preserving the sequence modeling role of Mamba.

AxisMambaMamba-2
core storyselective SSMstructured state space duality
comparison targetattention alternativescommon framework for SSMs and attention variants
implementation goalhardware-aware selective scanfaster SSD/Mamba-2 layer
architecture lessoninput-dependent state update matterssequence mixers can have dual recurrent and matrix forms

This makes Mamba-2 more than a parameter tweak. It changes how to reason about the family.

Relation to Attention

Attention computes:

Mamba-2 does not say standard softmax attention and every SSM are identical. The useful claim is narrower:

That lets the paper transfer intuition and algorithms between:

  • linear attention;
  • gated or decayed attention-like mechanisms;
  • selective SSMs;
  • block/chunk recurrent computation.

For reading architecture papers, this is valuable because it prevents a false binary:

Often the real distinction is:

Algorithmic Lesson

Mamba-2 is an architecture paper, but its core contribution is inseparable from algorithms.

The same abstract operator can be computed through different paths:

Computation PathWhen It Matters
recurrencestreaming inference
parallel scantraining throughput
chunk/block algorithmlong sequences and accelerator memory hierarchy
matrix formtheory, comparison to attention, and algorithm design

This is why Mamba-2 belongs next to FlashAttention in an architecture wiki: both show that the usable architecture is shaped by hardware-aware algorithms.

Evidence to Read Carefully

EvidenceWhat It SupportsWhat To Check
SSD theorySSMs and attention variants share structured matrix viewsthe assumptions on matrix structure
Mamba-2 layer benchmarksfaster core layer than Mamba under reported settingshardware, sequence length, batch, implementation maturity
language modeling resultsMamba-2 remains competitive with Transformer baselinestraining data, token budget, model size, optimizer recipe
algorithmic speedupsSSD computation can improve practical throughputwhether end-to-end training/inference includes all overhead

The paper’s broad title should be read carefully. It is not a license to collapse all Transformers and all SSMs into one identical object.

Practical Interpretation

Use Mamba-2 as the reference when a paper claims:

  • attention and SSMs are dual or closely related;
  • a new SSM layer is faster due to a better scan/block algorithm;
  • an architecture can be described as a structured matrix mixer;
  • sequence model quality should be judged together with hardware efficiency;
  • Mamba variants improve through state size, chunking, or algorithmic redesign.

The compact mental model is:

Limitations

  • The SSD connection is structurally specific; it does not make every attention mechanism equivalent to every SSM.
  • Faster core kernels do not automatically imply better end-to-end system latency for every setting.
  • Language modeling competitiveness depends on scale, data, optimizer, and implementation maturity.
  • Compressed recurrent-state models may still differ from attention in fine-grained retrieval behavior.
  • Follow-up papers may change the preferred Mamba block design, state size, hybridization, or benchmark interpretation.

Why It Belongs in Architecture Papers

This paper contributes both:

and:

It should be treated as a canonical paper for modern sequence architecture, especially when comparing Transformers, state-space models, retention, and long-convolution methods.