Attention to Mamba - A Recipe for Cross-Architecture Distillation
ChatGPT paper summary
Attention to Mamba: A Recipe for Cross-Architecture Distillation
π Core Idea
The paper proposes a new method to transfer knowledge from Transformer models (with Attention) into Mamba models (a type of State Space Model, SSM)βwhich are faster and more memory-efficient.
β Problem
- Transformers (with softmax attention) are powerful but expensive (quadratic cost in sequence length).
- Mamba/SSMs are efficient (linear cost) but harder to train and usually less accurate.
- Directly distilling (copying knowledge) from Transformers β Mamba fails to preserve performance.
π‘ Key Solution: Two-Stage Distillation
Instead of direct transfer, the authors introduce a bridge strategy:
Stage 1: Transformer β Linear Attention
- Replace softmax attention with a learned linear approximation (via a method called Hedgehog).
- Uses a learned feature map to mimic attention behavior.
Stage 2: Linear Attention β Mamba
- Convert the linear attention into a Mamba-compatible initialization.
- Then fine-tune the full model.
π This staged approach aligns architectures gradually, making knowledge transfer effective.
βοΈ Key Insight
- Linear Attention and Mamba (SSMs) are mathematically related.
- Using Linear Attention as an intermediate step avoids forcing incompatible architectures to match directly.
π Results
-
The distilled Mamba model almost matches the original Transformer:
- Perplexity: 14.11 vs 13.86 (teacher)
- Works across multiple downstream tasks with strong performance.
- Outperforms simpler baselines and naive distillation.
π§ͺ Additional Findings
- Adding Mamba components (like gating) improves results.
- Most training budget should go to Stage 2 (fine-tuning).
- More distillation data β better performance.
π§ Contributions
- A two-stage distillation method for Transformer β Mamba.
- Demonstrates that proper initialization + architectural alignment is critical.
- Shows you can get efficient models without retraining from scratch.
π§Ύ Bottom Line
You can convert powerful but expensive Transformer models into fast, efficient Mamba modelsβwithout losing much performanceβby:
bridging them through Linear Attention first, instead of distilling directly.