arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2611.01940cs.LGcs.DC
收藏

ReWY:Delta规则注意力家族的更快梯度计算

ReWY: Faster Backpropagation for Delta-Rule Attention - From 7 to 3 Matrix Multiplications

Tianjin University(天津大学)

Yi Zhang, Zhixin Zhao, Weiwei Sun, Yitao Hu, Sheng Chen, Keqiu Li

AI总结:

本文针对Delta规则注意力家族反向传播计算冗余问题,提出ReWY代数重构方法,简化了DeltaNet等模型的梯度计算,在GPU和昇腾NPU上实现了显著的反向速度提升。

摘要:

Delta规则线性注意力是Kimi Linear、Qwen3-Next等语言模型的基础。分块实现可暴露矩阵并行性,但其反向传播会计算不必要的辅助伴随矩阵。本文提出ReWY,一种代数重构方法,在优化加速器执行前减少计算量。将分块校正作为单个三角残差系统求导,可消除逆伴随矩阵,并将7个局部WY矩阵乘积减少至3个。两种互补变换可进一步暴露复用:中心化矩阵收缩替代成对向量门处理,标量门缩减复用键-梯度乘积而非形成键格拉姆矩阵。这些恒等式简化了DeltaNet、GDN、KDA和GDN2的反向计算,同时保留精确算术下的递推关系和梯度,且不改变架构或训练目标。我们在GPU和昇腾NPUs上实现了简化计算图。在匹配的重计算和全保存策略下,与冻结FLA基准的精度合格六形状对比显示,NVIDIA GPU上几何平均完整底层反向速度提升1.15-1.81倍;H100和H200上四个算子均实现1.18-1.70倍加速,同时保留原始FP32工作矩阵。在昇腾950DT上的独立自动微分评估(含梯度转换),在可用匹配策略下实现1.09-2.89倍加速。配对消融实验证实优化互补收缩后ReWY的进一步增益;完整梯度检查验证了记录的算子案例,补充全模型反向测量评估了其在社区FLA模型和GDN2层移植中的集成。代码和复现材料:此https URL。

英文摘要:

Delta-rule linear attention underlies language models such as Kimi Linear and Qwen3-Next. Chunkwise implementations expose matrix parallelism, but their backward passes compute unnecessary auxiliary adjoints. We present ReWY, an algebraic reformulation that reduces this work before optimizing accelerator execution. Differentiating the chunk correction as one triangular residual system eliminates the inverse adjoint and reduces seven local WY matrix products to three. Two complementary transformations expose further reuse: centered matrix contractions replace pairwise vector-gate processing, and scalar-gate reductions reuse key-gradient products instead of forming a key Gram matrix. These identities simplify backward computation for DeltaNet, GDN, KDA, and GDN2 while preserving the recurrence and gradients in exact arithmetic, without changing the architecture or training objective. We implement the reduced graph on GPUs and Ascend NPUs. Under matched recomputation and full-saving policies, precision-qualified six-shape comparisons with frozen FLA references yield 1.15-1.81$\times$ geometric-mean complete low-level backward speedups on NVIDIA GPUs. All four operators achieve 1.18-1.70$\times$ on H100 and H200 while retaining original FP32 working matrices. A separate public-autograd evaluation on Ascend 950DT, including gradient conversions, yields 1.09-2.89$\times$ under available matched policies. Paired ablations establish further ReWY gains after optimizing the complementary contractions. Complete-gradient checks validate the recorded operator cases; supplementary full-model backward measurements assess integration into community FLA models and a GDN2 layer port. Code and reproduction materials: https://github.com/flashserve/ReWY.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