# Attention to Mamba: A Recipe for Cross-Architecture Distillation

DevFeed: [Attention to Mamba: A Recipe for Cross-Architecture Distillation](<https://devfeed.tech/articles/attention-to-mamba-a-recipe-for-cross-architecture-distillation-127730.md>)

Original publisher: [Read original article](<https://machinelearning.apple.com/research/attention-mamba-distillation>)

Published: 2026-11-03T00:00:00Z

Content type: article

Language: en

Sources: [Apple Machine Learning Research](<https://devfeed.tech/sources/apple-machine-learning-research.md>)

Topics: [Mamba](<https://devfeed.tech/topics/mamba.md>), [Post-training optimization](<https://devfeed.tech/topics/post-training-optimization.md>), [Transformer](<https://devfeed.tech/topics/transformer.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [approach](<https://devfeed.tech/tags/approach.md>), [architecture](<https://devfeed.tech/tags/architecture.md>), [attention](<https://devfeed.tech/tags/attention.md>), [context](<https://devfeed.tech/tags/context.md>), [cross](<https://devfeed.tech/tags/cross.md>), [distillation](<https://devfeed.tech/tags/distillation.md>), [icml](<https://devfeed.tech/tags/icml.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [language](<https://devfeed.tech/tags/language.md>), [mamba](<https://devfeed.tech/tags/mamba.md>), [memory](<https://devfeed.tech/tags/memory.md>), [model](<https://devfeed.tech/tags/model.md>), [models](<https://devfeed.tech/tags/models.md>), [recipe](<https://devfeed.tech/tags/recipe.md>), [state-space-models](<https://devfeed.tech/tags/state-space-models.md>), [train](<https://devfeed.tech/tags/train.md>), [transformer](<https://devfeed.tech/tags/transformer.md>), [transformer-models](<https://devfeed.tech/tags/transformer-models.md>), [transformers](<https://devfeed.tech/tags/transformers.md>)

## AI overview

The paper proposes a two-stage recipe for transferring a pretrained Transformer into an Attention-free Mamba model. It first distills the Transformer into linearized Attention using an adaptation of the kernel trick, then distills that model into an adapted Mamba initialized to support the transfer. The authors report that on Pythia-1B, the resulting model reaches perplexity 14.01 versus 13.86 for the teacher and retains most of its performance on downstream tasks, though gaps remain on tasks relying more on in-context recall. The paper also reports ablations on sequence mixer architecture, model size, distillation token count, and how tokens are allocated between stages.

## Source excerpt

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...