Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality

Tri Dao, Albert Gu
5/31/2024
cs.LG

No official code found. Best implementation: state-spaces/mamba (18,796 stars, Apache-2.0, last commit 2026-05-03). 1 more below.

Abstract

While Transformers have been the main architecture behind deep learning's success in language modeling, state-space models (SSMs) such as Mamba have recently been shown to match or outperform Transformers at small to medium scale. We show that these families of models are actually quite closely related, and develop a rich framework of theoretical connections between SSMs and variants of attention, connected through various decompositions of a well-studied class of structured semiseparable matrices. Our state space duality (SSD) framework allows us to design a new architecture (Mamba-2) whose core layer is an a refinement of Mamba's selective SSM that is 2-8X faster, while continuing to be competitive with Transformers on language modeling.

View on arXivView PDF

Code Implementations(2)

state-spaces/mambaCommunity100%
Apache-2.0

Mamba SSM architecture

18,7961,809C, C++Dec 1, 20235 months agoApache-2.0

Mamba Model - arxiv-2405.21060

00Jun 27, 20251 years ago

Similar Papers

Cite this paper

@article{dao2024transformers,
  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},
  url    = {http://arxiv.org/abs/2405.21060v1},
  journal = {ICML 2024 2024}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2405.21060.svg)](https://codeofpaper.com/paper/2405.21060)

Discussion