mamba-architecture

Implements and benchmarks Mamba selective state-space models for linear-complexity sequence modeling.

2|Updated Jan 26, 2026
One-click install
npx skills add https://github.com/Nzettodess/Awesome-Agent-Skills --skill mamba-architecture-nzettodess
Or copy as Structured Prompt for Agentā–¼
Please help me install this Agent Skill.
Skill: mamba-architecture
Source: https://github.com/Nzettodess/Awesome-Agent-Skills/tree/main/Skills/Agentic%20AI%20Development/AI-research-SKILLs-1.1.0/01-model-architecture/mamba
Command: npx skills add https://github.com/Nzettodess/Awesome-Agent-Skills --skill mamba-architecture-nzettodess

SYSTEM DOCUMENTATION & REQUIREMENTS

šŸ’” This Skill requires mamba-ssm, torch, transformers, causal-conv1d, and includes references (resource) components.

What problem does it solve? Transformers scale quadratically with sequence length and require large KV caches, making long-context inference slow and memory-hungry. This Skill provides working code, configuration guidance, and benchmarks for Mamba state-space models that achieve O(n) complexity with no KV cache. ## Core Features & Use Cases - Mamba Block & LM Setup: Ready-to-use code for building Mamba-1 and Mamba-2 blocks and full language models via mamba-ssm and MambaLMHeadModel. - Pretrained Model Usage: Load state-spaces models (130M to 2.8B) from HuggingFace and run text generation with temperature, top-p, and repetition penalty controls. - Benchmarking & Training Guidance: Compare inference speed and memory against Transformers, plus distributed training, mixed precision, and gradient checkpointing recipes. - Use Case: You need to serve a language model over 100K-token genomic sequences on limited GPU memory. Use this Skill to configure a Mamba-2 model, load pretrained weights, and generate output with constant per-token memory. ## Quick Start Ask the AI to set up a Mamba-2 language model with mamba-ssm, load the state-spaces/mamba-2.8b pretrained weights, and generate text from a given prompt.

Frequently Asked Questions about mamba-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I use pretrained Mamba models from HuggingFace?ā–¼

Load pretrained Mamba models with MambaLMHeadModel.from_pretrained using identifiers like state-spaces/mamba-2.8b, paired with a compatible tokenizer such as EleutherAI/gpt-neox-20b. Then call model.generate with input_ids, max_length, temperature, and top_p.

What is the difference between Mamba-1 and Mamba-2?ā–¼

Mamba-1 uses a state dimension of 16, while Mamba-2 uses d_state=128 with a multi-head structure, RMSNorm, and tensor parallelism support. Mamba-2 is configured via the Mamba2 class with headdim and ngroups parameters.

Mamba vs Transformer: which is faster for long sequences?ā–¼

Mamba achieves roughly 5x faster inference than comparable Transformers, with the speedup growing as sequence length increases because Mamba scales linearly while attention scales quadratically. Mamba also needs no KV cache, cutting inference memory significantly.

What hardware do I need to run Mamba models?ā–¼

Mamba requires Linux, an NVIDIA GPU with CUDA 11.6+, and PyTorch 1.12+. VRAM needs range from 2GB for the 130M model to 28GB for the 2.8B model in FP16.

Why does Mamba installation fail or run slowly?ā–¼

Slow installs usually come from building from source; use pip install mamba-ssm --no-build-isolation for binary wheels. If causal-conv1d is missing, install it separately with pip install causal-conv1d>=1.4.0.

When should I not use Mamba?ā–¼

Avoid Mamba when you need best-in-class task performance and have ample compute, where Transformers still lead. Alternatives like RWKV, RetNet, or Hyena may fit better for RNN-Transformer hybrids, retention-based designs, or convolution-based approaches.