Mamba

Mamba is a selective state-space architecture for sequence modeling. In this wiki, it is mainly a seed topic for efficient long-context models and protein modeling experiments.

A generic selective state update can be viewed as:

The key distinction is that update parameters depend on the current input .

A more implementation-facing abstraction is:

where is a learned projection and controls the input-dependent discretization or update scale.

State-Space Boundary

Mamba should be read as a member of the state-space model family:

The selective part means can depend on the input token. This differs from a fixed linear time-invariant SSM, where transition matrices are shared across positions.

Scan View

The recurrence can be evaluated as a scan over sequence positions:

Implementations exploit associative scan-style structure rather than treating every step as an independent matrix multiplication. The practical claim is efficient long-sequence mixing with linear or near-linear scaling in sequence length.

Structured State Space Duality

Mamba-2 adds a matrix-mixer view of the family. A selective SSM recurrence can be expanded into a causal mixing matrix:

This matters because the same sequence transformation can sometimes be viewed as recurrence, structured matrix multiplication, or attention-like mixing. For paper reading, this is the bridge between state-space models and attention.

Causal and Bidirectional Use

A left-to-right Mamba block is naturally causal:

For classification, protein representation, or structure-related tasks, papers may add bidirectional scanning, pooling, attention, convolution, or task-specific heads:

This design choice matters because a causal sequence model and a bidirectional representation model have different information access.

Key Ideas

  • Mamba belongs to the state-space model family but makes the state update input-dependent.
  • Selective updates let the model decide what to keep, forget, or emphasize as it scans a sequence.
  • The architecture is often studied as an efficient alternative or complement to Transformers for long contexts.
  • Hybrid backbones such as Jamba use Mamba layers alongside attention and MoE rather than treating Mamba as an all-or-nothing Transformer replacement.
  • It is especially relevant when sequences are long and full attention cost is a practical bottleneck.
  • In protein modeling notes, treat Mamba-style modules as sequence mixers unless the paper adds explicit structure or geometry.

Practical Checks

  • Check whether the model is purely sequence-based or combined with attention, convolution, graphs, or structural features.
  • Track whether outputs are token-level states, pooled representations, or generative logits.
  • Look for how bidirectional context is handled when the task is not causal generation.
  • For protein papers, separate architectural claims from dataset, split, and evaluation choices.
  • Check whether the paper compares against attention under matched parameter count, context length, and training tokens.
  • Check whether long-context benefit is due to architecture, data curriculum, implementation, or evaluation setting.