快速且稳定的三角矩阵求逆用于Delta规则线性变换器
Fast and Stable Triangular Inversion for Delta-Rule Linear Transformers
AI总结:
本文研究了Delta规则线性变换器中快速且稳定的三角矩阵求逆方法,通过分析直接和迭代算法,探讨了矩阵乘法丰富的算法在现代硬件上的高效利用,实验验证了不同方法在低精度浮点表示下的性能和稳定性,实现了三角矩阵求逆的4.3倍加速,从而提升整个层级性能并保持端到端模型精度。
摘要:
线性注意力机制已成为高效长上下文架构的核心,如Qwen3.5/3.6、Kimi Linear和RWKV-7等先进开源模型均整合了该机制。包含线性注意力层的Delta规则模型涉及三角矩阵求逆作为核心子过程。该操作常成为性能瓶颈,且由于对数值误差高度敏感,若未正确实现,会显著降低端到端模型精度。本文系统分析了直接和迭代三角矩阵求逆算法,针对矩阵乘法丰富的算法,从而可能高效利用现代硬件。为此,我们的分析涵盖了广泛的数学和实际方面,重点在于数值稳定性、计算复杂度以及最终的硬件效率和实际考虑。我们提供了严谨的实验评估以验证这些属性在实际场景中的表现,并在低精度浮点表示下突出每种方法的优势和局限性。在NPUs上的性能基准测试显示,三角矩阵求逆的实现相比SGLang的最新实现快达4.3倍,从而在整个层级上实现显著的性能提升,同时保持完整的端到端模型精度。
英文摘要:
Linear attention has emerged as a cornerstone for efficient long-context architectures, as evidenced by its integration into state-of-the-art open-source models including Qwen3.5/3.6, Kimi Linear/K3, and RWKV-7. Models that incorporate linear attention layers with the so-called Delta-Rule involve the inversion of triangular matrices as a core sub-routine. This operation often forms a performance bottleneck, and, due to its high-sensitivity to numerical errors, it can significantly deteriorate end-to-end model accuracy if it is not carefully implemented. This work provides a systematic analysis of both direct and iterative triangular inversion algorithms, targeting methods that are rich in matrix products, and, therefore, have the potential to efficiently utilize modern hardware. To that end, our analysis covers a broad spectrum of mathematical and practical aspects, with a heavy focus on numerical stability, computational complexity, and, ultimately, hardware efficiency and practical considerations. We provide a rigorous experimental evaluation to verify these properties in practical scenarios, and in low-precision floating-point representations, highlighting the strengths and limitations of each method. Performance benchmarks on NPUs reveal up to $4.3\times$ speed-up against the state-of-the-art implementations of SGLang for triangular matrix inversion, leading to significant performance improvements on the entire layer level, while maintaining end-to-end model accuracy.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。