What this lesson covers.
This module is one of 42 in the curriculum. Below is the canonical interactive lesson — tabs, cards, and diagrams from the source repo, rendered inside the course shell. An audio narration runs alongside it - the sticky player at the top of the page plays the full Module 21 clip.
If you prefer to read first and play with the demos after, the interactive lesson sits below this section. If you'd rather hear it narrated while you scroll, hit play on the sticky audio bar at the top — or just let it autoplay.
Read / reason / test
Count pieces, not words
High school · build the intuition
A tokenizer turns text into vocabulary identifiers. One word can become several pieces, and spaces or punctuation can matter. Two tokenizers can split the same sentence differently without changing the sentence itself. The resulting count measures model input positions, not the number of ideas. Use the actual model’s tokenizer when estimating a context limit rather than assuming one English word equals one token.
College · work the example
In an invented vocabulary, rainfall becomes [rain, fall]; another stores [rainfall]. If an input has 100 positions instead of 80, a dense attention score matrix grows from 6,400 to 10,000 entries per head. That ratio,1.5625, is not a total-runtime prediction. Vocabulary size can shorten sequences while enlarging the embedding table, and other operations still contribute to cost.
Explain it back
Describe the process in your own words. Identify the assumption that makes this example work, then explain one conclusion it cannot establish.
Read the primary source or official documentation →
The numerical examples are authored teaching exercises, not measured model benchmarks. This extension adds context to the original lesson.
The lesson itself.
Layer 0: The Token Pipeline
Before a neural network can process text, the language must be converted into math. Enter any sentence below to watch how Byte-Pair Encoding (BPE) shatters text into numeric tokens, and how the Embedding Table projects those integers into massive floating-point vectors.
Each discrete Token ID looks up a dense row of floats representing semantic meaning. (Showing 8 of 4096 dimensions).
Try it: tokenizer playground.
BPE in action. Type a sentence and see the byte-per-token cost for each piece.
Further reading.
The canonical references for this module. External links open in a new tab.
What to read next.
Use the pager below to move sequentially through the curriculum, or jump to any module from the course index. Each track has a "Prereq: ↑ foundation" callout so you can backfill anything that wasn't clear.