Zenaique

Match each sparse attention pattern to its design and exemplar architecture.

Match pairs·Hard·4.0 · 0·~2 min·Asked atCoinbaseLakeraQdrant
Attempt it

Drag each answer to line up with its matching prompt

Sliding window

Each token attends to W nearby tokens, local context only. Used in Mistral 7B (window=4096).

Dilated attention

Tokens grouped into blocks; intra block dense + cross-block sparse. Used in some GPT-3 ablations.

Global + local (BigBird style)

Skip-N pattern, attend to every Nth token over medium range. Used in Longformer.

Block sparse

Most tokens attend locally; a few designated 'global' tokens see and are seen by everyone, enabling long range info flow.

TL;DR

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.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

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.

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

Sparse attention is a family of structured masks on the n × n score matrix. The structure is chosen so the kernel computes only a subset of the entries, dropping the asymptotic cost while keeping enough connectivity for the model to remain expressive at sequence lengths dense attention cannot afford.

The four families split by the geometry of the mask. A diagonal band gives sliding window. A strided band gives dilated. A band plus a few full rows and columns gives the global plus local pattern. Chunks with sparse cross-chunk links give block sparse. The sections below walk each family along with its canonical exemplar architecture, distinguish sparse exact patterns from kernel approximations, then place the whole family inside the modern long context stack.

Sliding window: the diagonal band

Sliding window attention lets each query see W keys around it, producing a banded mask. Per-layer compute is O(n · W), linear in n, and the kernel is hardware-friendly because the band aligns with contiguous memory access.

Information propagates L · W tokens across L stacked layers; with Mistral 7B's W = 4096 and 32 layers, the theoretical reach is 131k positions. The catch is fidelity: information squeezes through intermediate tokens' residual streams at each hop, so distant relationships are weakly represented even when reach in principle is sufficient.

Mistral 7B with W = 4096 is the canonical modern decoder example, and the pattern continues in Mistral Large 3. Longformer uses sliding window as the local component of its heads, alongside dilated and global heads.

Dilated: the strided band
Global plus local: the broadcast bus
Block sparse: chunked geometry
Sparse exact vs kernel approximation
The modern long context stack
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
PatternGeometrySingle layer reachExemplar
Sliding windowDiagonal band, width WW tokensMistral 7B (W=4096)
DilatedStrided bandW × strideLongformer dilated heads
Global + localBand + a few full rows/colsEffectively n (via globals)BigBird, Longformer
Block sparseDense blocks + sparse cross-blockn via cross-block patternSparse 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.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QWhy does BigBird need global tokens in addition to sliding window?
A

Pure sliding window attention can only propagate information across L × W tokens in L layers. For a 4096-token document with W=512 and L=12 layers, that's 6144, covered. For longer or more globally interactive tasks, you need a shortcut. Global tokens provide that: any local token reaches any other in 2 hops through a global one, regardless of distance.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

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.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Geometry of each pattern: band, strided band, band with globals, blocks

  • Exemplar architectures: Mistral sliding window, Longformer, BigBird, Sparse Transformer

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
Explain scaled dot product attention.
Short answer·Medium