Back to directory

Mamba: Selective State Space Models

An educational, from-scratch PyTorch implementation of Mamba, the selective state space model architecture, covering the selective scan mechanism, a Mamba block, and a complete language model built on it.

Mamba: Selective State Space Models

This repository is a clean, educational PyTorch reimplementation of Mamba, the selective state space model architecture proposed in "Mamba: Linear-Time Sequence Modeling with Selective State Spaces" by Albert Gu and Tri Dao. It implements the core selective SSM, where the state-space parameters B, C, and the timestep are made input-dependent so the model can selectively filter, remember, or forget information as it processes a sequence.

It includes a Mamba block with gated residuals, both parallel and sequential scan implementations, a full language model built from these blocks, tests, training examples, and benchmarks comparing against Transformer-based approaches.

Installation is a standard pip install -r requirements.txt, and the README includes a minimal example instantiating a MambaBlock and running it on a batch of sequences.

More in Models

See all 405
  • mini-AGI

    github.com

    A continual learning language model that trains from scratch on a single 8 GB VRAM GPU, assembling its own architecture and adapting its size to the hardware and data available rather than shipping as a fixed pretrained model.

  • An open-source contrastive-embedding pipeline that maps technical CVE vulnerability descriptions to formal cybersecurity compliance controls in NIST SP 800-53 and CMMC, published with its model generation, fine-tuning and evaluation code.

  • peekaboolean

    github.com

    A small vision-language model, fine-tuned with LoRA on a 500-million-parameter backbone, that answers typed multiple-choice, ordinal-score and yes/no questions about an image with calibrated probabilities, in about 400 milliseconds on a laptop.