/ module 02 · Foundations
Tokens
Models don't read characters, instead they read tokens. A tokenizer splits your text into chunks and maps each chunk to an integer ID. The choice of tokenizer changes everything downstream: vocabulary size, sequence length, even bias.
- Explain what a token is and why models need them
- Compare character, word and subword (BPE) tokenizers
- Predict why emoji, code and other languages cost more tokens
Try this first: Switch to GPT-4o mode and type your name in two languages.
concept
Why tokens?
Neural networks operate on numbers. Tokenization is the bridge from text to integer IDs the model can embed and process. The most common modern approach is Byte-Pair Encoding (BPE), which learns frequent subword chunks like tion, ing, or the.
Trade-offs: character-level tokenizers have tiny vocabularies but long sequences. Word-level tokenizers have huge vocabularies and can't handle new words. BPE sits in the middle. The three teaching modes are simplified; the GPT modes run the exact tokenizers OpenAI models use, right in your browser.
IDs in teaching modes are made up. Pick a GPT mode for true IDs.
Bigger, newer vocabularies usually need fewer tokens for the same text, especially for code and non-English languages, which makes those models cheaper and lets more fit in the context.
Check yourself
Tick each one you could explain to a friend. If you can't yet, scroll back up and replay the lab.