RAT+: Train Dense, Infer Sparse -- Recurrence Augmented Attention for Dilated Inference
Organizations: CLAIRE lab at EPFL, Lausanne, Switzerland.
Abstract
Structured dilated attention has an appealing inference-time efficiency knob: it reduces the FLOPs of attention and the KV cache size by a factor of the dilation size D, while preserving long-range connectivity. While prior work studies it by training each configuration from scratch, directly sparsifying a pretrained attention model into a dilated pattern leads to severe accuracy degradation, preventing flexible reuse across inference scenarios. We introduce RAT+, a dense-pretraining architecture that augments attention with full-sequence recurrence and active recurrence learning. A single RAT+ model is pretrained densely once and can then be flexibly switched at inference time to dilated attention (optionally with local windows) or hybrid layer/head compositions, requiring only a short 1B-token resolution adaptation rather than retraining separate sparse models. At 1.5B parameters trained on 100B tokens, RAT+ closely matches dense accuracy at D = 16, and drops by about 2-3 points at D = 64 on commonsense reasoning and LongBench tasks. We further scale to 2.6B and 7.6B parameters and observe even more promising performance (e.g., a 1-point average accuracy loss with a 64x reduction in attention FLOPs and KV cache size). Code is available at https://github.com/wimh966/rat-plus.
Figures & tables
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
| SFT models | NIAH-S-1 | NIAH-S-2 | NIAH-S-3 | NIAH-MK-1 | NIAH-MK-2 | NIAH-MK-3 | NIAH-MV | NIAH-MQ |
|---|---|---|---|---|---|---|---|---|
| 100 | 100 | 100 | 100 | 100 | 99.6 | 99.85 | 100 | |
| 100 | 100 | 99.2 | 100 | 99.2 | 96 | 99.8 | 99.8 | |
| 100 | 100 | 97.8 | 99.8 | 97.4 | 88.8 | 99.75 | 99.5 | |
| 100 | 100 | 96 | 99.8 | 96.4 | 73.8 | 99.4 | 99.15 | |
| 100 | 100 | 89.2 | 99.6 | 95.2 | 54.6 | 99.3 | 98.15 | |
| 100 | 100 | 78.8 | 99.2 | 78 | 40.4 | 97.35 | 96.35 |
| Quest top-k | NIAH-S-1 | NIAH-S-2 | NIAH-S-3 | NIAH-MK-1 | NIAH-MK-2 | NIAH-MK-3 | NIAH-MV | NIAH-MQ |
| attention | ||||||||
| , All | 100 | 100 | 99.8 | 100 | 100 | 99.6 | 100 | 99.9 |
| , | 100 | 99.8 | 99.4 | 99.6 | 71.2 | 5.4 | 93.95 | 94.25 |
| , | 100 | 100 | 100 | 100 | 99.6 | 85.2 | 99.9 | 99.6 |
| , | 100 | 100 | 85.8 | 98.4 | 20.6 | 0.2 | 87.55 | 88.55 |
| , | 100 | 100 | 99 | 99.8 | 63.2 | 15.2 | 97.45 | 96.85 |
| MoBA top-k | NIAH-S-1 | NIAH-S-2 | NIAH-S-3 | NIAH-MK-1 | NIAH-MK-2 | NIAH-MK-3 | NIAH-MV | NIAH-MQ |
| attention | ||||||||
| , All | 100 | 100 | 99.8 | 100 | 100 | 99.6 | 100 | 99.9 |
| , | 100 | 91 | 56 | 84 | 65.2 | 6.2 | 48.1 | 55.9 |
| , | 100 | 99.8 | 96.2 | 99.6 | 97.8 | 77 | 95.35 | 96.45 |
| , | 90.2 | 66.8 | 20 | 54.2 | 29.8 | 5.8 | 30.1 | 34.55 |
| , | 99.2 | 95.8 | 79 | 91.8 | 66.2 | 22.6 | 70.7 | 76.35 |
LLM Inference Acceleration
LLM inference acceleration develops algorithms and systems that reduce language-model latency, memory use, and serving cost while preserving output quality.
See all 1,084 papers