All models

mamba2_lm_tiny

A state-space language model whose core layer refines the selective state-space layer of Mamba.

Language · 277 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 (22 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

Parameters
3.2M
Operations
277
Framework
PyTorch
Recurrent
No
Published
ICML 2024
Cited by
928 (as of 9 November 2026)
Authors
Tri Dao, Albert Gu
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
m5697
Graph hash
f58ca915d7407c0198baaccc1aedb92167033f0e3cc15aaa1f5b6006da8581cc
Skeleton hash
e1f5aa9c6c170fe586e06a8e1a7586423c3cf65a1d22e6fdb2679e0570a96ed8
Architecture hash
72087f0abe66f28e29848911eee031dee3d829e0de8429572283f2c763c606c4
Diagram SHA-256
2a60cd551845af8741734b623794c4b8bfc1518d9f25c90d0efb734801121c8b
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 tiny Mamba-2 language model with 2 layers and a hidden size of 32.

Mamba-2 is a language-modeling architecture built on state-space models (SSMs), a family that the paper says has matched or outperformed Transformers at small to medium scale. The paper shows that SSMs and variants of attention are closely related, and connects them through decompositions of a class of structured semiseparable matrices. From that framework, which it calls state space duality (SSD), it designs Mamba-2, whose core layer is a refinement of Mamba's selective SSM.

Compared with the layer used in Mamba, the SSD layer simplifies the structure of its state matrix from diagonal to a scalar times the identity, and it uses a larger head dimension. The block around the layer changes too: the Mamba-2 block removes the sequential linear projections of the Mamba block and produces the SSM parameters in parallel, with a single projection at the beginning of the block. An extra normalization layer sits right before the final output projection, added because the authors found that instabilities tended to arise in larger models.

The paper reports that a dedicated implementation of SSD is 2 to 8 times faster than the optimized selective scan implementation of Mamba, while allowing much larger recurrent state sizes. It also reports that Mamba-2 with 2.7B parameters, trained on 300B tokens on the Pile, outperforms Mamba-2.8B, Pythia-2.8B and Pythia-6.9B trained on the same dataset.

Key idea. The paper shows that state-space models and variants of attention are closely related through structured semiseparable matrices, and uses that duality to design Mamba-2.

  • mamba-2
  • mamba2
  • mamba 2
  • ssd
  • state space duality
  • structured state space duality
  • state space model
  • selective ssm
  • transformers are ssms
  • language model

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

Cite the paper

@misc{dao2024transformersssmsgeneralizedmodels,
      title={Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality}, 
      author={Tri Dao and Albert Gu},
      year={2024},
      eprint={2405.21060},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2405.21060}, 
}