Full text not available for this paper

Summary (Overview)

  • Problem: Gated-delta linear attention layers (GDN, KDA, GDN-2) are tuned for GPUs and map poorly onto Google TPUs, which use wide 256×256 systolic matrix units with a much slower vector unit (~128× throughput gap vs. ~15× on H100).
  • Solution: Systolic Linear Attention (SLA) reshapes gated delta attention around the TPU's matrix unit via three key changes: (1) widening keys to 256 dimensions and sharing keys and write gates across grouped value heads (R× fewer chunk solves), (2) grouping decay gates into four 64-channel tiles, and (3) fusing exact FP32 block-doubling chunk inversion and backward reuse inside one on-chip VMEM kernel.
  • Performance: SLA-R4 runs 2.1×–2.6× faster than open-source MaxText KDA and 1.4×–2.4× faster than Tokamax KDA on TPU v7x, while using 49%–61% less temporary HBM.
  • Quality: Across a 2,048-chip TPU v7x pre-training study of MoE models (6.5B–63.1B parameters), SLA trains 11%–24% faster than MaxText KDA, matches KDA perplexity on paired seeds at 12.5B, and stays within 3% at other scales.
  • Extrapolation: Without clamping decay gates, SLA extrapolates from 8K training to 32K–64K context far better than unclamped KDA.

Introduction and Theoretical Foundation

Background

Linear attention removes the quadratic compute and KV cache of softmax attention by storing context in a fixed-size state matrix St∈Rdk×dvS_t \in \mathbb{R}^{d_k \times d_v}, updated at each token tt with key kt∈Rdkk_t \in \mathbb{R}^{d_k} and value vt∈Rdvv_t \in \mathbb{R}^{d_v}:

St=St−1+ktvt⊤S_t = S_{t-1} + k_t v_t^\top

Because this sum grows without bound, gated models add a data-dependent forget (decay) gate Ft∈(0,1]dk×dkF_t \in (0,1]^{d_k \times d_k}:

St=FtSt−1+ktvt⊤S_t = F_t S_{t-1} + k_t v_t^\top

Evolution of Gated Delta Attention

DeltaNet introduced the delta rule with unit-norm key ktk_t (∥kt∥2=1\|k_t\|_2 = 1), scalar write gate βt\beta_t, and identity IdkI_{d_k}:

St=(Idk−βtktkt⊤)St−1+βtktvt⊤S_t = (I_{d_k} - \beta_t k_t k_t^\top) S_{t-1} + \beta_t k_t v_t^\top

Gated DeltaNet (GDN) combines decay with the delta rule, using one scalar decay γt∈(0,1]\gamma_t \in (0,1] per head (G=1G=1):

Ft=γtIdk,βt=σ(β~t)∈(0,1)F_t = \gamma_t I_{d_k}, \quad \beta_t = \sigma(\tilde{\beta}_t) \in (0,1)

Kimi Delta Attention (KDA) expands GDN's scalar forget gate into a per-channel diagonal gate (G=dkG = d_k):

Ft=diag(ft),ft∈(0,1]dkF_t = \text{diag}(f_t), \quad f_t \in (0,1]^{d_k}

GDN-2 retains per-channel decay and replaces scalar βt\beta_t with separate channel-wise erase and write gates.

Three Hardware Bottlenecks on TPUs

  1. Narrow states and fixed per-step scan cost: A 128-wide state leaves half of each 256×256 MXU tile's key axis padded, while paying full per-step cost for every head. Each scan step costs ≈12μs regardless of chunk size.

  2. Per-channel decay: KDA/GDN-2 kernels must rescale keys elementwise in 16-token sub-blocks to avoid FP32 overflow. GPUs absorb this vector work cheaply; on TPUs where matrix:vector throughput is ~128×, it stalls the kernel.

  3. Per-value-head chunk solves: Independent write gates per value head force HvH_v solves per chunk, with unfused HBM round-trips. Ops 3–5 account for ~45% of core stateless KDA time.


Methodology

SLA Recurrence (Definition 2.1)

