atlas

Research map / Architectures and efficiency / Attention and transformers

The Mamba in the Llama: Distilling and Accelerating Hybrid Models

NeurIPS 2024 · Architectures and efficiency › Attention and transformers · approach: Mamba architectures · 6 citations (OpenAlex)

Read the paperCheck your idea against 108,967 papers

AI-extracted summary. Written by AI from the paper's full text. Numbers and claims can be wrong or missing context, so check the paper before you cite or build on it.

Distills Zephyr-7B and Llama-3 8B Instruct into hybrid Mamba/Mamba2 linear RNNs by reusing attention projection weights, followed by SFT and DPO distillation, and adds a hardware-aware multi-step speculative decoding kernel for linear RNNs.

Problem

Pretrained large Transformer LLMs are slow for long-sequence generation due to quadratic attention and large KV caches, while training linear RNNs from scratch requires enormous compute; the paper asks how to convert pretrained Transformers into efficient linear RNN/hybrid models and how to speed up

Approach

Initialize Mamba/Mamba2 blocks from the attention Q/K/V projections (mapped to C/B/x), freeze the transferred MLPs, replace a fraction of attention layers stepwise, and distill with pseudo-label KL/SeqKD followed by SFT and DPO against the teacher; plus a fused multi-step kernel that enables speculative decoding with a single cached RNN state.

Key results

Measured effects reported in the paper

What was changedWhereMeasuredEffect
Increase retained attention layers from 25% to 50% (ablation)Mamba-Llama3 · MT-Benchscore: 6.86 -> 7.35Helped
Increase retained attention layers from 25% to 50% (ablation)Mamba-Llama3 · AlpacaEval 2LC win %: $25.85_{1.26}$ -> 29.61$_{1.31}$Helped
Add both SFT and DPO after distillation (ablation)Hybrid Mamba (50% attention) · MT-Bench (OpenHermes 2.5 alignment ablation)score: 5.55 -> 6.69Helped
Add SFT alone after distillation (ablation)Hybrid Mamba (50% attention) · MT-Bench (OpenHermes 2.5 alignment ablation)score: 5.55 -> 5.61No clear effect
Add DPO alone after distillation (ablation)Hybrid Mamba (50% attention) · MT-Bench (OpenHermes 2.5 alignment ablation)score: 5.55 -> 5.42No clear effect
Initialize projections from attention weights instead of random initialization (ablation)Zephyr-Mamba (50% attention) · MT-Benchscore: 1.04 -> 6.69Helped
Initialize projections from attention weights instead of random initialization (ablation)Hybrid Mamba (50% attention) · LAMBADAPPL: 55.01 -> 6.20Helped
Interleave attention layers with Mamba layers (ablation)Hybrid Mamba (25% attention) · Zephyr perplexity ablationPPL: 2.89 -> 2.20Helped
Include Mamba blocks rather than remove them (ablation)Hybrid Mamba (50% attention) · MT-Benchscore: 1.01 -> 6.69Helped
Reduce retained attention layers from 50% to 0% (ablation)Mamba2-Llama3 · LM Eval AVGscore: 63.84 -> 54.74Hurt
Use a 4-layer rather than 2-layer draft model (ablation)Mamba-Zephyr (50%) speculative decoding · OpenHermes2.5speedup: 1.8x -> 1.81xMixed

Surprising findings

Limitations

Experimental setup

Datasets: UltraChat UltraFeedback GenQA InfinityInstruct OpenHermes 2.5 SimPO preference data The Pile

Benchmarks: AlpacaEval 2 MT-Bench LM Eval Harness (WinoGrande, PIQA, HellaSwag, ARC, MMLU, OpenBookQA, TruthfulQA, PubMedQA, RACE) Open LLM Leaderboard ZeroEval (GSM8K, CRUX) Needle in a Haystack

Metrics: length-controlled win rate win rate MT-Bench score accuracy perplexity speedup tokens/second

Baselines: TRI Mamba 7B Nvidia Hybrid Mamba2 8B Falcon Mamba 7B RecurrentGemma-9B Zephyr-7B Llama-3-Instruct 8B Llama-3.1-Instruct 8B GPT-4o

Builds on: Mamba Mamba2 speculative decoding DPO Laughing Hyena

Closest papers by meaning

Writing a paper in this area? scime draft is a free LaTeX editor with AI included, real-time co-authors and a check of your references and venue rules before you submit. It also imports OpenAI Prism projects.

Open scime draft

Get the next scime Dispatch and a monthly field update

Free. We send a confirmation link first; every email has a one-click unsubscribe. Privacy