Skip to content

Guide · Agent skill

How to use the Mamba State-Space Model Guide agent skill

Updated · written with AI from the project's own documentation and checked against our catalogue data

The mamba-architecture skill is a coding guide that teaches an AI agent how to build and use Mamba, a state-space neural network that scales linearly with sequence length instead of quadratically like most Transformers. It is aimed at machine learning engineers, researchers and developers who want working starter code. After following this guide you will know how to install the skill, ask the agent for Mamba code in plain language, and what hardware and packages the code needs.

Mamba State-Space Model GuideOrchestra-Research/AI-Research-SKILLs · MIT

Quick start

  1. 1Download and unzip the skill. Download the ZIP from the page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder.
  2. 2Or upload it in the Claude apps. Go to Settings → Capabilities → Skills and upload the skill.
  3. 3Confirm your environment. Check for Linux, an NVIDIA GPU, PyTorch 1.12+ and CUDA 11.6+, then run the CUDA availability check.
  4. 4Install the packages. Install mamba-ssm with pip, and causal-conv1d>=1.4.0 as recommended.
  5. 5Ask for what you need. Describe the task in plain language, naming Mamba and the model size or variant.
  6. 6Run and check the code. Run the generated code and confirm output shapes or generated text. Review any scripts first.

What is an agent skill and what does this one do?

An agent skill is a folder of instructions and reference files that an AI agent can load when a task matches it. This skill's entry file is SKILL.md, backed by three reference files: architecture-details.md, benchmarks.md and training-guide.md.

Once installed, the agent can write code that sets up Mamba-1 or Mamba-2 blocks, load pretrained Mamba models from HuggingFace, generate text, and compare speed against Transformers. It also gives guidance on installation, common errors and hardware memory needs.

  • Build a Mamba block (Mamba-1, d_state=16) or a Mamba-2 block (d_state=128, multi-head).
  • Assemble a Mamba language model and run generation.
  • Load pretrained models such as state-spaces/mamba-130m through state-spaces/mamba-2.8b.
  • Write a generation speed comparison against a Transformer such as EleutherAI/pythia-2.8b.

Install the skill (ZIP download or Claude apps upload)

Download the ZIP from our page and unzip it. For a personal setup, place the folder in ~/.claude/skills/. For a single project, place it in that project's .claude/skills/ folder.

Alternatively, upload the skill in the Claude apps under Settings → Capabilities → Skills.

  • Personal: unzip into ~/.claude/skills/
  • Project only: unzip into the project's .claude/skills/
  • Claude apps: Settings → Capabilities → Skills, then upload

Install the Mamba packages the code needs

The skill's code needs more than the skill itself. The documented prerequisites are Linux, an NVIDIA GPU, PyTorch 1.12+ and CUDA 11.6+. The source shows these install commands, which the agent can use as a reference:

  • causal-conv1d>=1.4.0 is optional but recommended for efficiency.
  • Installing binary wheels rather than source is suggested if installation is slow.
pip install causal-conv1d>=1.4.0 pip install mamba-ssm # Or both together pip install mamba-ssm[causal-conv1d]

Trigger the skill with natural requests

You do not need special syntax. Describe the task and mention Mamba, state-space models or linear-complexity sequence models. Name the model size or task so the agent picks the right variant.

Good requests name the goal, the model and the hardware, for example asking for Mamba-2 code with d_state=128 on a CUDA GPU, or a script that loads state-spaces/mamba-130m and generates text.

  • "Write a Mamba-1 block for a 256-dimensional input and check the output shape."
  • "Load state-spaces/mamba-370m from HuggingFace and generate 100 tokens from a prompt."
  • "Compare generation speed of Mamba-2.8B and Pythia-2.8B using the benchmark script."
  • "Why does from_pretrained fail for my Mamba model?"

Examples of what the agent produces

The source includes a basic Mamba block example. It creates a random input tensor of shape batch 2, length 64, dimension 16, moves it to CUDA, runs it through a Mamba block with d_state=16, d_conv=4 and expand=2, and asserts the output shape matches the input.

For pretrained generation, the source loads the EleutherAI/gpt-neox-20b tokenizer and state-spaces/mamba-2.8b weights, then generates text with temperature 0.7 and top_p 0.9.

from mamba_ssm import Mamba model = Mamba( d_model=16, d_state=16, d_conv=4, expand=2 ).to("cuda")

Safety notes: scripts and network access

This skill runs scripts and uses the network. The source says it downloads pretrained weights from HuggingFace and includes benchmark scripts such as benchmarks/benchmark_generation_mamba_simple.py. Review any script before running it, and check which model names are being downloaded.

The benchmark commands also need the EleutherAI tokenizer and the Pythia model. Only run them in an environment where those downloads are acceptable.

  • Downloads pretrained weights from HuggingFace (network use).
  • Benchmark scripts run on your GPU.
  • Review generated code before running it on shared machines.

Tips for getting good results

Check your environment first with a CUDA availability test. The training guide suggests running python -c "import torch; print(torch.cuda.is_available())". If you hit out-of-memory errors, the source suggests reducing batch size or enabling gradient checkpointing.

Match VRAM to model size. The source lists roughly 2GB for 130M, 4GB for 370M, 8GB for 790M, 14GB for 1.4B and 28GB for 2.8B in FP16. Use MambaLMHeadModel.from_pretrained rather than AutoModel to load these weights.

  • Use Mamba-1 for smaller states (d_state=16) and Mamba-2 for larger states (d_state=128).
  • Treat the speed figures as the source's own benchmarks, and measure on your own workload.

What people use it for

  • Building a small Mamba-1 block to test output shapes on a GPU.
  • Generating text from a pretrained state-spaces model for a comparison study.
  • Benchmarking Mamba against a Transformer such as Pythia on long prompts.
  • Debugging installation or from_pretrained loading errors.

Frequently asked questions

Is the Mamba skill free?

The skill is published under the MIT licence. The source does not list prices, so check the page for any other terms. The Mamba packages and pretrained weights are used as the source describes.

What do I need to use the Mamba skill?

The documented prerequisites are Linux, an NVIDIA GPU, PyTorch 1.12+ and CUDA 11.6+. You also need the mamba-ssm package, transformers, and HuggingFace access to download pretrained weights.

Can I use the Mamba skill on Windows or macOS?

The source lists Linux with an NVIDIA GPU as the prerequisites and does not document Windows or macOS support. The skill cannot make the code run on unsupported hardware.

How do I install the Mamba skill?

Download the ZIP from the page and unzip it into ~/.claude/skills/ or a project's .claude/skills/ folder. You can also upload it under Settings → Capabilities → Skills in the Claude apps.

Is Mamba faster than Transformers?

The skill states 5× faster inference and gives benchmark tables, but it shows these as general figures. Speedup in its tables grows with sequence length, so measure on your own workload before relying on it.

Why does my Mamba model fail to load from HuggingFace?

The source's fix is to use MambaLMHeadModel.from_pretrained instead of AutoModel. Pair it with a compatible tokenizer such as EleutherAI/gpt-neox-20b.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

This skill suits machine learning engineers, researchers and developers who have a Linux machine with an NVIDIA GPU and want working Mamba starter code. It is not suitable for Windows or macOS users, non-technical users wanting a chatbot, or anyone who expects the claimed speed and million-token results to hold in every setting.

Download the skill