05 · Reference notes
← All visual guidesDeepSeek Sparse Attention Explained
DeepSeek Sparse Attention uses a lightweight learned indexer to shortlist relevant tokens before applying expensive attention to the selected subset.
01 · Definition
What is DeepSeek Sparse Attention?
The design keeps a view of the full context without paying full-attention cost for every token pair. It separates finding promising evidence from doing the richer attention computation over that evidence.
02 · Mechanism
Why sparse selection is useful
At very long contexts, most earlier tokens are not equally relevant to the current prediction. Full attention still scores them all. DSA uses a cheaper mechanism to search broadly, then concentrates expensive attention on a small token-level shortlist.
03 · Mechanism
The lightning indexer
A learned lightweight indexer ranks the prior context for a query. Its job is retrieval, not the final attention output: it identifies which token positions are promising enough to receive the main model's more detailed calculation.
04 · Mechanism
Exact tokens instead of coarse blocks
Relevant evidence may be scattered across a document. Selecting individual tokens lets DSA collect a focused set from distant locations rather than reading every token in a large contiguous window.
05 · Mechanism
The quality-cost trade-off
The top-k selection budget controls the trade-off. A larger shortlist improves the chance of retaining useful evidence but increases computation and memory traffic. The central challenge is teaching the indexer to keep the tokens the main attention layer will need.
Source · Original paper