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

The LM head, logits and the next-token distribution

Watch one vector become a score for every token, then a probability.


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.01 · LM HEAD BAYPOSITION 5 · THE · h HAS 4 NUMBERS
01
Stage 1 of 6 · The vector h
Each prompt position ends as a vector h of 4 numbers. The head reads h at position 5.
Explain it simply

The chips on the left are the prompt: the cat sat on the mat. A model's layers turn each token into a list of 4 numbers, called h. In this toy, one small layer does that, and it sees one token at a time. The teal cells at the top show h for position 5, the word “the”.

Six prompt chips. Position 5, “the”, has a teal outline. Its vector h is −3.04, 1.42, 1.93, 1.17.

tokens, h, true next tokenhead weightslogits, probabilitieslosstied: the embedding table
prompt1the2cat3sat4on5the6math₅−3.041.421.931.17h5 = W · E[the] = [−3.04, 1.42, 1.93, 1.17]prompt1the2cat3sat4on5the6math₅−3.041.421.931.17h5 = W · E[the] = [−3.04, 1.42, 1.93, 1.17]
Toy: 5.17's model, 8 tokens, width 4
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
ht∈R4\sy{h}{data}{h_t} \in \mathbb{R}^{4}
h5=[−3.04,1.42,1.93,1.17]h_{5} = [-3.04, 1.42, 1.93, 1.17]

h is the vector of 4 numbers at position t.

Common mix-ups

MYTHA logit is a probability.

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

Predict, then reveal
3 CHECKS · PRO
Q01With 0 training steps, is the top probability near 100%, near 50% or near 12%?

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.