Why GPT-2 sees neither letters nor words, and what that costs in Portuguese
How text becomes a list of numbers, and why the BPE algorithm won.
Landed here from LinkedIn? This is chapter 01 of the course GPT-1 and GPT-2, taken apart. It reads on its own; if you want the beginning, it is chapter 00.
GPT-2 has never read a word of yours. Not even a letter. It reads pieces. A neural network is a matrix-multiplying machine. Before any intelligence, your text has to become numbers. That translation is not learned: it is a fixed table, decided once and frozen forever. Three generations of researchers tried to answer 'numbers how?'. The first two failed in specific ways. The third won for a reason that explains why GPT-2 writes 'tion' with ease and struggles with 'ção'.
The three points
- Character by character is too long; word by word does not know what to do with a new word. BPE sits in between and learns the pieces that appear often.
- GPT-2's move was BPE over bytes: there is never an unknown token, because everything is a byte.
- GPT-1, GPT-2 and RoBERTa have three different tokenizers, and that changes even what 'perplexity' means between them.
From the chapter, the beginning
How a text becomes a list of numbers — and why the model sees neither letters nor words, but pieces.
A neural network is, at bottom, a matrix-multiplying machine. Matrices are made of numbers. So the first thing that must happen to your text is a translation: letters become numbers. This step is called tokenization, and it happens before the model — it is not learned along with it; it is a fixed table, decided once and frozen forever.
The word token is older than language models, and has other meanings in IT: the credential a server issues after login, such as a JWT; the unit a compiler's lexical analyser splits off, such as a keyword; the asset recorded in a blockchain contract. In this course, a token is always a piece of text — a word, part of a word or a byte — with an integer attached. The course glossary makes this distinction for every term that has more than one meaning.
The question is: numbers for what? There are three historical answers, and understanding why the first two failed is the only way to understand why the third won.
What the chapter covers · 7 sections · 11 min
- Intuition: the model does not read what you write
- How BPE builds the vocabulary
- GPT-2's move: BPE at the byte level
- The math (there is little, but it is what matters)
- GPT-2 vs RoBERTa vs GPT-1: three different tokenizers
- The code, line by line
- In the lab
All chapters of the course · GPT-1 and GPT-2, taken apart
- 00 · The seven fossils: why GPT-1, GPT-2 and RoBERTa are a historical cross-section, not a list
- Glossary · Course glossary: what token, layer and model mean in AI, and in the rest of IT
- 01 · Why GPT-2 sees neither letters nor words, and what that costs in Portuguese
- 02 · Embeddings: from a meaningless integer to a vector that knows king and queen are related
- 03 · Attention: the single operation that replaced twenty years of recurrent networks
- 04 · Twelve heads instead of one, and the single line of code that separates GPT from RoBERTa
- 05 · Why GPT-2 needs 48 floors to answer, and what happens inside each one
- 06 · What scale really buys: from 124 million to 1.5 billion, measured
- 07 · Temperature, top-k and top-p: the decision that changes the text more than switching models
- 08 · Perplexity: the one number that says what the model learned, without anecdotes
- 09 · GPT-1 to GPT-2: same size, half the perplexity. Four decisions explain it
- 10 · RoBERTa: when the advance is training better what already existed
- 11 · Encoder vs decoder: one line of code and every consequence that descends from it
- 12 · The detector: how a language model becomes a classifier, and why this one should decide nothing
- 13 · Reading GPT-2's original code: 174 lines against everything you learned
- 14 · Serving models: from function call to HTTP server, and what production does on top
- 15 · The lab guide: every command, every script, and everything that was measured
- 16 · The ceiling of this path: LeCun's argument, read from inside GPT-2

Writes the GPT-2 course and runs the Antivision experiment, measuring every run before publishing the number. The LinkedIn posts start here and end in the chapters.
Follow on LinkedIn →