Gated Slot Attention-2: Two-Sided Associative Memory Correction in Linear Attention
Organizations: The Hong Kong University of Science and Technology (Guangzhou) · Tencent
Abstract
Linear attention models have emerged as efficient alternatives to standard attention, but effectively managing their fixed-size recurrent memory remains challenging. To improve memory, recent work has explored two distinct directions: delta-rule variants for precise correction of values associated with keys, and slot-based architectures such as Gated Slot Attention for modeling key and value memories in two stages. We observe that these directions are complementary--the delta rule provides effective memory correction, while the two-stage structure provides a natural way to operate on both sides of an association. Building on this insight, we introduce a new Gated Oja Rule for key-side correction and extend it with decoupled erase and write control to obtain Gated Oja Rule-2. We then introduce Gated Slot Attention-2 (GSA2), which combines Gated Oja Rule-2 for key-side correction with Gated Delta Rule-2 for value-side correction through shared latent slots. We further derive a hardware-efficient chunkwise algorithm for parallel training. Experiments demonstrate that GSA2 consistently improves over strong linear-attention baselines across benchmarks while retaining linear-time sequence modeling and constant-memory recurrent decoding.
Figures & tables
| Model | Real-world Retrieval (2K) | ||||||
|---|---|---|---|---|---|---|---|
| SWDE | SQD | FDA | TQA | NQ | DROP | Avg. | |
| acc | acc | acc | acc | acc | acc | acc | |
| Recurrent models | |||||||
| Mamba-2 ∗ | 17.24 | 32.38 | 14.53 | 58.35 | 18.91 | 19.60 | 26.84 |
| Gated DeltaNet ∗ | 17.90 | 32.67 | 18.52 | 59.60 | 20.16 | 19.69 | 28.09 |
| KDA ∗ | 22.49 | 35.10 | 14.90 | 58.12 | 19.58 | 21.80 | 28.67 |
| Ablation configuration | Language modeling | Common. | RULER | Real-world retrieval | LongBench | ||||
|---|---|---|---|---|---|---|---|---|---|
| Stage 1 | Stage 2 | Wiki. | LMB. | avg | S-NIAH | MK-NIAH | Rem. | avg | avg |
| Coupled | Coupled | 16.22 | 10.29 | 53.25 | 68.2 | 9.9 | 30.0 | 29.60 | 17.1 |
| Decoupled | 16.01 | 10.65 | 52.46 | 68.0 | 10.9 | 24.7 | 31.26 | 14.8 | |
| Decoupled | Coupled | 16.28 | 11.25 | 53.37 | 65.3 | 9.8 | 28.3 | 30.17 | 16.2 |
| Decoupled | 15.69 | 10.68 | 54.08 | 72.8 | 11.4 | 31.8 | 31.51 | 17.3 | |
| Gated Delta Rule-2 in both updates | 15.92 | 10.27 | 53.03 | 72.0 | 13.1 | 29.5 | 29.76 | 16.8 | |
Linear Attention
Linear attention reduces sequence-length costs by replacing pairwise token interactions with kernel features, recurrent states, or compact memory.
See all 129 papers