Chapter 2 of 10All chapters
Chapter 2 of 10
Text generation
Next-token prediction.
How it works
The model estimates which token is likely to come next, picks one, appends it, and repeats. Everything else, including apparent reasoning, emerges from that loop.
- Tokens are word fragments; costs and limits are measured in them.
- The context window is how much text it can consider at once.
Sampling
Temperature and related settings control how adventurously the next token is chosen. Low values give predictable output, high values give variety and more drift.