Topic 3
Why models hallucinate
Why does a model state a wrong answer as smoothly as a right one? There is no single cause. Here are the main ones, each visible in GPT-2.
Predict first
Loading GPT-2's answers…
Try this: open the gold prompt and the Bell prompt. In both, the top answer comes from the pattern of the words in front of it, not from chemistry or history.
Five reasons
- The objective is likely text, not true text. Training rewards predicting the next token of real documents (lesson 4). Truth only helps when true statements are what the documents usually say.
- There is no lookup. Whatever GPT-2 "knows" is spread through its weights, learned from training text. Ji et al. (2022) call this parametric knowledge. Nothing in the forward pass consults a list of facts. Why
SydneybeatsCanberrais not something this lesson measured. One plausible reason is that Sydney appears near "Australia" in far more web text. - Knowledge is frozen at training time. GPT-2's training set, WebText, came from web pages linked from Reddit posts (with Wikipedia pages removed), and the model was released in 2019 (GPT-2 model card). It has learned nothing since. Any model knows only what was in its training data, and Hands-On Large Language Models (Ch. 8, chapter introduction) notes that fluent answers can be wrong or out of date.
- Patterns beat facts. After "Alexander Graham",
Bellhas probability 0.999. After "sodium is Na and … gold is",Nawins. Attention is very good at copying from the context (lesson 3), and here it copies the wrong thing. - "I don't know" is rarely the likely next text. After "the city of", a city name is what fits grammatically, so GPT-2 names one. Chat models are trained further on answers that people wrote. AI Engineering (Ch. 2, "Hallucination") describes a hypothesis from Leo Gao and John Schulman of OpenAI. When those written answers draw on knowledge the model lacks, training on them teaches the model to answer anyway: in effect, to make things up.
Quick check