ReWY: Faster Gradient Computation for Delta-Rule Attention Family

Yi Zhang, Zhixin Zhao, Weiwei Sun, Yitao Hu, Sheng Chen +1 more
11/1/2026
cs.LGcs.DC

Official code: flashserve/ReWY (4 stars, Python, MIT, last commit 2026-11-03).

Abstract

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.

Show full abstract

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.

View on arXivView PDF

Code Implementations(1)

flashserve/ReWYOfficial100%
MIT

Faster Gradient Computation for Delta-Rule Attention Family

40Python, AGS ScriptNov 1, 20264 weeks agoMIT
delta-rule-attentiongdngdn2kdalinear-attention

Similar Papers

Cite this paper

@article{zhang2026rewy,
  title  = {ReWY: Faster Gradient Computation for Delta-Rule Attention Family},
  author = {Yi Zhang and Zhixin Zhao and Weiwei Sun and Yitao Hu and Sheng Chen and Keqiu Li},
  year   = {2026},
  eprint = {2611.01940},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2611.01940v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2611.01940.svg)](https://codeofpaper.com/paper/2611.01940)

Discussion