What a large language model really is: a program that keeps predicting the next word
ChatGPT, Claude and other large language models are, at heart, programs that predict the next word from the text so far. How they write an answer word by word, why the same question gets different answers, and how a chat becomes plain text.
4 min readPart 1 of 21
On this page
Ask ChatGPT or Claude something and the answer appears a little at a time. That isn't a typing animation for show; it's how the answer is produced. OpenAI's explanation says the model will "predict the next most likely word when generating a response, one word at a time", and Anthropic's research post puts it simply: "Claude writes text one word at a time."
That's what a large language model (LLM) is at heart: a program that reads the text so far, works out what the next word should be, adds it, and does it again.
One word at a time
- 1ReadAll the text so far
- 2ScoreA probability for every token it knows
- 3PickOne token, by those probabilities
- 4AppendAdd it to the end of the text
Repeat until it picks the token that means “done”
Strictly speaking, each "word" is a token: an English word, part of a word, a Chinese character, or even a few bytes of one character. Every model has a fixed table of tokens, and at each step it gives every token in that table a probability, then picks one.
Every step is a table of probabilities
OpenAI has published real results in its example code: it asked gpt-4o to output the blue heart emoji and its name, and printed the probability of each token the model chose.
Prompt
Output the blue heart emoji and its name.
Answer, token by token
Here94.72%␣is99.56%␣the100%␣blue99.87%␣heart100%␣emoji100%␣and96.24%␣its100%␣name100%:⏎⏎89.3%F0 9F 9291.35%byte of 💙99100%byte of 💙␣Blue97.63%␣Heart100%
Chance of this exact answer, all tokens multiplied72.19%
Most tokens are close to certain, but the opening "Here" and the line break after the colon less so: the model could have started or broken the line differently. Multiply every step together and the chance of this exact answer is 72.19%. Even for a request this simple, there's more than one way the model might answer.
The other candidates in each table have probabilities too. In the same set of examples, gpt-4o-mini sorted news headlines into categories, and OpenAI printed the top two candidates:
Tech Giant Unveils Latest Smartphone Model with Advanced Photo-Editing Features.
Technology100.0%␣Technology0.0%Local Mayor Launches Initiative to Enhance Urban Public Transport.
Politics100.0%Polit0.0%Tennis Champion Showcases Hidden Talents in Symphony Orchestra Debut
Art97.23%Sports1.39%The first two leave no doubt. For the tennis champion's orchestra debut, the model hesitated between art and sport: Art 97.23%, Sports 1.39%.
Why the same question gets different answers
The model doesn't always take the top candidate; it draws by probability. Likely tokens come up more often, unlikely ones now and then. Once a step draws something different, the rest of the text follows a different path, so the same question can get a different answer each time.
The setting that controls the draw is called temperature. OpenAI's API reference gives a range of 0 to 2 with a default of 1: "Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic." Using the real probabilities from the tennis headline, you can work out exactly what temperature changes:
Lower temperatures widen the gap between first and second place and make answers more consistent; higher temperatures narrow it and make them more varied. In the ChatGPT and Claude chat apps, the provider sets this, not you. Anthropic's documentation also says that Claude 4.7 and later models, and API versions from 2026-10-21 on, no longer support adjusting temperature and the other sampling settings.
A chat is one piece of text
A model does one thing: continue a piece of text. Before a back-and-forth chat reaches the model, it's joined into a single piece of text, with special markers separating the messages and saying who wrote each one:
What you see
Hidden instructions from the developer
How are you
I am doing well!
How are you now?
What the model reads
<|im_start|>system You are ChatGPT, a large language model trained by OpenAI. Answer as concisely as possible. Knowledge cutoff: 2021-09-01 Current date: 2023-03-01<|im_end|> <|im_start|>user How are you<|im_end|> <|im_start|>assistant I am doing well!<|im_end|> <|im_start|>user How are you now?<|im_end|>
To get a reply, <|im_start|>assistant is added at the end, and whatever the model writes next is the answer. OpenAI's description notes that the markers let the model tell which text comes from the developer, which from the user and which from itself.
There's another detail in the example: "Current date: 2023-03-01" in the system message was written in by the developer. The model has no idea what day it is; it "knows" the date because someone put it in the text it reads.
One word at a time isn't thinking one word ahead
Writing word by word sounds like making it up as you go. Research Anthropic published in March 2025 found it isn't that simple. Asked to continue a rhyming couplet:
He saw a carrot and had to grab it,
His hunger was like a starving rabbit
the researchers found that before starting the second line, Claude was already considering on-topic words that rhyme with "grab it", such as rabbit, and then wrote the line to land on it. In another example, asked for the capital of the state where Dallas is, the model first represented "Dallas is in Texas" internally and then connected it to "the capital of Texas is Austin".
Their conclusion: even though models are trained to output one word at a time, they may think on much longer horizons to do so.
Where its knowledge lives
A model's "knowledge" isn't in a database; it's in a very large set of numbers learned during training, called parameters. Take GPT-3, which OpenAI published in 2020: the paper says it has 175 billion parameters in 96 layers, reads up to 2,048 tokens at a time, and was trained on 300 billion tokens in total. Most of today's leading models don't disclose how many parameters they have.
When answering, the model doesn't look anything up; it uses those parameters to work out the most plausible next word, step by step. When it doesn't know the answer, it still has to produce a next word. The same Anthropic research says it plainly: language model training incentivizes hallucination, because models are always supposed to give a guess for the next word.
So text that reads well isn't necessarily right. Facts, figures and sources are worth checking yourself.