Orthros 注意力机制实现线性预填充与全注意力解码
Orthros: Phase-Aware Heterogeneous Attention for Efficient Transformers
一篇讲新注意力架构的论文,预填充快 21.9 倍还能保持 128K 长上下文召回,做长文本推理的可以看看
Orthros 是一种新型注意力机制,将效率思路从结构分配转向按阶段解耦。它在序列处理的不同阶段动态切换计算模式,预填充阶段采用线性复杂度,解码阶段使用全注意力。实验显示,相比标准 Transformer,Orthros 取得 21.9 倍预填充加速,并通过近乎满分的 128K needle-in-a-haystack 测试保持长上下文能力。该模块还支持数据高效的 Transformer-to-Orthros 转换,转换后性能可超过原始 Transformer。
Orthros: Phase-Aware Heterogeneous Attention for Efficient Transformers
Efficient attention mechanisms, such as linear and sliding window attention, aim to reduce the computational complexity of Transformers from quadratic to linear. However, their degraded in-context recall often necessitates interleaving full attention layers, leaving the quadratic bottleneck unresolved in long-context processing. To address this, we introduce Orthros attention, which shifts the efficiency paradigm from structural allocation to phase-aware decoupling. As a unified module, it dynamically switches its computation pattern across different phases of sequence processing, enabling linear complexity prefilling and full attention decoding. Our design grants Orthros attention a lower asymptotic complexity compared to vanilla Transformers in prevalent long-context scenarios characterized by heavy prefilling and light decoding. Beyond theoretical formulation and complexity analysis, extensive empirical evaluations demonstrate Orthros's superiority across multiple dimensions. First, we validate its fundamental language modeling capabilities, demonstrating scalability across varying model sizes and strong competitiveness in comprehensive architectural comparisons. Second, Orthros exhibits exceptional conversion feasibility via a data-efficient Transformer-to-Orthros conversion, yielding performance that even surpasses the original Transformer. Finally, Orthros achieves a $21.9\times$ prefilling speedup over Transformers with end-to-end inference gains, while preserving long-context capabilities, as demonstrated by near-perfect 128K needle-in-a-haystack results and Transformer-level performance on real-world in-context recall tasks. Overall, these advantages in high performance, flexibility, and efficiency position Orthros as a promising candidate to succeed the Transformer in industrial applications.