What Does Predict the Next Token Mean?
What predicting the next token means, how a model picks each piece of its reply, and why that matters for your AI interview.
In short
Predicting the next token means the model scores every token that could come next, picks one, adds it to the text and repeats. That loop writes every reply, and it is one reason a fluent answer can still be false.
10 min readBeginnerVery common · estimateFacts checked 26 November 2026
Say it out loud
Read it once, then say it without looking. Start with the short one; use the long one when they ask you to go deeper.
Predicting the next token means the model's basic job is to look at the text so far, give every possible next token a chance of coming next, and pick one. Training teaches it those chances by guessing next tokens in huge amounts of text. When I explain it to a team, I say the model is good at plausible text and checks no facts on its own, so the product has to check the facts itself.
A language model writes in tokens, which are pieces of words. Before it writes anything, it reads the text so far, which is your prompt plus any reply it has already written. Then it gives every token in its vocabulary a probability, a number from 0 to 1 for how likely that token is to come next. One token is chosen, added to the text, and the whole step runs again.
Training is where those chances come from. The model reads a huge amount of text and learns by guessing the next token, then adjusting itself by how far each guess missed.
The choice rule matters too. Greedy decoding always takes the top token, which is steady but can repeat itself on long text. Sampling rolls by chance, so it is more varied and the same prompt can end differently. Either way, the model only sees what came before, so it cannot go back and change a token it already wrote.
So in an interview, I say it predicts the next token from patterns, with no fact check of its own. A confident reply can still be wrong. For policy or money I put the exact text in front of the model and check its numbers in code.
What does predict the next token mean, in plain words?
A model writes one token at a time. A token is a small piece of text, often a word or part of one.
Each time it writes, it asks one question: given all the text so far, which token comes next? It gives every candidate a probability, which is its chance of being the right next piece, then it chooses one.
Think of a claims handler who has read ten thousand past letters. Shown the first half of a new letter, they can often guess the next line, because they know how such letters usually run. They are guessing from experience, and the policy is not on their desk. A bank support assistant drafting a refund line works the same way.
Key words
- Token
- A small piece of text, often a word or part of a word.
- Vocabulary
- The full list of tokens the model can produce.
- Probability
- A number from 0 to 1 for how likely a token is to come next.
- Context
- The text the model reads before it writes the next token.
- Decoding
- The rule that picks one token from the chances.
Token counts do not match word counts. A long word can be several tokens, and a short one can be a single token.
Where do those chances come from?
Training. The model reads a very large amount of text. Each time, it sees a stretch of text, guesses the token that follows, and is nudged by how far off the guess was. After a very large number of these nudges, its chances are good enough to write fluent text.
“autoregressive language models (such as Claude's underlying model) are pretrained to predict the next word, given the previous context of text in the document.”
Anthropic's glossary
“A model that estimates the probability of a token or sequence of tokens occurring in a longer sequence of tokens.”
Google's glossary
Learn once, then write one token at a time
Learning, done once
Guess the next token
from a huge pile of real text
Nudge the model's numbers
a little, scaled to how far off it was
Writing, every reply
Score every token
a chance for each possible token
Pick one and add it
then scoring starts again
- 1Each guess is checked against the real next token.
- 2The trained numbers are then used to write.
- 3The picked token joins the text, and scoring starts again.
How is the one token picked: greedy or sampling?
The chances are the same either way. Only the choice rule changes. Greedy means always taking the top chance. Sampling means rolling by chance. Hugging Face's Transformers guide defines that rule as a decoding strategy, and describes greedy search and sampling.
- Greedy
Always the top chance
Steady and repeatable. Hugging Face notes it breaks down on longer outputs, where it begins to repeat itself.
- Sampling
Roll by chance
More varied replies, and the same prompt can end differently. Hugging Face says sampling reduces repetition and can be more diverse.
“It selects the next most likely token at each step.”
Hugging Face's guide
“Sampling strategies reduce repetition and can generate more creative and diverse outputs.”
Hugging Face's guide
Here is a made-up bank draft with invented chances. Greedy takes the top token every time. Sampling uses a roll, and two different rolls give two different replies.
# A made-up bank support draft. The chances are invented, not from a real model.
PROMPT = "Under our policy, a disputed card payment is refunded within"
OPTIONS = [(" 10", 0.48), (" 5", 0.22), (" 30", 0.17), (" 14", 0.13)]
def greedy(options):
# Greedy: always take the single most likely token.
return max(options, key=lambda option: option[1])[0]
def sample(options, roll):
# Sampling: a roll between 0 and 1 lands in one token's share of the chances.
running = 0.0
for token, chance in options:
running += chance
if roll < running:
return token
return options[-1][0]
print(PROMPT + greedy(OPTIONS))
print(PROMPT + sample(OPTIONS, 0.60))
print(PROMPT + sample(OPTIONS, 0.93))
print("Chances add up to", round(sum(chance for _, chance in OPTIONS), 2))Output
Under our policy, a disputed card payment is refunded within 10 Under our policy, a disputed card payment is refunded within 5 Under our policy, a disputed card payment is refunded within 14 Chances add up to 1.0
Same chances, two ways to pick
Chances for the next token
10
48% (made-up example)
5
22% (made-up example)
30
17% (made-up example)
14
13% (made-up example)
Greedy: take the top
always 10 in this example
Sampling: roll by chance
10, 5, 30 or 14 by the roll
- 1Greedy always takes the highest chance, which is 10.
- 2Sampling rolls a number, so 5, 14 or 30 can also win.
Greedy gave 10 every time. The roll of 0.60 landed on 5, and the roll of 0.93 landed on 14. Nothing in that draft checks any of the three numbers against the policy. The model only knows which number is likely.
Why does a confident guess still fail?
The model is built to continue text plausibly, and it does not check the facts on its own. Google's glossary defines a hallucination as plausible-seeming but factually incorrect output. What it knows comes from its training and from the text in its context.
It also works left to right. Hugging Face calls this causal language modeling: it predicts each token from the tokens on the left only. So it cannot see what follows, or go back to fix a token it has written.
Tip
Asked how you would stop a wrong number? Say the model picks a likely token, and a likely token is not always a true one. Then give it the source text and check the number in code.
How would you stop a bot from quoting a wrong refund window?
A support bot gave a refund window that is not in the policy. Nothing in the bot checked the number. It scored plausible tokens and picked the likeliest one, so the fix is in what it reads and what the code checks.
- 1
Put the policy text in its context
Give the bot the exact refund section for this card type. The number it is most likely to write is then more likely to match the policy.
- 2
Ask for a source line
Make the bot quote the line it used, so a reviewer can check that line against the policy. Step 3 still checks the number itself.
- 3
Check the number in code
Compare the number with the policy table before a customer sees it. If it does not match, send the question to a person.
What does the interviewer want to hear?
A strong answer covers
- A plain definition: the model scores possible next tokens and picks one.
- Training and writing: the same guess, learned once and then repeated.
- Greedy versus sampling, and what each does to the reply.
- Why a fluent reply can still be false.
- Why left to right matters: it cannot see or revise later text.
- What you do about it: give it the facts and check its output in code.
Common traps
Trap"It looks the answer up, then types it out."
BetterIt scores next tokens from patterns. It looks something up only when a tool you give it does that.
Trap"Predicting the next token always means picking the top one."
BetterOnly greedy decoding always takes the top one. Many systems sample, so the same prompt can give different replies.
Trap"A bigger model stops it guessing."
BetterA bigger model still scores chances. The fix is the facts in its context and a check in code.
Can you spot the guess behind the wrong refund?
Spot the guess
A support bot gave the wrong refund window. Which explanation fits next-token prediction?
Quick check
Which change makes the refund number match the policy?
Can you answer these from memory?
Flash cards · tap a card to flip it
What will they ask next?
Last updated on 26 November 2026
Building a bot that must quote exact policy text?
I design and build AI products and agents, the screens and the system behind them. Book a short call and tell me what your bot must get exactly right.