SLA uses HvH_v value heads of width dvd_v and Hk=Hv/RH_k = H_v/R query-key heads of width dk=256d_k = 256, where each query-key head is shared across R∈{2,4}R \in \{2, 4\} value heads:

  • Shared query, key, write gate: L2-normalized qt,kt∈R256q_t, k_t \in \mathbb{R}^{256} with ∥qt∥2=∥kt∥2=1\|q_t\|_2 = \|k_t\|_2 = 1, and scalar step size βt=2σ(β~t)∈(0,2)\beta_t = 2\sigma(\tilde{\beta}_t) \in (0,2)
  • Packed values: RR value vectors stacked as vt=[vt,1;…;vt,R]∈RDv,packv_t = [v_{t,1}; \ldots; v_{t,R}] \in \mathbb{R}^{D_{v,\text{pack}}}
  • Four-tile forget gate: Block-diagonal gate splitting 256 channels into G=4G=4 contiguous tiles of b=64b=64 channels:
Ft=diag(γt,1164,γt,2164,γt,3164,γt,4164)F_t = \text{diag}(\gamma_{t,1}\mathbf{1}_{64}, \gamma_{t,2}\mathbf{1}_{64}, \gamma_{t,3}\mathbf{1}_{64}, \gamma_{t,4}\mathbf{1}_{64})

Token-level recurrence:

St=FtSt−1+βtkt(vt−(FtSt−1)⊤kt)⊤S_t = F_t S_{t-1} + \beta_t k_t \left(v_t - (F_t S_{t-1})^\top k_t\right)^\top ot,m=σ(zt,m)⊙RMSNorm(St,m⊤qt)o_{t,m} = \sigma(z_{t,m}) \odot \text{RMSNorm}\left(S_{t,m}^\top q_t\right)

Three Algorithmic Pillars

1. Wide Keys and Shared βt\beta_t Across Grouped Value Heads

SLA widens keys to dk=256d_k = 256 and shares both each key head and the scalar write gate βt∈(0,2)\beta_t \in (0,2) across R∈{2,4}R \in \{2,4\} value heads. This packs value heads into full 256×RdvRd_v MXU tiles and cuts chunk solves by R×R\times (2.45×–3.28× faster core forward, 1.87×–2.48× faster full-layer F+B).

2. Tile-Grouped Forget Gate

SLA splits 256 key channels into 4 tiles of 64 channels, each with one scalar decay rate. Intra-chunk scores become four 64-wide MXU matmuls scaled by decay masks, with no VPU rescaling. This middle point between GDN's single rate (G=1G=1) and KDA's per-channel rate (G=dkG=d_k) runs at near-scalar single-kernel VMEM speed while lowering perplexity over G=1G=1.

3. Fused VMEM Exact Inversion with Backward Reuse

SLA fuses R×R\times-fewer exact FP32 recursive block-doubling solves and custom-VJP backward reuse inside one VMEM kernel, with a chunk-size-independent conditioning bound (Theorem 2.3). Exact FP32 block-doubling holds 10−710^{-7} accuracy through C=256C=256 while adding only 4.0%–7.7% to full-LM step time.

Chunkwise WY Parallelization

The chunkwise WY algorithm partitions the sequence into T/CT/C contiguous chunks. Within chunk cc starting from boundary state Sc−1S_{c-1}, the chunk writes satisfy:

Ec=diag(βc)(IC+Mc)−1(Vc−KˉcSc−1)E_c = \text{diag}(\beta_c) (I_C + M_c)^{-1} (V_c - \bar{K}_c S_{c-1})

where McM_c is the strictly lower-triangular Gram matrix of decayed key overlaps, and Ac=(IC+Mc)−1A_c = (I_C + M_c)^{-1} is computed via exact FP32 block-doubling.


Empirical Validation / Results

Kernel and Layer Performance

Table 1: SLA vs. KDA at a glance on TPU v7x

BenchmarkKDASLASLA vs. KDA
Full layer, 32K fwd+bwd (2-stage; MaxText/Tokamax)48.7/42.4 ms20.2 ms2.4×/2.1× faster
Temporary HBM, 32K layer9.1/9.3 GiB3.7 GiB60%/61% less
131K prefill, 32-layer hybrid (Exact Inv., BF16)2.66 s1.62 s1.64× faster
MoE training throughput, 6.5B–63.1B (vs. MaxText KDA)1.00×1.11×–1.24×11%–24% faster
12.5B equal-chip-h PPL vs. Tokamax (42.7 chip-h, n=3)19.5219.15 [19.11]−0.37 [−0.41] (3/3 seeds)
63.1B equal-chip-h PPL vs. Tokamax (37.3 chip-h, n=3)26.5625.08 [25.14]−1.48 [−1.41] (3/3 seeds)
12.5B iso-token PPL vs. MaxText (60.4B tok, n=3)15.6015.58−0.02 (within noise)
63.1B iso-token PPL vs. MaxText (120.8B tok, n=1)12.6012.45−0.15
64K HotpotQA, 12.5B, no clamping50.3%77.9%+27.6 pts

