NeurIPS 2026QuestionsPapersAreasAboutMarkdown

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, Zhijiang Guo

NeurIPS page · OpenReview · alphaXiv · Open on the map

Category: Efficient LLM Inference & Training › Efficient Attention Mechanisms · Type: new method · Keywords: attention sparsification, sparse attention, context ranking, FlashAttention, memory efficiency

Areas: LLM Reasoning › Efficient Reasoning › Sparse Attention; Long Context › Long-context mechanisms › Efficient attention

Summary

SAS introduces a gated sparse attention mechanism that optimizes context ranking end-to-end with the language modeling loss, improving accuracy under limited attention budgets.

Explained to a 5-year-old

A big computer brain reads words and needs to remember many other words to understand each one. Looking at all those words uses a lot of memory and time. The paper creates a new way to pick only the most helpful words to look at. It teaches the brain which words matter while it is learning, so the brain gets better at using less memory. This helps the brain work faster and use less space.

Explained to a 5-year-old, longer

A big computer brain reads words and needs to understand each word by looking at many other words around it. Looking at all those words takes a lot of memory and makes the brain slow. The paper comes up with a new trick to choose only the most helpful words to look at. Instead of just picking the top few words based on old scores, the new trick lets the brain learn which words are truly important while it is being trained. This way the brain can focus its attention on the words that matter most for understanding. The new method keeps all words active during training so each word can give feedback. It uses a special way to mix the scores with the brain's normal thinking, making the learning smoother. The designers also made a fast computer program that does this without using too much memory. As a result, the brain can work faster and use less memory, especially when there are many words. This helps the brain be more efficient for tasks like translating, answering questions, or generating text. The improvement is especially noticeable when the brain is limited in how many words it can look at at once. Overall, the new approach makes the brain smarter about picking the right words while staying economical with resources.

For a technical reader

SAS proposes a gated sparse attention mechanism that directly optimizes the ranking of context units with the language modeling loss, bypassing the need for distillation from dense attention. By injecting continuous selector scores into the attention logits inside the softmax (in log space) and keeping all context units active during training, gradients flow from the downstream task to the selector. A memory-efficient Triton kernel implements this design in a FlashAttention-style computation, avoiding the prohibitive overhead of materializing the full attention matrix for long sequences. The result is a more effective sparsification that consistently outperforms existing trainable methods across attention budgets, especially under tight constraints.

Problem

Existing trainable attention sparsification methods rely on a lightweight selector that scores context units and then applies a hard Top-K selection, which blocks gradients from the language modeling loss. Consequently, the selector is trained to mimic dense attention distributions rather than to rank context units according to their true impact on model predictions under a fixed attention budget, leading to suboptimal use of the budget.

Method

The approach injects the selector's continuous scores into the attention logits during training, allowing the language modeling loss to update the selector via standard backpropagation. It places the gate inside the attention softmax in log form, keeps all context units active during training, and preserves continuous selector scores to learn relative priorities. A memory-efficient Triton kernel implements this design in a FlashAttention-style computation to avoid prohibitive memory overhead.

Results

The approach achieves higher accuracy than existing trainable sparse-attention methods across a range of attention budgets, with particularly large gains when the budget is tight, showing more effective context ranking for downstream tasks.

Contributions

The paper identifies the ranking misalignment in prior sparsification methods and proposes a gated sparse attention mechanism that optimizes context ranking end-to-end with the language modeling loss. It also provides a memory-efficient implementation that integrates the design into FlashAttention-style computation.

Research questions this paper is counted under

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction