Learning goal
I can trace two next-token choices and explain how each affects the next prediction.
How it works
A token is a piece of text. Depending on the tokenizer, it can be a word, part of a word, punctuation, or characters that include a space. Many language models assign likelihoods to possible next tokens based on preceding tokens. They may choose a lower-likelihood option and make another prediction using the extended context.
Think of it like this
Think of adding tiles to a sentence. You get a new starting point after each tile. Our tile set uses toy counts and mostly whole words. Real models handle far more pieces and learn many patterns through training.
Worked example
After “The lantern glowed”, the toy list gives softly a count of seven and blue a count of three. Softly leads naturally to “until dawn”. Blue may lead to “but the room stayed dark”. Both paths start with the same context. Their next guesses differ because selecting softly or blue changed the sequence the model works from.
What to remember
Text generation builds a sequence one token at a time. Each new token changes the context for the next one.
- Context“The lantern glowed”
- Toy next-token countssoftly: 7, blue: 3
- Choose softlyLikely next pieces include near and until.
- Choose blueLikely next pieces include but and through.
Key words
- Token
- A piece of text a language model works with, often a word, part of a word, punctuation, or a space together with other characters.
- Language model
- A model that learns patterns in language. Many text-generating language models use earlier text to predict likely next pieces of text.
- Prediction
- A guess based on information, such as guessing how many people will visit a booth next week.
Activity
Build two token paths
Watch context change the next token
The counts are made up, and this activity treats each word as one token. Real models use tokenizers and much larger learned patterns.
- Read contextStart with “The lantern glowed”.
- Compare optionsToy counts favour softly (7) over blue (3). Both remain possible.
- Update contextAfter “softly”, time or place fits. After “blue”, a contrast may fit.
Read the steps
- Read context. Start with “The lantern glowed”.
- Compare options. Toy counts favour softly (7) over blue (3). Both remain possible.
- Update context. After “softly”, time or place fits. After “blue”, a contrast may fit.
Make a choice
Try it on paper
Materials Paper strips or a partner to read the alternatives.
- Write “The lantern glowed” and a two-option list “softly (7), blue (3)”. Start one path with softly and the other with blue.
- For softly, choose near or until and add words that could follow it. For blue, choose but or through and add words that could follow it.
- Compare the answers. Underline the token that changed each path. Split “repaint!” two possible ways, such as “re” + “paint” + “!” or “repaint” + “!”.
Talk it through The toy counts illustrate a preference. They are made up. Real token boundaries depend on how the tokenizer was built.
Quick check
Answer and explanation
It can be a word piece or punctuation. Tokenizers use their own vocabulary of pieces. A single printed word can span multiple tokens.
Answer and explanation
The chosen piece becomes part of the context. The next prediction uses the extended text. It does not need to retrain the model for this step.