Log inStart free
LESSON 29.C4 · 6 STAGES · 3 CONTROLS · 3 CHECKSPRO · PREVIEW

Decoding strategies on one prompt

Four decoding strategies write 8 tokens after one prompt, side by side.


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 · 29.C4 · DECODING BAYAFTER “THE” · CAT 0.383 · DOG 0.314
01
Stage 1 of 6 · Next-token chances
Every strategy reads these chances after “the”. “cat” leads with 0.383.
Explain it simply

The bars show the toy model's chances for the next token after the prompt, “the”. “cat” has 0.383 and “dog” has 0.314. All four strategies in the four rows start from this same row. They differ only in how they pick a token from it.

Ten probability bars after the prompt the. Cat 0.383, dog 0.314. Four empty rows of 8 token slots.

prompt, logitsT, filter, draw u, penaltydropped or penalized tokens, repeatsprobabilities, output, log P
step 1, after “the”8 steps after “the”12345678the0.007cat0.383dog0.314sat0.019ran0.019on0.012mat0.141rug0.094and0.007.0.004log P−15−10−5greedy29.19top tokensampling29.20T 1.0 · top-p 0.9penalty29.21presence α 0.5beam search29.22width 2step 1, after “the”8 steps after “the”12345678the0.007cat0.383dog0.314sat0.019ran0.019on0.012mat0.141rug0.094and0.007.0.004log P−15−10−5greedy29.19top tokensampling29.20T 1.0 · top-p 0.9penalty29.21presence α 0.5beam search29.22width 2
Toy: a hand-set bigram model over 10 tokens, prompt “the”, 8 steps
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
pi=ezi∑jezj\sy{p}{out}{p_i} = \frac{e^{\sy{z}{data}{z_i}}}{\sum_j e^{\sy{z}{data}{z_j}}}
p(cat)=e2.0∑jezj=0.383p(\text{cat}) = \frac{e^{2.0}}{\sum_j e^{z_j}} = 0.383

Softmax turns the 10 logits into chances that add to 1.

Common mix-ups

MYTHThe most likely sentence is the best text.

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

Predict, then reveal
3 CHECKS · PRO
Q01If you pick another seed, which rows change?

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.