LESSON 9.04 · 6 STAGES · 2 CONTROLS · 3 CHECKSPRO · PREVIEW
Self-attention vs cross-attention
See where the queries, keys and values come from in two kinds of attention.
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.04 · ATTENTION BAY6 ENGLISH · 4 FRENCH TOKENS
01
Stage 1 of 6 · Two sentences
The encoder holds 6 English tokens. The decoder has written 4 French tokens so far.
Explain it simply
This is a translation model at work. On top, the encoder holds the English sentence: the black cat drinks warm milk. Below, the decoder writes French, one token at a time. Each token is 4 numbers, and a stronger shade is a bigger size. A minus sign marks a number well below zero.
Two blocks of rows. The top block has 6 English tokens: the, black, cat, drinks, warm, milk. The bottom block has 4 French tokens: le, chat, noir, boit. Each row has 4 cells.
Weights are set by hand, not trained.
tokens, queries, keys, valuesweight matrices Wattention weights, outputsmasked
Toy: 6 English and up to 7 French tokens, width 4
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
Each sentence is a stack of token rows, 4 numbers wide.
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.