关注Mamba:跨架构蒸馏配方
Attention to Mamba: A Recipe for Cross-Architecture Distillation

原始链接: https://machinelearning.apple.com/research/attention-mamba-distillation

本工作提出一种两阶段方法,将预训练 Transformer 蒸馏为类似 Mamba 的状态空间模型,且不使用 Attention 块。从 Transformer 到 Mamba 的朴素跨架构蒸馏会损失教师模型性能,通常需要混合 Attention-SSM 模型。所提方法首先通过核技巧适配将 Transformer 蒸馏为线性化 Attention 模型,再将其蒸馏为适配后的 Mamba 模型。得到的 Mamba 模型保留了 Pythia-1B Transformer 的大部分性能,困惑度为 14.01,而教师模型为 13.86,下游结果相似,但在上下文召回任务上存在一些差距。消融实验考察了序列混合器选择、缩放和 token 分配。

Hacker News 讨论了苹果的《Attention to Mamba: A Recipe for Cross-Architecture Distillation》,关于将 Transformer 注意力蒸馏到 Mamba 状态空间模型中。评论提到 Mamba 的线性扩展和相比 Transformer 的 5 倍吞吐量、卷积训练/循环推理,以及潜在的混合 SSM 方法。有人指出 AWS 关于状态空间注意力的论文,并建议将层选择与 Hedgehog 线性化结合。其他人对 Mamba-3 和状态的可预测性感兴趣。一名评论者指出结果只是一个 1B 模型,对更大规模扩展和较弱的上下文内召回存在不确定性,这是 SSM 的已知限制。总体而言,热情因规模和召回问题而有所保留。
相关文章

原文

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 retains most of the original Pythia-1B Transformer performance, reaching a perplexity of 14.01 close to the teacher’s 13.86. This largely carries over to downstream tasks, although some gaps appear on tasks relying more on in-context recall. 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.

联系我们 contact @ memedata.com