Sparse attention

Sparse attention is a family of techniques that let each token in a transformer attend to only a selected subset of other tokens, cutting the cost of processing long sequences.

In standard, or full, self-attention every token is compared with every other token, so the work grows with the square of the sequence length. Sparse attention computes only part of that grid: each token attends to a chosen subset of the others. If the subset is well chosen, the model keeps most of its quality at a fraction of the computing and memory cost.

The arithmetic shows why this matters. A 100,000-token document under full attention needs 10 billion token-to-token scores in every attention head of every layer. If each token instead looks only at a window of 1,000 nearby tokens, that falls to 100 million, a hundredfold saving. The question is what is lost when distant tokens cannot see each other directly.

Early designs used fixed patterns. In April 2019 Rewon Child, Scott Gray, Alec Radford and Ilya Sutskever described Sparse Transformers, which factorised the attention pattern to cut the cost to roughly n times the square root of n and modelled sequences tens of thousands of steps long. Longformer, published in April 2020, combined a local sliding window with a few tokens given global attention and scaled linearly with length. BigBird, from July 2020, also reached linear cost and handled sequences up to eight times longer than was previously possible on similar hardware, keeping a small number of global tokens that see the whole sequence.

Newer methods let the model learn where to look. A February 2025 paper on Native Sparse Attention combined coarse compression of blocks of tokens with fine-grained selection of the most relevant ones, designed it to run efficiently on modern chips and trained it end to end; its authors reported quality matching or beating full attention, with large speedups on 64,000-token sequences. On September 29, 2025 DeepSeek released DeepSeek-V3.2-Exp with what it called DeepSeek Sparse Attention, said benchmarks were on par with its previous model and cut its API prices by more than half.

Sparse attention is a trade. Information that falls outside a token's pattern has to travel indirectly, through other layers or global tokens, and a poorly chosen pattern can miss long-range links. Claims of no quality loss are usually measured on benchmarks the developer picked, so independent long-context tests are the better guide. Note too that sparse attention is a different thing from the sparsity of mixture-of-experts models, which skip parts of the network rather than parts of the attention grid.

Common questions

What is sparse attention in transformers?

Sparse attention is any method in which each token attends to only some of the other tokens instead of all of them. The subset can follow a fixed pattern, such as a local window plus a few global tokens, or be chosen by the model itself. The aim is to make long inputs cheaper to process.

How is sparse attention different from full attention?

Full attention compares every token with every other, so its cost grows with the square of the input length. Sparse attention skips most of those comparisons, bringing the cost closer to linear in length. The price is that some tokens cannot see each other directly in a given layer.

Does sparse attention reduce model quality?

It can, if the pattern drops connections the task needs. Well-designed methods report quality close to or matching full attention, and some trainable methods report better results on certain tests, but those results come mostly from the developers' own benchmarks and are worth checking on long-context evaluations.

What is DeepSeek Sparse Attention?

It is the sparse attention mechanism DeepSeek introduced with its experimental DeepSeek-V3.2-Exp model on September 29, 2025. DeepSeek said it made long-context training and inference faster with minimal effect on output quality, and cut its API prices by more than 50% at the same time.

Finding more

Search for "sparse attention", "Longformer", "BigBird", "Native Sparse Attention" or "efficient transformers survey" to compare methods. The original papers on arXiv describe each pattern and its reported results, and developers' release notes cover what has shipped in production models. Look for independent long-context benchmarks before accepting claims that a sparse method matches full attention.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.