If you're hitting transformer bottlenecks on long sequences, this gives you the Mamba SSM architecture with O(n) linear complexity instead of O(n²). It's genuinely 5× faster at inference with no KV cache, so you can handle million-token contexts without exploding memory. The skill covers both Mamba-1 (simpler, d_state=16) and Mamba-2 (multi-head, d_state=128), with pretrained models from 130M to 2.8B parameters ready to load from HuggingFace. The tradeoff is you need Linux and NVIDIA GPUs, and transformers still win on raw performance when you have the compute budget. Best for streaming applications, long context tasks, or anywhere linear scaling actually matters more than squeezing out another few points of accuracy.

skills.sh installs
1K
GitHub stars
14.4K
last updated
Aug 21, 2026

Install

$ npx -y skills add orchestra-research/ai-research-skills --skill mamba-architecture --agent claude-code

Installs into .claude/skills of the current project.

Files

Mamba - Selective State Space Models

Quick start

Mamba is a state-space model architecture achieving O(n) linear complexity for sequence modeling.

Installation:

# Install causal-conv1d (optional, for efficiency)
pip install causal-conv1d>=1.4.0

# Install Mamba
pip install mamba-ssm
# Or both together
pip install mamba-ssm[causal-conv1d]

Prerequisites: Linux, NVIDIA GPU, PyTorch 1.12+, CUDA 11.6+

Basic usage (Mamba block):

import torch
from mamba_ssm import Mamba

batch, length, dim = 2, 64, 16
x = torch.randn(batch, length, dim).to("cuda")

model = Mamba(
    d_model=dim,      # Model dimension
    d_state=16,       # SSM state dimension
    d_conv=4,         # Conv1d kernel size
    expand=2          # Expansion factor
).to("cuda")

y = model(x)  # O(n) complexity!
assert y.shape == x.shape

Common workflows

Workflow 1: Language model with Mamba-2

Complete LM with generation:

from mamba_ssm.models.mixer_seq_simple import MambaLMHeadModel
from mamba_ssm.models.config_mamba import MambaConfig
import torch

Sponsors

Details

Repository
github.com/orchestra-research/ai-research-skills
Categories
Code Review & Quality, AI & Agent Building, Data Science & ML, Design & UI/UX
First seen
Jun 3, 2026

More from orchestra-research/ai-research-skills

All 95
1orchestra-research avatarrwkv-architectureorchestra-research/ai-research-skillsRNN+Transformer hybrid with O(n) inference. Linear time, infinite context, no KV cache. Train like GPT (parallel), infer like RNN (sequential). Linux Foundation1Kskills.sh installs
2cap-go avatarcapacitor-apple-review-preflightcap-go/capgo-skillsGuides the agent through an Apple App Store preflight review for Capacitor apps before submission or after rejection. Covers guideline checklist selection, App 956skills.sh installs
3appandflow avatarreact-native-ease-refactorappandflow/react-native-easeScan for Animated/Reanimated code and migrate to EaseView953skills.sh installs
4heygen-com avatarvisual-styleheygen-com/skillsCreate, extract, and apply portable visual design systems via visual-style.md files. Use when: (1) Creating a visual-style.md design system from scratch, (2) Ex921skills.sh installs
5vinvcn avatarreviewvinvcn/mattpocock-skills-zh-cnReview the changes since a fixed point (commit, branch, tag, or merge-base) along two axes — Standards (does the code follow this repo's documented coding stand911skills.sh installs
6forcedotcom avatarinvestigating-agentforce-architectureforcedotcom/sf-skillsDeclared architecture snapshot for one Agentforce agent: planner, topics, actions, flows, Apex, prompt templates, and NGA plugins. Renders a human-readable arch903skills.sh installs