Rafhael Oliveira · IA

The custom tokenizer: why 16 thousand tokens suit this corpus better than 50 thousand, and what the whole table shows

The tax of not being English, the four decisions, and the side effect that was not in the plan.

1 min read· chapter: 7 min· Experiment in progress · chapter updated on 12 Sept 2026

Landed here from LinkedIn? This is chapter 01 of the experiment Antivision · Latent Rehearsal. It reads on its own; if you want the beginning, it is chapter 00.

A 7-million-parameter model used fewer bits than the 124-million GPT-2 in Portuguese. Not because it is better. GPT-2's BPE was trained on 40 GB of English. In English, 'tion' appears a lot and became a token. 'ção' did not. A Portuguese text costs 1.6 times more tokens, and every token costs context, quadratic attention and a serial generation step. We trained a 16-thousand-token tokenizer on our corpus. Running Portuguese dropped 47.6%. Accented Portuguese dropped 73.3%. And then our mini, 17 times smaller, came in below GPT-2 in bits per character in Portuguese. It would be easy to announce that and stop. It would be dishonest.

The three points

  1. Vocabulary 3 times smaller, embedding table 3 times smaller: 12.9 M parameters became 4.2 M in that piece alone.
  2. Split digits cost 58.3% more on text with numbers, and are the choice of Llama, Mistral and Qwen to add better. The benefit in arithmetic has not been measured here yet.
  3. The advantage exists only where the tokenizer charges the difference and vanishes where GPT-2 has corpus. In English, it is a tie. What the table proves is that a badly fitted tokenizer costs more than 17× the parameters.

From the chapter, the beginning

Why 16 thousand tokens suit this corpus better than 50 thousand, what we gain by making numbers worse on purpose, and the side effect that was not in the plan.

GPT-2's BPE was trained on WebText: 40 GB of pages in English. The algorithm, as we saw in the previous course, picks the pieces that appear a lot. In English, tion appears a lot. In Portuguese, ção appeared rarely in that corpus — so it never became a token.

Keep reading chapter 01 →Ler em portuguêsThe PDFs by e-mail →
What the chapter covers · 5 sections · 7 min
  1. The tax you pay for not being English
  2. The four decisions
  3. The result, measured
  4. The side effect that was not in the plan
  5. What was left undone
All chapters of the experiment · Antivision · Latent Rehearsal
  1. 00 · Antivision: an ELLM, a language model that rehearses in latent space before speaking
  2. 01 · The custom tokenizer: why 16 thousand tokens suit this corpus better than 50 thousand, and what the whole table shows
  3. 02 · Two architectures, one file: the fair duel between 2019 and what came after
  4. 03 · The geometry of the embedding: training starts with a perfect space and ruins it
  5. 04 · The lineage of collapse: five answers from computer vision, each measured on text
  6. 05 · The rudder and the world model: three versions of the same question, each measured against the last
  7. 06 · Method and mistakes: the rules of a legitimate comparison and the catalogue of our own errors
  8. 07 · Scale and budget: what it costs to reach GPT-3, and why VRAM is almost never the limit
  9. 08 · The workbench: serve, x-ray and train from the browser
  10. 09 · The hierarchical architecture: the whole project aligned to the four patterns of the world model
  11. 10 · What JEPA is, according to LeCun: two talks read concept by concept, and where each one applies
  12. 11 · Memory and horizon: two claims from LeCun that became experiments, and both hold for text
  13. 12 · Learned costs and inference modes: the three searches and the two sources of energy, measured
  14. 13 · The corrections from LeCun's talks: failure, passage, flag, measurement
  15. 14 · Consulted memory: a bank of abstract states read by attention
  16. 15 · What it costs and what it delivers: us, GPT-1 and GPT-2 on the only ruler valid across tokenizers
  17. 16 · The minimum was off the list: the day I measured my own search by energy
  18. 17 · ELLM: the right name for a language model that predicts in latent space and decides by energy
  19. 18 · Searching better does not fix the energy: three searches, the same text
  20. 19 · The inversion that did not repeat: the world model's cost appears once the ruler stops swinging
  21. 20 · What changed on 17/09: two new chapters and two corrections

Before this: the GPT-2 course

Rafhael Oliveira
Rafhael Oliveira

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 →