LESSON 9.07 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW
Multi-query and grouped-query attention
Watch 8 query heads share fewer key and value heads, and the cache shrink.
Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 2 controls and 3 checks, in this lesson and every other.
Go Pro · $8.25/moEXPLAINER · 9.07 · ATTENTION BAY8 QUERY HEADS · TOKEN 6 ASKS
01
Stage 1 of 6 · Query heads
The newest token makes 8 queries, one per attention head. Each query holds 2 numbers.
Explain it simply
On the left, each row is one token. The last token, token 6, is the newest one. It makes 8 queries, one for each attention head. A query is a short list of numbers that says what this head looks for.
6 token rows on the left. The newest token sends a ribbon to each of 8 query heads. Each query head shows 2 numbers.
Weights are random, not trained. Heads next to each other get similar weights.
tokens, queries, keys, valuesKV-head groupsattention, outputschange from MHAslots MHA would use
Toy: 8 query heads of 2 numbers, 6 or 12 tokens
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Each head multiplies the newest token by its own query weights.
PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
- 5 more stages and 2 live controls
- 2 mix-up cards and 3 predict-then-reveal checks
- Watch it as a narrated video, in three voices
- Every Pro lesson and capstone · 656 in total
$99 a year, or $15 a month. Cancel any time.