Skip to main content
QUICK REVIEW

[Paper Review] Transformers are SSMs: Generalized Models and Efficient Algorithms Through Structured State Space Duality

Tri Dao, Albert G. Gu|arXiv (Cornell University)|May 31, 2024
Neural Networks and ApplicationsComputer Science66 citations
TL;DR

The paper establishes a formal connection between structured state-space models (SSMs) and attention, introducing Structured State Space Duality (SSD) to derive efficient SSM-based architectures (Mamba-2) that rival Transformers in language modeling while offering scalability advantages.

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.

Motivation & Objective

  • Motivate bridging SSMs and Transformers to improve scalability and efficiency for long sequences.
  • Develop a theoretical framework (SSD) linking SSMs with structured matrices and attention variants.
  • Present new algorithms (SSD) that unify linear recurrence and quadratic dual forms for efficient computation.
  • Propose architecture designs (Mamba-2) leveraging SSD and structured attention for better throughput.

Proposed method

  • Formalize SSMs as matrix transformations and connect them to semiseparable matrices (SSS representation).
  • Introduce Structured State Space Duality (SSD) to unify linear (recurrence) and quadratic (attention-like) forms.
  • Generalize linear attention into Structured Masked Attention (SMA) using structured matrices.
  • Develop the SSD algorithm based on block decompositions of semiseparable matrices for hardware efficiency.
  • Propose Mamba-2 architecture with grouped-value attention and parallel data projections.
  • Analyze computational tradeoffs and provide hardware-aware implementation guidance.

Experimental results

Research questions

  • RQ1How can SSMs be represented as semiseparable matrices to reveal algorithmic dualities with attention?
  • RQ2Can a unified SSD framework yield efficient training and inference for SSMs comparable to Transformers?
  • RQ3What modifications (e.g., Mamba-2) optimize SSMs for modern hardware while preserving performance on language modeling?
  • RQ4How do structured masked attention variants relate to and generalize linear attention frameworks?

Key findings

  • SSMs are equivalent to semiseparable matrices, enabling O(TN) computation with appropriate structure.
  • SSD provides a bridge between linear recurrence and attention-like quadratic forms, enabling efficient hybrids.
  • A new SSD algorithm outperforms selective scan in Mamba while enabling larger recurrent states.
  • Mamba-2 architecture with parallel data projections and SMA variants matches or surpasses Mamba and open-source Transformers on standard downstream tasks.
  • Empirical validation on language modeling, efficiency metrics, and a difficult recall task supports competitive performance.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.