SAS: Simple Attention Sparsification via End-to-End Optimization of Context Ranking
Zhiwei Li, Lei Zhu, Hao Gu, Xiang Hu, Yan Wang, Haitao Mi, Sirui Han, Leo Liang and 1 others
Tencent HY LLM Frontier · Hong Kong University of Science and Technology (Guangzhou) · Hong Kong University of Science and Technology
Published September 11, 2026 · on the feed September 14, 2026 · ▲ 65 · arXiv 2609.13141
The abstract
Post-training attention sparsification reduces the quadratic cumulative attention cost of pretrained Transformers by selecting a small set of context units (tokens or blocks) for each query. Existing trainable methods usually use a lightweight selector to score context units, followed by hard Top-K selection that blocks gradients from the language modeling loss. Consequently, these methods commonly distill layer-wise dense attention distributions. Although this encourages the selector to rank context units by dense attention weights in the original model, the ranking is not directly aligned with their impact on predictions under a fixed attention budget (i.e., the number of attended context units per query), potentially wasting the limited budget on less useful units. To address this misalignment, we propose Simple Attention Sparsification (SAS), a gated sparse attention mechanism that optimizes context ranking end-to-end with the language modeling loss. The key idea is to inject the selector's continuous scores into attention logits during training, allowing the loss to update the selector through standard backpropagation. We identify several choices crucial for this simple design to work well in practice: placing the gate inside the attention softmax in log form, using normalized softmax gates to calibrate historical context against the always-retained current block, and preserving continuous selector scores so the model learns relative priorities rather than only hard selections. To support long-sequence training, we implement a memory-efficient Triton kernel that integrates SAS into FlashAttention-style computation. Across reasoning, long-context understanding, and agentic tasks, SAS consistently outperforms trainable sparse attention baselines across attention budgets, with especially large gains under tight budgets, demonstrating more effective context ranking for downstream tasks.
The Brief
3:18A short podcast summary of the paper. Written and voiced by AI.
Transcript
SAS. Simple Attention Sparsification via End-to-End Optimization of Context Ranking. By Zhiwei Li and eight others, from Tencent HY LLM Frontier, the Hong Kong University of Science and Technology, Guangzhou, and one other institution. Published on the eleventh of September. Its code repository is worked out: about forty source files, with a readme.
Post-training attention sparsification reduces the quadratic cumulative cost of attention in a pretrained Transformer, by having each query attend to a small set of context units, either tokens or blocks. Existing trainable methods usually score those units with a lightweight selector, then apply a hard Top-K selection. That hard step blocks gradients from the language modeling loss, so these methods commonly distill dense attention distributions, layer by layer, instead. The selector cannot learn from the loss the model actually cares about, so it is given a stand-in target: copy where the full, dense attention would have looked.
The trouble lies in what the distillation teaches. The selector learns to rank context units by their dense attention weights in the original model. Under a fixed attention budget, meaning a fixed number of attended units per query, that ranking is not directly aligned with how much each unit affects the predictions. Some of a limited budget can end up spent on units that help less.
Simple Attention Sparsification, or SAS, is a gated sparse attention mechanism that optimizes context ranking end-to-end, with the language modeling loss itself. The key idea is to inject the selector's continuous scores into the attention logits during training. The loss can then update the selector through standard backpropagation. Nothing exotic is needed to get a gradient through: the scores become part of the attention computation itself, so the ordinary training signal reaches them the same way it reaches every other weight in the model.
Several choices turn out to be crucial for this simple design to work well in practice. The gate is placed inside the attention softmax, in log form. The gates are normalized softmax gates, which calibrate historical context against the current block, a block that is always retained. And the selector's scores are kept continuous, so the model learns relative priorities rather than only hard selections.
To support training on long sequences, the authors implement a memory-efficient Triton kernel that integrates SAS into FlashAttention-style computation. A method aimed at long contexts has to be trainable on long contexts, and the kernel is what makes that practical.
Across reasoning, long-context understanding and agentic tasks, SAS consistently outperforms trainable sparse attention baselines across attention budgets. The gains are especially large when budgets are tight, which the authors take as evidence of more effective context ranking for downstream tasks. That pattern fits the diagnosis. When only a few units can be attended, spending one of them on a less useful unit costs the most, so a better ranking should show its value most clearly there.
The simplicity in the name is about what the selector answers to. Instead of a layer-wise distillation target, it answers to the same loss as the model. The fix is to stop asking the selector to imitate the dense model, and start letting the loss train it. Once the scores carry gradient, the ranking is shaped by what improves predictions under the budget, which is the thing a sparse model is finally judged on.
Paper Quest · 7 chapters · about 41 min
Play this paper
Learn it by doing: make the calls the authors made, guess the result before you see it, and defend it in a viva graded on your own words. Chapter 1 is right here.
Chapter 1 🧩 · The problem
Long contexts are expensive, and the part that chooses what to read cannot learn from the loss. That is the wall.
You are making a pretrained language model cheaper on long inputs. Each query may look at only a small budget of context blocks: a small scorer rates the blocks, then a hard cut keeps the top few.
The road ahead
- 1 · The problem ~7 min A small scorer picks which context blocks each query may read, but its hard cut blocks the training loss, so it is taught a stand-in target instead.
- 2 · What came before ~3 min
- 3 · The key idea ~9 min During training, put the selector's scores into the attention logits as gates, so the ordinary language modeling loss can train the selector directly.
- 4 · Choose your own research ~3 min
- 5 · Build the method ~8 min Score blocks, turn the scores into gates inside the attention logits, train the selector with the language modeling loss, then keep only top-ranked blocks.
- 6 · The experiment ~6 min You’ll guess: Across attention budgets, where were SAS's gains over trainable sparse attention baselines largest?
- 7 · The viva ~5 min Three questions from the examiners, answered in your own words. Win it for the paper’s trophy.
Free, with Google or an email address. Your stars and progress are kept.