Narration · Module 21
Tokens
0:00 / 0:00
Module 21 · Representation · 10 min

Tokenization, in detail.

BPE, byte-level BPE, sentencepiece. The cost trade-offs that show up at scale.

Reading time10 min Audionarration available PrerequisitesNone SourceTrack A · Gemini
§ 1

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.

§ 2

The lesson itself.

Interactive lesson · ported from Gemini track Click tabs to navigate · hover cards for details

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.

1. Raw Text Input
2. Subword Tokens (BPE)
3. Vector Embeddings (Lookup Table)

Each discrete Token ID looks up a dense row of floats representing semantic meaning. (Showing 8 of 4096 dimensions).

§ DEMO

Try it: tokenizer playground.

BPE in action. Type a sentence and see the byte-per-token cost for each piece.

Tokenizer Playground · interactiveOpen standalone
§ PAPERS

Further reading.

The canonical references for this module. External links open in a new tab.

§ NEXT

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.