All models

mamba_mambapy

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

Language · 246 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 (21 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
65.4K
Operations
246
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
m5704
Graph hash
79edc7a9ec3378acdd0894c1df13831912b60da155a49f509e5a4bad05e8b649
Skeleton hash
1965ef364a1120675e8dc1a4d57d7365a729a66fee0e49328d0b84ca83abbcf6
Architecture hash
1aea0df928636359c4659209c8227fee5993937af4cdb46a885b7942eb491d4e
Diagram SHA-256
076f558a6b12668220c1534cbd4562aa0b06c547f15a273ae5bf35f52265a2fb
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 stacks two Mamba blocks, interleaved with normalization and residual connections.

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}, 
}