Zubnet AILearnWiki › Mamba
Models

Mamba

Mamba Architecture
A selective state space model (SSM) architecture designed as an alternative to the Transformer. Created by Albert Gu and Tri Dao, Mamba achieves competitive language modeling performance with linear scaling in sequence length (vs. the Transformer's quadratic attention cost). It processes sequences by maintaining a compressed hidden state that gets selectively updated — important information is preserved, irrelevant information decays.

Why it matters

Mamba represents the most credible challenge to Transformer dominance. If it (or its descendants) deliver on the promise of linear-time sequence processing with Transformer-quality results, the implications are enormous: much longer context windows, faster inference, lower costs. The "selective" part is key — unlike earlier SSMs, Mamba makes its state transitions input-dependent, which is what gives it the expressiveness to match attention.

Deep Dive

Classical state space models maintain a fixed-size hidden state that gets updated at each timestep via learned matrices A (state transition), B (input projection), and C (output projection). Mamba's innovation is making B and C input-dependent — the model learns to selectively focus on or ignore different parts of the input based on content, not just position. This selectivity is what earlier SSMs lacked and what prevented them from matching Transformer performance on language tasks.

The Hardware Story

Mamba's other contribution is a hardware-aware implementation. The selective scan operation is rewritten to minimize memory transfers between GPU HBM and SRAM, using kernel fusion and recomputation to avoid materializing the full state expansion in memory. This engineering makes the theoretical linear complexity translate to actual wall-clock speedups, not just asymptotic improvements that get eaten by constant factors.

Mamba-2 and Hybrids

Mamba-2 simplified the architecture by showing that the selective state space model can be viewed as a structured form of attention, unifying the SSM and Transformer perspectives mathematically. This led to hybrid architectures (like Jamba from AI21, Zamba from Zyphra) that interleave Mamba layers with attention layers, getting the efficiency of SSMs for most of the sequence processing while using attention for the tasks where global token interaction is essential. The debate isn't "SSM vs. Transformer" anymore — it's about finding the optimal mix.

Related Concepts

← All Terms
← Machine Learning Masked Language Modeling →