All models

mamba_block_mambapy

An attention-free sequence model built from blocks that wrap an input-dependent (selective) state space layer.

Language · 116 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (5 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Family
mamba
Parameters
32.6K
Operations
116
Framework
PyTorch
Recurrent
No
Published
2023
Cited by
12,046 (as of 22 November 2026)
Authors
Albert Gu, Tri Dao
License
Apache-2.0
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m5701
Graph hash
c727c9f06b09cf741f5bbfe8ee0bdf4f3dd70a5e6689023e410ec5e2e37dd631
Skeleton hash
bf336c05eb9e2943e046d4173963e40bfbeb0424150e1894eab5267711c1232b
Architecture hash
85b00ca4363f4e5f5ceb7f676682c6a4aab87f563ce7d06e3404741440163280
Diagram SHA-256
d10081feb689e8213804daf98cea8b04b30af8e67a96350b7683e85ebc30732c
TorchLens version
2.36.0
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

What it is

This model is a single Mamba block, the module that wraps the selective SSM.

About this model's family

Mamba is a sequence model built around a selective state space model (SSM) in place of attention. The paper starts from earlier subquadratic-time alternatives to the Transformer, which had not matched attention on modalities such as language, and traces the gap to their inability to reason based on content. Its remedy is to make the SSM parameters functions of the input, so the model can selectively propagate or forget information depending on the current token.

Input-dependent parameters rule out the efficient convolutions that earlier SSMs used, so the model is computed recurrently with a hardware-aware scan. The architecture is one block repeated, interleaved with normalization and residual connections. That block combines the H3 block, the basis of most earlier SSM architectures, with the MLP block of modern neural networks. Compared to the MLP block, it adds an SSM to the main branch. The activation inside it is SiLU / Swish.

The paper reports linear scaling in sequence length and 5× higher inference throughput than Transformers. On language modeling, it reports that its Mamba-3B model outperforms Transformers of the same size and matches Transformers twice its size.

Key idea. Mamba makes the parameters of a state space model depend on the input and builds these selective SSMs into a simplified architecture without attention or MLP blocks.

  • mamba
  • selective state space model
  • state space model
  • ssm
  • s6
  • linear-time sequence modeling
  • selective scan
  • mamba block
  • attention-free sequence model

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{gu2024mambalineartimesequencemodeling,
      title={Mamba: Linear-Time Sequence Modeling with Selective State Spaces}, 
      author={Albert Gu and Tri Dao},
      year={2024},
      eprint={2312.00752},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2312.00752}, 
}