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

Embeddings and weight tying

Watch one table turn token IDs into vectors, then score the next token.


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 · 5.17 · EMBEDDING BAY6 TOKENS · VOCAB 8 · CAT = ID 1
01
Stage 1 of 6 · Tokens to IDs
The prompt has 6 tokens. Cat has ID 1, its row in a vocabulary of 8 tokens.
Explain it simply

A model can't read words, so the text is first split into tokens. Each token gets an ID, its row number in the vocabulary on the left. The prompt the cat sat on the mat becomes six IDs. An ID is only a name tag, and it says nothing about meaning.

Six token chips read the cat sat on the mat, with IDs 0, 1, 2, 3, 0 and 4. The vocabulary list marks cat, ID 1.

tokens and vectorsweightsprobabilities, cosinelosssame table again
0the1cat2sat3on4mat5ran6rug7dogthe0cat1sat2on3the0mat4prompt → token IDsIDtokencat → ID 10the1cat2sat3on4mat5ran6rug7dogthe0cat1sat2on3the0mat4prompt → token IDsIDtokencat → ID 1
Toy: 8 tokens, 4 numbers per row, 1000 steps
STAGE 1 / 6
MATH · STAGE 1HOVER A SYMBOL OR A SHAPE
token  →  id∈{0,…,7}\text{token} \;\to\; \sy{id}{data}{\text{id}} \in \{0, \dots, 7\}
cat→1\text{cat} \to 1

Each token maps to one whole number, its ID.

Common mix-ups

MYTHA token's ID number carries its meaning.

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

Predict, then reveal
3 CHECKS · PRO
Q01With random weights, do the cat and dog rows stay alike?

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.