Part I · Prediction
Ch 0. The guessing game
Finish this sentence
The cat sat on the ___
You probably thought of a word straight away. Maybe mat, maybe floor. Before reading on, try it below, and see how your guess compares with a real large language modellarge language model (LLM): A program trained on a lot of text to predict the next piece of text. Ch 0.
A machine that plays the guessing game
In 1951, Claude Shannon played this game with people, one letter at a time, to measure how predictable English is. Very, it turned out.[1]
In 1951, Claude Shannon ran an experiment that looks a lot like this one. He showed people the start of a passage and asked them to guess the next letter, again and again, and used how well they did to measure how predictable written English is. The answer: very.[1][1]
The model above, GPT-2 small, plays the same game. It doesn’t commit to one answer: it gives every possible next word a chance, and spreads its bets across floor, bed, couch, and many more.
A large language model plays the same game. The model above is GPT-2 small, which OpenAI released in 2019.[2][2][3][3] It read the words The cat sat on the and gave every possible continuation a chance. Notice that it doesn’t commit to one answer. It spreads its bets: floor, bed, and couch are all likely, and no single option gets even one chance in ten.
Chances, written down
The game has an exact form. Write a text as tokens : the chunks GPT-2 really reads, which Ch 4 explains. For each place , the model gives the chance of token given every token before it, written . The chance of a whole text is those chances multiplied together:
where means multiplying, for every place from 1 to .[2] The product shrinks fast. After The cat sat on the, floor gets 7.6%, and a comma after floor gets 26%, so the model’s favorite two-token continuation has a chance of only about 2%.
Spreading its bets is normal. Here the 50 likeliest next tokens add up to only about 64%; the other 50,207 share the rest. Shannon measured that spread as entropy, in bits:
where is the chance of outcome . One bit is one fair yes-or-no question; a choice between eight equally likely outcomes is 3 bits.[4] From his guessing experiments, Shannon estimated that printed English carries about one bit per letter, given the 100 letters before it.[1]
Over and over
One guess is only one word. To write a sentence, the model adds its pick to the end of the text and plays the game again with the longer text. Step through the first few rounds:
That’s the whole trick, repeated: guess, pick, add, repeat. Everything else in this site explains how the guessing works, and how much can be built on top of it.
Recipe card
Recap
- A large language model is a machine that predicts the next piece of text.
- It doesn’t pick one answer. It gives every possible continuation a probability.
- To write more, it adds a pick to the text and predicts again, over and over.
- The chance of a whole text is each token’s chance, given the ones before it, multiplied together.
Next question: you used everything you know about English to make your guess. What’s the simplest way a program could make the same guess?
Sources
- Claude E. Shannon (1951). Prediction and Entropy of Printed English. Bell System Technical Journal 30(1).
Sources
- Claude E. Shannon (1951). Prediction and Entropy of Printed English. Bell System Technical Journal 30(1).
- Alec Radford et al. (2019). Language Models are Unsupervised Multitask Learners. OpenAI.
- OpenAI and Hugging Face (2019). GPT-2 model card (openai-community/gpt2). Hugging Face. Accessed October 23, 2026.
Sources
- Claude E. Shannon (1951). Prediction and Entropy of Printed English. Bell System Technical Journal 30(1).
- Alec Radford et al. (2019). Language Models are Unsupervised Multitask Learners. OpenAI.
- OpenAI and Hugging Face (2019). GPT-2 model card (openai-community/gpt2). Hugging Face. Accessed October 23, 2026.
- Claude E. Shannon (1948). A Mathematical Theory of Communication. Bell System Technical Journal 27(3).