Match each sparse attention pattern to its design and exemplar architecture.
Sparse attention patterns differ in which slice of the n × n grid they compute: diagonal band, strided band, band plus VIP tokens, or block structured.
Picture a huge grid asking, for each word, which other words it should look at. The standard kernel fills the whole grid. Sparse attention keeps most of the grid blank to save effort, and different designs pick different shapes to keep. A narrow band along the diagonal lets each word peek at nearby neighbors only, like reading with a small window. A strided band skips some neighbors but reaches further. A band plus a few full rows treats a handful of words as VIP guests everyone gets to talk to. Chunked patterns slice the sequence into groups and only check inside each group plus a few cross-links. Same idea everywhere, different geometry.
Detailed answer & concept explanation~6 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
Walk each pattern with geometry, per-layer reach, and exemplar; explain BigBird's universal approximator motivation for global tokens; discuss why frontier LLMs use FlashAttention + ring + YaRN instead of heavy sparsity now.
| Pattern | Geometry | Single layer reach | Exemplar |
|---|---|---|---|
| Sliding window | Diagonal band, width W | W tokens | Mistral 7B (W=4096) |
| Dilated | Strided band | W × stride | Longformer dilated heads |
| Global + local | Band + a few full rows/cols | Effectively n (via globals) | BigBird, Longformer |
| Block sparse | Dense blocks + sparse cross-block | n via cross-block pattern | Sparse Transformer, GPT-3 ablations |
Real products, models, and research that use this idea.
- Mistral Large 3 and the wider Mistral lineage continue to use sliding window attention (W around 4096) as a structural choice through 2026.
- Longformer combines sliding window local plus dilated heads plus global tokens for documents up to 4096 tokens.
- BigBird combines sliding window plus global plus random attention; designed for genomics and long documents.
- OpenAI Sparse Transformer used factorized block sparse patterns; later GPT-class ablations adapted this.
- Modern frontier models such as Llama 4 Maverick, Claude Opus 4.7, and Gemini 3.1 Pro generally favor exact attention plus FlashAttention plus position scaling over heavy sparsity for long context serving.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does BigBird need global tokens in addition to sliding window?
QWhy aren't modern frontier LLMs heavily sparse?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Conflating 'sparse attention' with 'efficient attention', sparse attention is one family (approximate, fewer pairs computed); FlashAttention is exact (same pairs, different I/O). They're different layers of the stack.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.