
Mamba Architecture
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-codeInstalls 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- Model Pruning1K
- Sparse Autoencoder Training1K
- Implementing Llms Litgpt1K
- Llamaguard1K
- Miles Rl Training1K
- Torchforge Rl Training1K
- Nemo Guardrails1K
- Pinecone1K
- Nnsight Remote Interpretability1K
- Rwkv Architecture1K
- Skypilot Multi Cloud Orchestration1K
- Autogpt Agents1K
- Blip 2 Vision Language1K
- Constitutional Ai1K
- Langsmith Observability1K
- Nemo Evaluator Sdk1K
- Llava1K
- Phoenix Observability1K
- Lambda Labs Gpu Cloud1K
- Ml Training Recipes996
- Presenting Conference Talks993
- Systems Paper Writing990
- Experiment Tracking Swanlab961
- Fine Tuning Openvla Oft926