2025-10-09 · 进阶 · 机器学习

Native Hybrid Attention for Efficient Sequence Modeling

该论文提出了一种名为Native Hybrid Attention (NHA)的新型混合架构,结合了线性注意力和全注意力,旨在提高序列模型的效率和准确性。

更新于 2025-10-09。作者:Jusen Du、Jiaxi Hu、Tao Zhang、Weigao Sun、Yu Cheng。

中文摘要

变压器在序列建模方面表现出色,但面临二次复杂度,而线性注意力提供了改进的效率,但往往在长上下文中牺牲了召回准确性。在这项工作中,我们引入了原生混合注意力(NHA),这是一种新颖的线性与全注意力混合架构,将层内和层间混合集成到统一的层设计中。NHA通过线性RNN更新关键值槽中的长期上下文,并使用滑动窗口中的短期标记进行增强。然后对所有键和值应用单个softmax注意力操作,实现每个标记和每个头的上下文相关加权,而无需额外的融合参数。层间行为通过单个超参数控制,即滑动窗口大小,它允许在纯线性注意力和全注意力之间平滑调整,同时保持所有层在结构上保持一致。实验结果表明,NHA在召回密集型和常识推理任务上优于变压器和其他混合基线。此外,预训练的大型语言模型可以与NHA结构化混合,在保持竞争力的准确率的同时,实现显著的效率提升。代码可在https://github.com/JusenD/NHA获取。

英文摘要

Transformers excel at sequence modeling but face quadratic complexity, while linear attention offers improved efficiency but often compromises recall accuracy over long contexts. In this work, we introduce Native Hybrid Attention (NHA), a novel hybrid architecture of linear and full attention that integrates both intra \& inter-layer hybridization into a unified layer design. NHA maintains long-term context in key-value slots updated by a linear RNN, and augments them with short-term tokens from a sliding window. A single softmax attention operation is then applied over all keys and values, enabling per-token and per-head context-dependent weighting without requiring additional fusion parameters. The inter-layer behavior is controlled through a single hyperparameter, the sliding window size, which allows smooth adjustment between purely linear and full attention while keeping all layers structurally uniform. Experimental results show that NHA surpasses Transformers and other hybrid baselines on recall-intensive and commonsense reasoning tasks. Furthermore, pretrained LLMs can be structurally hybridized with NHA, achieving competitive accuracy while delivering significant efficiency gains. Code is available at https://github.com/JusenD/NHA.

解读

一句话总结

该论文提出了一种名为Native Hybrid Attention (NHA)的新型混合架构,结合了线性注意力和全注意力,旨在提高序列模型的效率和准确性。

问题1:这篇论文想要解决什么具体问题?

问题2:论文的核心创新点是什么?

问题3:实验结果如何验证了方法的有效性?

问题4:这个研究的实际应用价值是什么?

来源

机器可读索引:llms.txt