state-spaces /mamba

Mamba SSM architecture

★ 19,005⑂ 1,843👁 123⑃ 288● 781▤ 33
PythonApache-2.0Created 2023-12-01
下载:v2.3.2.post1v2.3.2.post1 ↓12026-05-09
+0
日增长
19,005
stars
1,843
forks
123
watchers
288
prs
781
issues
33
releases

README

Mamba

!Mamba
 Mamba: Linear-Time Sequence Modeling with Selective State Spaces\
 Albert Gu, Tri Dao\
 Paper: https://arxiv.org/abs/2312.00752

!Mamba-2
 Transformers are SSMs: Generalized Models and Efficient Algorithms\
     Through Structured State Space Duality\
 Tri Dao, Albert Gu\
 Paper: https://arxiv.org/abs/2405.21060

!Mamba-3
 Mamba-3: Improved Sequence Modeling using State Space Principles\
     Through Structured State Space Duality\
 Aakash Lahoti, Kevin Y. Li, Berlin Chen, Caitlin Wang, Aviv Bick, J. Zico Kolter, Tri Dao†, Albert Gu†\
 Paper: https://arxiv.org/abs/2603.15569

 About

Mamba is a new state space model architecture showing promising performance on information-dense data such as language modeling, where previous subquadratic models fall short of Transformers.
It is based on the line of progress on structured state space models,
with an efficient hardware-aware design and implementation in the spirit of FlashAttention.

 Installation

Install PyTorch first. By default, mamba-ssm installs the core package without compiling the
selective_scan_cuda extension and without downloading cached CUDA-enabled wheels.

| Install mode | Command | Behavior |
| --- | --- | --- |
| Core package | pip install mamba-ssm --no-build-isolation | Installs mamba-ssm without selective_scan_cuda and does not compile CUDA extensions. |
| Core package plus causal-conv1d | pip install "mamba-ssm[causal-conv1d]" --no-build-isolation | Installs the core package and the causal-conv1d extra, still without selective_scan_cuda. |
| Force local core package build | MAMBA_FORCE_BUILD=TRUE pip install mamba-ssm --no-build-isolation | Builds the default pure Python wheel locally, still without selective_scan_cuda. |
| CUDA selective scan opt-in | MAMBA_KEEP_CUDA_BUILD=TRUE pip install mamba-ssm --no-build-isolation | Installs selective_scan_cuda; pip first tries a matching prebuilt CUDA/HIP wheel, then compiles locally if no wheel is available. |
| Force local CUDA selective scan build | MAMBA_FORCE_BUILD=TRUE MAMBA_KEEP_CUDA_BUILD=TRUE pip install mamba-ssm --no-build-isolation | Skips cached wheels and compiles selective_scan_cuda locally. |

--no-build-isolation is required for CUDA builds so that pip uses your existing CUDA-enabled
PyTorch instead of installing torch-cpu in an isolated build environment.

Source installs use the same defaults and opt-in flags:

| Install mode | Command |
| --- | --- |
| Source default, no selective_scan_cuda | pip install . --no-build-isolation |
| Source default from GitHub, no selective_scan_cuda | pip install git+https://github.com/state-spaces/mamba.git --no-build-isolation |
| Source forced local core build, no selective_scan_cuda | MAMBA_FORCE_BUILD=TRUE pip install . --no-build-isolation |
| Source CUDA selective scan opt-in | MAMBA_KEEP_CUDA_BUILD=TRUE pip install . --no-build-isolation |
| Source forced local CUDA selective scan build | MAMBA_FORCE_BUILD=TRUE MAMBA_KEEP_CUDA_BUILD=TRUE pip install . --no-build-

Top issues

Discussions

Latest release

v2.3.2.post1 v2.3.2.post1 2026-05-09
What's Changed
 Bump version to 2.3.2 by @ko3n1g in https://github.com/state-spaces/mamba/pull/944
 Bump to 2.3.2.post1 by @ko3n1g in https://github.com/state-spaces/mamba/pull/945


Full Changelog: https://github.com/state-spaces/mamba/compare/v2.3.2...v2.3.2.post1

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON