# johnma2006/mamba-minimal

Simple, minimal implementation of the Mamba SSM in one file of PyTorch.

Repository: https://github.com/johnma2006/mamba-minimal
Canonical: https://ross.abutalabs.com/products/mamba-minimal
Language: Python
License: Apache-2.0
License Family: permissive
Last push: 2024-03-08T04:13:40+00:00

## Health v2 (maintenance only)
Score: 26/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 0, release rhythm 35, longevity 70
- inputs: {"age_days": 987, "days_push": 908, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2965, forks 218 (observed 2026-08-28T04:07:32.513154+00:00)

## What it is
A single-file, readable PyTorch implementation of the Mamba selective state space model architecture. It produces numerically equivalent outputs to the official optimized implementation and can load pretrained Mamba checkpoints for text generation.

## Use cases
- understand how the mamba ssm architecture works internally
- run a minimal mamba model in pure pytorch without custom kernels
- load pretrained mamba weights and generate text
- study annotated code for selective state space models
- prototype modifications to the mamba architecture
- compare mamba implementation against the official one numerically

## When to choose
- you want to read and learn the mamba architecture from clean annotated code
- you need a dependency-light pytorch reference implementation for experimentation
- you want to verify correctness against the official implementation
- you are teaching or studying state space models

## When to avoid
- you need fast, production-grade inference speed
- you require proper parameter initialization for training from scratch
- you want optimized CUDA kernels or long-context performance
- you need a maintained, feature-complete framework

## Facets
- artifact type: library
- maturity: maintenance
- function: deep-learning, machine-learning, llm-inference
- domain: deep-learning, large-language-models, machine-learning
- platform: python
- tags: mamba, ssm, state-space-models, educational, minimal-implementation, pytorch

## Member repositories
- johnma2006/mamba-minimal (main) score 26

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:32.513154+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:32:03.564657+00:00, confidence not recorded.
  - readme: https://github.com/johnma2006/mamba-minimal (fetched 2026-08-28T04:07:32.513154+00:00, sha 21fbe69e1859)
- Data as of 2026-08-30T08:39:29.467469+00:00.
