Everything a chatbot writes is produced by the same operation repeated over and over: given all the text so far, work out what should come next. That sounds far too simple to produce an essay or a working function, and the gap between how simple it sounds and what it produces is the most interesting part of the subject.
What happens on a single prediction step?
Your text is converted into tokens, which are chunks roughly the size of a short word or part of a longer one. Those tokens pass through the model, and what comes out is not a word but a probability for every token the model knows about, which is typically somewhere between fifty thousand and two hundred thousand possibilities.
Most of those probabilities are effectively zero. A handful are plausible. One is selected, appended to the text, and the entire calculation runs again with that token included. A four hundred word answer is several hundred of these steps.
How does the model decide which token wins?
Not always by picking the most likely one. Always choosing the top candidate produces text that is repetitive and lifeless, so controlled randomness is applied when sampling from the list. That setting is usually exposed as temperature, and it is why the same question produces different wording each time.
What it does not do is choose randomly among sensible options in the way a person might. It samples from a distribution, and if the distribution is wrong, so is the output, with no mechanism anywhere to notice.
Why does that produce coherent paragraphs?
Because the prediction is not based on the last few words. It is based on everything in the context window at once, and the model has learned which earlier parts of the text should influence the current decision. A pronoun in sentence nine can be resolved by a name in sentence one because the mechanism can look directly at it.
Coherence, in other words, is not planned. It falls out of every step being conditioned on the whole passage, so each new token is chosen to fit what has already been written.
What does this explain about the answers you get?
- Why the opening matters. The first sentence conditions everything after it, so a model that starts down a wrong path tends to stay there.
- Why step by step reasoning helps. Working written out becomes part of the input for later steps, giving the model more to condition on.
- Why it cannot revise. Text already produced is fixed. A model cannot go back and change paragraph one after realising something in paragraph four.
- Why format instructions work. Asking for a table makes table-shaped tokens the likely continuation from the first step onwards.
- Why it agrees with you. Text following a confident claim usually agrees with it, and the model reproduces that pattern.
Does the model know what it is going to say?
Not in the sense of holding a plan. There is no outline stored anywhere before generation begins. Research suggests the calculation for one token can carry information relevant to material several tokens ahead, so it is not purely blind, but nothing resembling a drafted structure exists in advance.
This is worth knowing when an answer starts strongly and drifts. Nothing is checking the finished paragraph against the question. Each step was locally plausible, and locally plausible steps can walk a long way from where you wanted to go.
If it is only prediction, why is it any good?
Because predicting text well across a very large body of writing turns out to require a great deal more than surface patterns. To predict the end of a murder mystery you need something that tracks who did what. To predict the next line of a proof you need something that tracks the argument.
Whether the internal structures that result deserve to be called understanding is genuinely disputed. What is not disputed is that they exist, that they were not designed, and that they are why a prediction machine can produce an answer worth reading.
How should this change how you prompt?
Front-load anything important, because early text shapes everything downstream. Ask for reasoning before conclusions rather than after, since a conclusion produced first cannot be revised by working that follows it. And when an answer goes wrong, start a fresh attempt with better framing rather than arguing with a reply that is already conditioning every sentence that comes next.