AI systems6 min read

ChatGPT does not know. It predicts.

There is no fact table inside a language model. There is a function that guesses the next small piece of text, run over and over, and that turns out to be enough.

The situation
Ask for the capital of France and you get Paris, so it feels like something inside looked the answer up.
The call
Drop the lookup model. What runs is next-token prediction: context in, a probability distribution out, one token chosen, repeat.
The cost
Plausible and true are different targets, and only the first one is trained for. Hallucination is not a defect bolted onto that design, it is the price of it.

Know this already? skip to why it hallucinates

Ask ChatGPT what the capital of France is and you get "Paris". It feels like there must be a lookup in there somewhere. A table, an index, a fact store, something holding a row that says France → Paris.

There isn't. There is no fact table, and there is no small reader inside the model thinking "they want the capital of France, and I know it is Paris."

What the model does is narrower than that, and stranger: it estimates which token should come next. That is the entire training objective. Everything else, the code it writes and the languages it translates and the arguments it constructs, comes out of doing that one thing extremely well.

What actually happens when you send a prompt

your prompt, as texttokenstext ends, numbers beginembeddingstransformer layerslogits, one score per possible tokenprobabilitiesone token chosenappended to the context

A pipeline, not a chain of attempts. Nothing here falls through to the next rung.

One pass through the model produces exactly one token

Read that top to bottom. Text goes in, and immediately stops being text. Below the dashed line there are no words anywhere in the system, only vectors, matrices and scores. At the bottom, one token comes out. One. To produce a paragraph, the whole ladder runs again for every token in it.

From text to numbers

A tokenizer splits your text into tokens first. A token is usually a few characters rather than a word, so ChatGPT is amazing might arrive as four pieces: Chat, GPT, is, amazing. Where exactly the splits fall depends on the tokenizer.

Each token then becomes an embedding, a list of numbers positioned so that things with related meanings sit near each other. Nobody wrote those positions by hand. They were learned, by making a prediction, measuring how wrong it was, nudging the parameters, and repeating that billions of times.

This is the part that surprises people: the relationships are not stored as facts anywhere. They are spread across billions of numbers. The model did not memorise that Paris is the capital of France so much as become a machine whose output leans very hard towards Paris when the context leans that way.

Scoring every token in the vocabulary

After the transformer layers have done their work, using attention to work out which earlier parts of your prompt bear on which, the final layer produces one score for every token in the vocabulary. Tens of thousands of scores, every single pass. These are the logits.

Logits are not probabilities yet. softmax turns them into a probability distribution, which is where numbers like this come from:

Paris92 %London1 %Berlin1 %Rome1 %banana0.001 %
Illustrative only. These are not real outputs from any model.

Then one token gets picked. Not always the top one: depending on the settings, the model is sampling from that distribution rather than always taking the maximum. The question it answers is "what is a plausible continuation here", not "what is the single best answer".

Then it does the whole thing again

ContextModelSamplerthe prompt so fara score for every tokenone chosen tokenthe prompt, one token longer
The loop that writes the whole answer, one token per pass

The chosen token is appended, and the longer text goes back in. What is the capital of France? becomes What is the capital of France? Paris, which becomes ...Paris., and so on until the model predicts that the response is over. There is no plan for the answer held anywhere. The answer accretes.

Why this is not "just autocomplete"

The "it is just autocomplete" line is technically fair and practically misleading. Your phone predicts home after I am going because it has seen the phrase. That is the same objective, but it is nowhere near the same learned function.

To get good at predicting text, a model has to pick up the regularities inside text. Grammar, obviously. But also programming syntax, argument structure, arithmetic patterns, how a paragraph tends to resolve, what kind of thing follows "because". The objective is simple. What gets learned is not.

Where the apparent intelligence comes from

Take this fragment:

The glass fell from the table and shattered because it was

To land on fragile, a model has to have absorbed something about objects, falling, and why things break. Or this one:

John put the book on the table. He then picked it up.

To handle it, it has to track what is being referred to across a sentence boundary.

That is the mechanism behind the whole illusion. Language is soaked in information about the world, because it was produced by people describing the world. A system that gets very good at predicting language ends up carrying representations of the things language is about. It looks like understanding because it is built from the residue of understanding.

It does not know, in our sense of the word

How we picture it·a question arrives·the fact is retrieved·the fact is reportedWhat actually runs·the context is scored·a distribution is produced·a token is chosen
The model on the left is the one worth dropping

There is no inner sentence reading "I know that Paris is the capital of France." There is a function that has been shaped so that certain contexts produce certain strong scores. It does not need a dictionary entry. It needs a tendency.

Why it hallucinates

Once you hold the prediction model in your head, hallucination stops being mysterious and starts being obvious.

Ask who wrote a 2017 paper called Quantum Memory Networks for Mars Colonisation. Suppose no such paper exists. The model has still absorbed what paper titles look like, what author names look like, how citations are phrased. So it produces a fluent, well-formed, entirely fictional answer.

It is not lying. Lying would require it to have checked something and decided to misreport it. Nothing was checked. It did exactly what it was trained to do, which was to continue plausibly.

Two different questions hide behind every answer you get:

  • Is this likely, given everything I have seen?
  • Is this true?

The training objective covers the first one. Truth shows up often, because true things are well represented in the training data, but it arrives as a side effect rather than a guarantee. Which is why output can be fluent, coherent, detailed, confident and wrong at the same time.

When it looks like reasoning

Ask it for twelve apples minus five, and you may see it write 12 - 5 = 7 before answering 7. That looks like thinking happening somewhere out of sight.

It is not out of sight. Those intermediate steps are tokens like any others, and once written they become part of the context for the next prediction. The model is using the page as working memory. That is most of why prompting it to work step by step helps on some tasks: you are giving the computation somewhere to happen.

There is something worth sitting with here. When you work a problem out on paper, signals move through neurons, state changes, and a result comes out, and you do not experience any of it as computation. You experience it as thinking. A language model is not a brain and the differences are enormous. But "it is only computation" has never been much of an argument that behaviour is trivial.

What to do with this

  • Treat output as a plausible continuation, not a retrieved fact. If it matters, verify it somewhere that does have a fact store.
  • When accuracy is the requirement, give the model the source material in the prompt instead of relying on what its parameters absorbed.
  • Ask for the intermediate steps on anything multi-step. You are not being polite, you are giving the computation room to happen.