paper-with-me

홈 › Papers

The Mamba in the Llama: Distilling and Accelerating Hybrid Models

2024-08-27 · Junxiong Wang, Daniele Paliotta, Avner May, Alexander M. Rush, Tri Dao

Linear RNN architectures, like Mamba, can be competitive with Transformer models in language modeling while having advantageous deployment characteristics. Given the focus on training large-scale Transformer models, we consider the challenge of converting these pretrained models for deployment. We demonstrate that it is feasible to distill large Transformers into linear RNNs by reusing the linear projection weights from attention layers with academic GPU resources. The resulting hybrid model, which incorporates a quarter of the attention layers, achieves performance comparable to the original Transformer in chat benchmarks and outperforms open-source hybrid Mamba models trained from scratch with trillions of tokens in both chat benchmarks and general benchmarks. Moreover, we introduce a hardware-aware speculative decoding algorithm that accelerates the inference speed of Mamba and hybrid models. Overall we show how, with limited computation resources, we can remove many of the original attention layers and generate from the resulting model more efficiently. Our top-performing model, distilled from Llama3-8B-Instruct, achieves a 29.61 length-controlled win rate on AlpacaEval 2 against GPT-4 and 7.35 on MT-Bench, surpassing the best 8B scale instruction-tuned linear RNN model. We also find that the distilled model has natural length extrapolation, showing almost perfect accuracy in the needle-in-a-haystack test at 20x the distillation length. Code and pre-trained checkpoints are open-sourced at https://github.com/jxiw/MambaInLlama and https://github.com/itsdaniele/speculative_mamba.

📄 PDF Abstract BibTeX arXiv:2408.15237

Code (2)

itsdaniele/speculative_mamba 공식 구현 pytorch
jxiw/mambainllama 공식 구현 pytorch

Tasks

GPULanguage ModelingLanguage ModellingMamba

Methods 이 논문이 사용한 방법론

Attention 설명 없음
Linear Layer A Linear Layer is a projection $\mathbf{XW + b}$.
Adam 설명 없음
Layer Normalization Unlike batch normalization, Layer Normalization directly estimates the normalization statistics from the summed inputs…
Position-Wise Feed-Forward Layer 설명 없음
Dense Connections Dense Connections, or Fully Connected Connections, are a type of layer in a deep neural network that use a linear operation where every input is connected to every output…
Residual Connection 설명 없음
Multi-Head Attention 설명 없음

Similar Papers 제목 키워드 기반

Recall with Reasoning: Chain-of-Thought Distillation for Mamba's Long-Context Memory and Extrapolation

2025-05-06 · Junyu Ma, Tianqing Fang, Zhisong Zhang, Hongming Zhang 외

Mamba's theoretical infinite-context potential is limited in practice when sequences far exceed training lengths. This work explores unlocking Mamba's long-context memory ability by a simple-yet-effective method, Recall …

Mamba

MaskMamba: A Hybrid Mamba-Transformer Model for Masked Image Generation

2024-09-30 · Wenchao Chen, LiQiang Niu, Ziyao Lu, Fandong Meng 외

Image generation models have encountered challenges related to scalability and quadratic complexity, primarily due to the reliance on Transformer-based backbones. In this study, we introduce MaskMamba, a novel hybrid mod…

Image GenerationMambaText to Image GenerationText-to-Image Generation

Falcon Mamba: The First Competitive Attention-free 7B Language Model

2024-10-07 · Jingwei Zuo, Maksim Velikanov, Dhia Eddine Rhaiem, Ilyas Chahed 외

In this technical report, we present Falcon Mamba 7B, a new base large language model based on the novel Mamba architecture. Falcon Mamba 7B is trained on 5.8 trillion tokens with carefully selected data mixtures. As a p…

Language ModelingLanguage ModellingLarge Language ModelMamba

Can Custom Models Learn In-Context? An Exploration of Hybrid Architecture Performance on In-Context Learning Tasks

2024-11-06 · Ryan Campbell, Nelson Lojo, Kesava Viswanadha, Christoffer Grondal Tryggestad 외

In-Context Learning (ICL) is a phenomenon where task learning occurs through a prompt sequence without the necessity of parameter updates. ICL in Multi-Headed Attention (MHA) with absolute positional embedding has been t…

In-Context LearningMamba

Zebra-Llama: Towards Extremely Efficient Hybrid Models

2025-05-22 · Mingyu Yang, Mehdi Rezagholizadeh, Guihong Li, Vikram Appia 외

With the growing demand for deploying large language models (LLMs) across diverse applications, improving their inference efficiency is crucial for sustainable and democratized access. However, retraining LLMs to meet ne…

State Space Models