LESSON 9.05 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW
Multi-head attention
Watch one attention layer split into heads that each look at different tokens.
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.05 · ATTENTION BAYX 6 × 4 · 48 WEIGHTS MAKE Q, K, V
01
Stage 1 of 6 · Three projections
Each token vector x holds 4 numbers. Three weight matrices turn it into a query, a key and a value.
Explain it simply
Each row on the left is one word, stored as 4 numbers. Three small grids of weights turn each row into three new rows. The query says what a word looks for. The key says what a word offers, and the value is what it passes on.
Six token rows of 4 numbers. Three 4 by 4 weight matrices make the Q, K and V blocks of 6 rows by 4 columns. The query token is "a".
x, Q, K, Vweight matricesattention, outputhead
Toy: 6 tokens · width 4 · 1, 2 or 4 heads · random weights, not trained
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Each weight matrix maps a token vector to 4 new numbers.
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.