arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2604.14191cs.CLcs.LG

对Mamba的注意力:一种跨架构蒸馏的配方

Attention to Mamba: A Recipe for Cross-Architecture Distillation

Apple(苹果公司);MILA Research Institute(MILA研究机构);Flat Iron Institute(Flat Iron研究所)

Abhinav Moudgil, Ningyuan Huang, Eeshan Gunesh Dhekane, Pau Rodríguez, Luca Zappella, Federico Danieli

AI总结:

本文提出一种两阶段方法,通过将Transformer知识蒸馏到线性化的注意力模型,再蒸馏到无注意力块的Mamba模型,从而在下游任务中保持Pythia-1B的性能。

摘要:

状态空间模型(SSMs)如Mamba因其较低的内存消耗和较高的生成吞吐量而成为Transformer的替代选择。然而,社区已积累了大量训练Transformer的知识,且许多预训练Transformer模型已可用。为了促进SSMs的采用并利用现有预训练Transformer,我们旨在找到一种有效的蒸馏配方,将注意力模型蒸馏到Mamba架构中。先前的跨架构蒸馏工作表明,从Transformer直接蒸馏到Mamba的简单方法无法保留原始教师性能,通常通过结合注意力和SSM块的混合方案解决。本文的核心观点是,通过给Mamba提供原则性的初始化,可以恢复一种更优的跨架构蒸馏配方。为此,我们提出了一种两阶段方法:首先,使用核技巧的变种将传统Transformer的知识蒸馏到线性化的注意力版本中。然后,将线性化版本蒸馏到一个不使用注意力块的调整后的Mamba模型中。整体而言,蒸馏后的Mamba模型在下游任务中能够保持原始Pythia-1B Transformer的性能,维持了14.11的困惑度,接近教师的13.86。为了展示我们配方的有效性,我们在1B规模上进行了彻底的消融实验,使用10B个token变化序列混合架构,对模型大小和总蒸馏token进行了扩展分析,并对阶段间的token分配进行了敏感性分析。

英文摘要:

State Space Models (SSMs) such as Mamba have become a popular alternative to Transformer models, due to their reduced memory consumption and higher throughput at generation compared to their Attention-based counterparts. On the other hand, the community has built up a considerable body of knowledge on how to train Transformers, and many pretrained Transformer models are readily available. To facilitate the adoption of SSMs while leveraging existing pretrained Transformers, we aim to identify an effective recipe to distill an Attention-based model into a Mamba-like architecture. In prior work on cross-architecture distillation, however, it has been shown that a naïve distillation procedure from Transformers to Mamba fails to preserve the original teacher performance, a limitation often overcome with hybrid solutions combining Attention and SSM blocks. The key argument from our work is that, by equipping Mamba with a principled initialization, we can recover an overall better recipe for cross-architectural distillation. To this end, we propose a principled two-stage approach: first, we distill knowledge from a traditional Transformer into a linearized version of Attention, using an adaptation of the kernel trick. Then, we distill the linearized version into an adapted Mamba model that does not use any Attention block. Overall, the distilled Mamba model is able to preserve the original Pythia-1B Transformer performance in downstream tasks, maintaining a perplexity of 14.11 close to the teacher's 13.86. To show the efficacy of our recipe, we conduct thorough ablations at 1B scale with 10B tokens varying sequence mixer architecture, scaling analysis on model sizes and total distillation tokens, and a sensitivity analysis on tokens allocation between stages.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