Log inStart free
LESSON 10.03 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Autoregressive generation

Watch a model write text one token at a time and read each one back.


Pro lesson. Stage 1 is free to watch. Pro opens all 6 stages, 3 controls and 3 checks, in this lesson and every other.

Go Pro · $8.25/mo
EXPLAINER · 10.03 · GENERATION BAYPROMPT 2 TOKENS · READS 2
01
Stage 1 of 6 · Read the prompt
The prompt is "the cat". The model reads its last 2 tokens.
Explain it simply

The prompt is the text the model starts from. The box around the last 2 tokens shows what the model reads. This toy reads 1 or 2 tokens. A real transformer reads the whole text so far.

The prompt tokens the cat sit in a row. A box marks the last 2 tokens, and a ribbon runs into the model box.

tokens readmodel and passesprobabilities and new tokensreading window
h = W·x(t) + W₂·x(t−1)z = E·h, p = softmax(z)4.490.43−2.872.10hreads 2the1cat2the promptthe model reads “the cat”h = W·x(t) + W₂·x(t−1)z = E·h, p = softmax(z)4.490.43−2.872.10hreads 2the1cat2the promptthe model reads “the cat”
Toy: the 8-token model of 5.17 and 10.01, trained on 4 sentences; 10 new tokens
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
h=W xt+W2 xt−1\sy{h}{data}{h} = \sy{w}{param}{W}\,\sy{x}{data}{x_t} + \sy{w}{param}{W_2}\,\sy{x}{data}{x_{t-1}}
xt=E[cat],  xt−1=E[the]\sy{x}{data}{x_t} = E[\text{cat}],\; \sy{x}{data}{x_{t-1}} = E[\text{the}]

The vector h comes from the last 2 tokens.

Common mix-ups

MYTHThe model writes the whole answer in one pass.

The fix, and 1 more mix-up with the diagram to show them, come with Pro.

Predict, then reveal
3 CHECKS · PRO
Q01From "the cat" with 2 tokens read, does seed 7 write the same text as seed 3?

Make your guess, then test it in the diagram. All 3 checks come with Pro.

PRO LESSON · YOU WATCHED STAGE 1 OF 6
Unlock the full explainer
  • 5 more stages and 3 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.