Slide 1 / 2 Keys: ← / → / Space
01 / 02 · Representation & Geometry

From Words to Tokens & Meaning Space

LLMs cannot read letters or raw ID numbers — they convert text chunks into vectors where distance equals meaning.

Prompt: "The cat sat on the ___"
1. Slice Text into Tokens Tokenizer
The#464 cat#3797 sat#3332 on#319 the#262
Words can split into subword chunks: "unbelievable" → un·believ·able
2. Why Token IDs Are Not Enough 0 Meaning
cat → #3797
Target word
mat → #3798
Adjacent ID, unrelated!
kitten → #28412
Far ID, close meaning!
3. Lookup Embedding Vector (#3797 → 4,096+ dims) Meaning
Living creature?
+0.92
Domestic / pet?
+0.84
Action / verb?
-0.45
Edible food?
-0.78
kitten
≈ cat
rocket
≠ cat

Embedding Space: Geometry = Meaning

Pets Home Wild Space
Living / Creature → ← Object / Concept Domestic / Home ↑ Wild / Distant ↓ θ = 7° +young +young dist = 1.0 Close = Similar dist = 5.6 (170°) Far = Unrelated cat kitten dog puppy mat rug sofa tiger wolf rocket planet
Why Embeddings? Geometry turns word meaning into math: nearby points share meaning, and parallel arrows (cat→kitten ≈ dog→puppy) encode relationships.
LLM Intuition · Slide 1 of 2 Words → Tokens → IDs → Meaning Space
02 / 02 · Inside the Transformer & Prediction

How the LLM Turns Context into Next-Token Probabilities

Attention blends earlier word vectors into a single context vector, then Softmax scores every token in the vocabulary.

Output: Probability Distribution
Autoregressive Loop: Append "mat" → feed sequence back in → predict next! 1. TOKEN EMBEDDINGS 2. SELF- ATTENTION Which earlier words shape what follows "the"? The cat sat on the + "mat" Picked (54%) 18% 42% 34% 6% Transformer Layers mix weighted embeddings across N layers → updating context meaning 3. FINAL CONTEXT VECTOR "Cozy home surface where a pet rests" [-0.85, +0.88, -0.52, +0.72, ...] Compare vs 50,000+ words 4. NEXT-TOKEN PROBABILITIES Softmax normalizes scores to 100% "mat" 54% "rug" 26% "floor" 11% "sofa" 6% "rocket" 0.01%