02 Sparse and compressed attention
Each query looks at a small, chosen part of the context, or at a compressed summary of it, instead of at every token.
VideoThe idea in a few minutes
The problem
Dense attention: every query scores every key, so cost grows with the square of length.
VisualizationDense n × n attention matrix
The idea
Selection (top-k blocks per query) and compression (blocks of keys merged into one entry).
VisualizationSame matrix with selected blocks lit, compressed blocks merged
The trade-off
Cost vs. context length for dense, sparse and compressed variants, and what can be missed.
VisualizationCompute and KV size vs. length
Sources
Papers and model reports.