What problem does it solve? Transformer models suffer from O(n²) attention complexity and growing KV cache memory, making long-sequence inference slow and expensive. This Skill provides working code and guidance for Mamba, a selective state-space architecture with O(n) linear complexity, no KV cache, and up to 5× faster inference. ## Core Features & Use Cases - Mamba Block & LM Construction: Build Mamba-1 and Mamba-2 blocks or full language models with MambaLMHeadModel, configuring d_state, d_conv, expand, and multi-head parameters. - Pretrained Model Inference: Load HuggingFace checkpoints (130M to 2.8B parameters) and generate text with temperature, top-p, and repetition penalty controls. - Benchmarking & Training: Compare generation speed against Transformers, train from scratch with DDP, mixed precision, and gradient checkpointing. - 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 that processes the sequence with constant memory per token instead of an exploding KV cache. ## Quick Start Install mamba-ssm with pip and ask the AI to create a Mamba language model that loads the state-spaces/mamba-2.8b checkpoint and generates text from a prompt.