提升线性注意力中三角矩阵求逆速度与稳定性,加速长序列模型推理。
Fast and Stable Triangular Inversion for Delta-Rule Linear Transformers
- 提出高效数值稳定的三角矩阵求逆方法,适配现代硬件加速。
- 在低精度浮点下保持模型精度,实测性能提升最高达4.3倍。
- 适用于需长上下文处理的开源模型如Qwen、RWKV等,适合部署优化。
线性注意力已成为高效长序列架构的核心,已被集成至Qwen3.5/3.6、Kimi Linear和RWKV-7等先进开源模型中。采用Delta-Rule的模型需频繁进行三角矩阵求逆,该操作常成为性能瓶颈,且对数值误差高度敏感,若实现不当会显著降低端到端模型准确率。本文系统分析了直接与迭代求逆算法,聚焦于富含矩阵乘法的方案,以充分发挥现代硬件潜力。研究涵盖数值稳定性、计算复杂度、硬件效率及实际部署考量。通过严格实验验证各类方法在真实场景与低精度浮点表示下的表现,性能基准测试显示,在NPU上相较SGLang最新实现,三角矩阵求逆速度最高提升4.3倍,从而带来整层级别的显著性能提升,同时保证完整端到端模型精度。
原文摘要 · Abstract (English)
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, 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 full end-to-end model accuracy.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。