Attention Editing: A Versatile Framework for Cross-Architecture Attention Conversion
This work addresses the limitations of existing large language models in long-context and long-generation tasks, which stem from the substantial memory and bandwidth overhead of key-value (KV) cache in attention mechanisms. While more efficient attention architectures have been proposed, they are difficult to integrate into already-trained models without costly retraining. To overcome this, the authors introduce an Attention Editing framework that replaces the original attention mechanism with a learnable target module and employs a progressive distillation strategy to enable cross-architecture transfer—eliminating the need for full pretraining. This approach relaxes prior fine-grained structural constraints between source and target architectures and achieves, for the first time, a general and practical method for attention replacement in large-scale models. The framework successfully deploys MLA and GateSWA on Qwen3-8B and Qwen3-30B-A3B, significantly boosting inference efficiency on Ascend 910B clusters while preserving model performance.