state-spaces/mamba

Mamba SSM architecture

What it solves

Mamba addresses the limitations of Transformers in processing information-dense data, specifically the quadratic scaling issues that make long-sequence modeling inefficient. It provides a subquadratic, linear-time alternative for sequence modeling that maintains high performance on tasks like language modeling.

How it works

Mamba is based on a selective State Space Model (SSM) architecture. It utilizes a hardware-aware design and efficient CUDA implementations—similar to the spirit of FlashAttention—to optimize performance. The project has evolved through several iterations:

  • Mamba-1: Introduced selective state spaces for linear-time sequence modeling.
  • Mamba-2: Introduced Structured State Space Duality (SSD), framing Transformers as SSMs to create more efficient algorithms.
  • Mamba-3: Further improved sequence modeling using state space principles and an inference-first approach.

Who it’s for

It is designed for AI researchers and developers building large-scale sequence models or language models who need the efficiency of linear-time scaling without sacrificing the performance typically associated with Transformers.

Highlights

  • Linear-Time Scaling: Offers a more efficient alternative to the quadratic complexity of Transformers.
  • Hardware-Aware Design: Includes optimized CUDA extensions (selective_scan_cuda) for high-performance GPU execution.
  • Pretrained Models: Provides a range of pretrained base models (from 130M to 2.8B parameters) trained on the Pile and SlimPajama datasets.
  • Flexible Interface: Exposes multiple levels of API, from raw selective SSM layers to full Mamba blocks and complete language model examples.

Related

  • Dispatch
  • Project
  • Dispatch
  • Project
  • Project