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 and guidance for using Mamba state-space models, which achieve O(n) complexity, 5× faster inference, and constant memory per token. ## 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 state-spaces/mamba models (130M to 2.8B) from HuggingFace and generate text with temperature, top-p, and repetition penalty controls. - Benchmarking & Training Guidance: Compare generation speed against Transformers and follow distributed training, mixed precision, and gradient checkpointing recipes from the references. - 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 linearly without a KV cache. ## Quick Start Ask the assistant to create a Mamba-2 language model with MambaLMHeadModel and generate text from a prompt on a CUDA GPU.