6 of 42
ContentsPart I · Chapter 2

Chapter 2How does it work?

Tokens

Models read tokens, which are word-pieces. Tokens are what fill the context window, and what usage is counted in.

Tokens. Text is chopped into word-pieces called tokens; each becomes a number.1 (Try it below.)

Tokenizer playground

Illustration: simplified splitter, not a real tokenizer

A simplified splitter written for this page, to show the idea. Real tokenizers learn their pieces from data,1 and each company's splits text differently, so real counts will differ.

Go deeper
  • Georgia Tech's Transformer Explainer runs a real small model (GPT-2) in your browser.2
  • Scaling laws: prediction error falls predictably as models, data and computing grow,3 and model size and training data should grow together.4
Notes (4)
  1. 1Rico Sennrich, Barry Haddow, and Alexandra Birch, “Neural Machine Translation of Rare Words with Subword Units,” in Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) (2016), 1715–1725, https://doi.org/10.18653/v1/P16-1162.
  2. 2Aeree Cho, Grace C. Kim, Alexander Karpekov, Alec Helbling, Zijie J. Wang, Seongmin Lee, Benjamin Hoover, and Duen Horng (Polo) Chau, “TRANSFORMER EXPLAINER: Interactive Learning of Text-Generative Models,” Proceedings of the AAAI Conference on Artificial Intelligence 39, no. 28 (April 11, 2025): 29625–29627, https://doi.org/10.1609/aaai.v39i28.35347.
  3. 3Jared Kaplan, Sam McCandlish, Tom Henighan, Tom B. Brown, Benjamin Chess, Rewon Child, Scott Gray, Alec Radford, Jeffrey Wu, and Dario Amodei, “Scaling Laws for Neural Language Models” (preprint, arXiv, January 23, 2020), https://doi.org/10.48550/arXiv.2001.08361.
  4. 4Jordan Hoffmann, Sebastian Borgeaud, Arthur Mensch, Elena Buchatskaya, Trevor Cai, Eliza Rutherford, Diego de Las Casas, et al., “Training Compute-Optimal Large Language Models,” in Advances in Neural Information Processing Systems 35 (2022), 30016–30030, https://doi.org/10.52202/068431-2176.

Chapter 2 · page 2 of 3

Turn pages with the ← and → keys.

Cite this page

Using this book

© 2026 Steve Sparks. All rights reserved. You're welcome to quote short passages and cite any page, with a link back. To reuse diagrams or larger parts, ask through GitHub.

Quoted material and figures from other sources remain their owners'.