What problem does it solve? Transformer attention scales quadratically with sequence length, causing high memory usage from KV caches and slow inference on long contexts. This Skill provides guidance for building, training, and deploying Mamba state-space models that achieve O(n) linear complexity with no KV cache. ## Core Features & Use Cases - Mamba Block Implementation: Configure Mamba and Mamba-2 layers with d_model, d_state, d_conv, and expand parameters using the mamba-ssm library. - Pretrained Model Usage: Load HuggingFace models from state-spaces/mamba-130m up to mamba-2.8b and generate text with temperature and top-p sampling. - Training & Benchmarking: Distributed training with DDP, mixed precision, gradient checkpointing, and generation speed benchmarks against Transformers. - Use Case: You need to process million-token DNA sequences or long documents where a Transformer runs out of memory. Use this Skill to configure a Mamba-2 language model that scales linearly and runs inference 5× faster. ## Quick Start Use the mamba skill to build a Mamba-2 language model with 24 layers and generate text from a prompt on my CUDA GPU.