Pre-training Results

  • 2,048-chip TPU v7x study: MoE models from 6.5B to 63.1B nominal parameters. SLA trains 11%–24% faster than MaxText KDA (4%–21% faster than Tokamax KDA).
  • Equal-chip-hour comparisons (64-chip slices, n=3 paired seeds): 1-kernel fused SLA-R4 lowers perplexity on all 3/3 seeds at both 12.5B (−0.37 ± 0.11) and 63.1B (−1.48 ± 0.21).
  • Fused SLA-R4 + GDN-2 hybrid: Also beats safe-clipped Tokamax KDA on all 3/3 seeds at both scales (−0.41 ± 0.35 at 12.5B, −1.41 ± 0.16 at 63.1B).
  • G=4G=4 outperforms scalar G=1G=1 across 6/6 paired 12.5B MoE and dense-LM seeds.

Hardware Specifications

Table 2: Documented hardware specifications per chip

AcceleratorCoresArray TileBF16 TF/s8-bit TF/sVPU TF/sMXU:VPUHBM (GB)HBM GB/sRidge
H100 SXM132 SM16×169891,97967.014.8×803,350295
TPU v42128×1282752753.285.9×321,200229
TPU v5p2128×1284599185.485.0×952,765166
TPU v6e1256×2569181,8367.2127.5×321,600574
TPU v7x2256×2562,3074,61418.0128.2×1927,373313

Ablation Breakdown

The speedup against open-source Tokamax KDA decomposes into:

  • 1.28×–1.41× from 4:1 head packing
  • 1.10×–1.12× from VMEM fusion
  • 1.07×–1.20× from G=4G=4 tile grouping

Theoretical and Practical Implications

Theoretical Contributions

  • Conditioning guarantee: Theorem 2.3 proves a chunk-size-independent conditioning bound for SLA's exact FP32 block-doubling inversion.
  • Chunk-boundary momentum: SLA offers an optional Schur-guarded momentum mode with μc≤(1−φc)/(1+φc)\mu_c \leq (1-\varphi_c)/(1+\varphi_c) for unconditional chunk-to-chunk stability, though μ=0\mu=0 is the recommended default.
  • Step-size extension: SLA adopts βt=2σ(β~t)∈(0,2)\beta_t = 2\sigma(\tilde{\beta}_t) \in (0,2), widening the eigenvalue range of Idk−βtktkt⊤I_{d_k} - \beta_t k_t k_t^\top to (−1,1)(-1, 1).

Practical Implications

  • Hardware-aware architecture design: SLA demonstrates that co-designing attention architectures around specific hardware (TPU systolic arrays) can yield substantial gains over simply optimizing kernels for existing GPU-tuned architectures.
  • Memory efficiency: 49%–61% reduction in temporary HBM usage enables longer sequences and larger models on the same hardware.
  • Long-context extrapolation: Without clamping decay gates, SLA extrapolates from 8K training to 32K–64K context far better than unclamped KDA, achieving 77.9% vs. 50.3% on 64K HotpotQA.
  • Complementary to richer update rules: SLA is best understood as a hardware-efficient operating point complementary to richer update rules such as GDN-2; combining them (fused SLA-R4 + GDN-2) yields the best equal-chip-hour results.

Conclusion

SLA demonstrates that reshaping gated delta attention around the TPU's 256×256 systolic matrix unit—rather than merely porting GPU-tuned kernels—yields substantial improvements in both speed (2.1×–2.8× faster than open-source KDA implementations) and memory efficiency (49%–61% less temporary HBM), while maintaining or improving model quality across scales from 6.5B to 63.1B parameters.

Key design choices—wide 256-dimensional keys with shared write gates across grouped value heads, four-tile grouped decay gates, and fused exact FP32 block-doubling chunk inversion with backward reuse inside a single VMEM kernel—directly address the three TPU-specific bottlenecks of narrow states, per-channel decay rescaling, and per-value-head chunk solves.

Future directions include:

  • Exploring the SPD-SLA-W extension with chunk preconditioning for whitened keys
  • Further combinations with richer update rules like GDN-2
  • Application of the tile-grouped decay principle to other linear attention variants
  • Extension to other systolic-array accelerators beyond TPUs

The paper positions SLA as a hardware-efficient operating point complementary to more expressive update rules, with the caveat that unclamped per-channel decay in KDA exhibits slow-channel long-context drift that SLA's tile-grouped decay naturally avoids.

Related papers