Efficient Attention
The Workshop · Model ArchitecturesAttention variants that scale better with length (sparse, linear, latent).
Also called: linear attention, sparse attention, sliding window attention, multi-head latent attention, MLA, flashattention, flash attention, hybrid attention, deepseek sparse attention. In the glossary.
How it works, as a machineThe Long Chamber · queries
Follow one query from a question at the millionth token to an answer that found its block, in a council chamber whose gallery seats a million keys.
- Open the key blocks
- Score the blocks
- Pick the top blocks
- Look at picked blocks
- Fold into the state
Efficient Attention in plain words
Efficient attention is a family of changes that make a transformer cheaper on long inputs. Standard attention compares every token with every other one, so its cost grows with the square of the length. These variants look only at nearby, selected or summarised tokens, trading some precision for reach.
An analogy
A town meeting that has outgrown its hall. Letting every resident talk with every other takes forever once there are ten thousand. So each street sends a delegate, or people speak only to their neighbours, and the meeting ends before midnight with some detail lost.