What is sparse attention?

Definition

Sparse attention is an attention pattern that limits which token pairs interact. Instead of computing every possible relationship in a sequence, the model uses local windows, selected global tokens, learned routing or another structured subset.

Reducing the number of comparisons can lower memory use and serving cost, especially for long contexts or media generation. The tradeoff is that a poorly chosen sparse pattern may miss important distant information, so designs must preserve the connections needed by the task.

ELI5

Sparse attention lets a model focus on selected parts of a long input instead of comparing every part with every other part. This reduces the amount of work and memory the model needs.

For example, when reading a long book, a model might focus mainly on nearby sentences plus a few important chapter markers. That can be faster, but a poor selection could cause it to miss a clue from a distant chapter.

How does sparse attention improve efficiency?

It computes fewer token-to-token relationships than full attention. This can reduce memory and processing requirements as the input sequence grows.

Does sparse attention reduce model quality?

It can if the pattern excludes useful information. Well-designed methods preserve important local and global connections while avoiding many low-value comparisons.

  1. The words Open Models Surge beside a rising three-bar graphic
    The Week Open Models Closed the Gap
    AI Search43m 53s1 VIEW
  2. Olive Song in glasses and a plain blue top against black beside the white and blue headline NATIVE MULTIMODAL AI.
  3. K谩roly Zsolnai-Feh茅r beside the words Qwen Flash Gets Smarter
  4. Memory Hungry - Compute Light beside a flat memory stack feeding sparse compute nodes
  5. K谩roly Zsolnai-Feh茅r beside the words Powerful AI Gets Cheaper
Definition card for sparse attention: What is sparse attention?

Sparse attention reduces transformer computation by allowing each token to attend to a selected subset of other tokens instead of comparing with every token.