Why Models Hallucinate
Why a language model can state false things fluently and confidently, what causes it, and the habits that make it far less likely to hurt you.
On this page
You ask an assistant for three studies to cite in a report. It gives you three neat references: authors, year, journal, a one-line finding each. Two check out. The third looks just as real, with a plausible author and a journal that exists, but the paper does not. Nobody wrote it.
This is called a hallucination: output that is fluent and confident but false or unsupported. It is not a rare glitch, and the model is not lying. It follows directly from how a model makes text.
Plausible is not the same as true
A language model produces text one token at a time, each picked from chances that say what usually comes next (What Is an LLM). Pretraining made those chances match real text, and real text is mostly true, so the model is usually right about things that are written about often.
But nothing in the loop checks facts. In pretraining, the model was rewarded for being a good continuation, not for being true. When it knows a fact well, the true continuation and the plausible one are the same. When it does not, it still produces a plausible one. Every step of the loop must output some token, and there is no separate step that stops when the model is unsure. "I don't know" only comes out if those words are themselves a likely continuation.
Watch a fake reference being built
The chances below are invented to show the pattern. A model is asked for a study showing that houseplants improve exam scores, and suppose no such study is well known. Watch how sure it is at each step.
repeat: chances = model(text so far) token = sample(chances) append token to text- next0A1One2Researchchance00.6210.2120.09
- text
- A study by
1The first word is "A", at 0.62, and "study by" follows almost automatically. This part is easy: lots of answers start this way, so the model is confident.
- next0Brennan1Lindqvist2Okafor3Chen4Patelchance00.0710.0620.0530.0540.05
- text
- A study by Brennan
2Now the author. The model has no strong memory of any author for this claim, so the chances are flat: many surnames, none above 0.07. It must still pick one, and sampling lands on "Brennan".
- next0et al.1and2(chance00.8110.1120.05
- text
- A study by Brennan et al.
3"et al." is very likely after a surname in a reference. Confident again, and this is real knowledge: of the format, not of the study.
- next0(2019)1(2018)2(2021)3(2016)chance00.1410.1320.1230.11
- text
- A study by Brennan et al. (2019)
4The year is another guess: anything recent is plausible. Sampling picks 2019.
- next012%115%210%38%chance00.0910.0820.0830.07
- text
- A study by Brennan et al. (2019) found that ... scored 12% higher
5The finding. "found that" is near certain; the number is another flat guess. It picks 12%. Everything written so far is now part of the text, and later tokens will tend to stay consistent with it.
- piece0A study by1Brennan2et al.3(2019)4found that512%chance00.6210.0720.8130.1440.9350.09
- confident steps
- 3
- guessed facts
- 3
6The finished sentence reads smoothly. The confident steps (format words) and the guessed ones (author, year, number) look the same on the page, yet all three facts came from chances below 0.15.
What the model really knew was what a reference looks like. That is why the result is convincing. The facts inside were filled in like any other blank.
The main causes
- Rare facts are stored weakly. A fact seen thousands of times in training gets sharp, confident chances. A fact seen once or twice, like a small company's founding year or a minor paper's author, leaves only a blurry trace. Specific details (names, numbers, dates, quotes, URLs) are the most at risk.
- Every step commits. Once a wrong token is written, it becomes part of the text the model reads. Later tokens stay consistent with it, so one bad guess can grow into a detailed, coherent false story.
- Guessing can be rewarded. If training or evaluation scores answers only as right or wrong, a confident guess sometimes scores and "I'm not sure" never does. Researchers point to this as one reason models guess rather than hold back.
- The answer is not in the text it has. Questions about your private documents, events after its cut-off, or anything it was never told cannot be answered from memory, so a plausible guess is all it can produce.
- False premises. "Why did the city ban bicycles in 2015?" assumes it happened. A good continuation of that question is an explanation, so the model may supply one.
To be accurate about what is known: research suggests models often carry some internal signal of how sure they are, and for simple facts that signal is partly reliable. Training can teach a model to say "I don't know" more often. But the signal does not reliably show in the wording, and no current method removes hallucinations completely. Treat any specific factual claim as unverified until you check it.
What actually reduces it
The strongest fix is to stop asking the model to remember, and ask it to read instead. Put the source material in the prompt and ask for answers grounded in it.
The second prompt does three things: it supplies the facts, it asks for a quote you can check in seconds, and it gives the model an honest way out. Systems that look up documents automatically and add them to the prompt use the same idea; see RAG Basics. Letting the model run a search or a calculator through tools helps for the same reason.
The last line of defence is you. Check names, numbers, dates, quotes and links before you use them, as carefully as a mistake would cost. Verifying AI Output turns this into a routine.
Common mistakes
Try it yourself
This prompt invites a hallucination: the model has never seen the meeting. Rewrite it so the answer must come from material you provide, can be checked, and has an honest way to say something is missing.
Show a sample answer
Why it works: the original asks the model to recall something it never saw, so any answer would be invented. The rewrite gives it the source, restricts it to that source, asks for a quote you can check, and spells out what to say in each case, including "not decided" and "not mentioned", so a guess is never the easiest continuation.
Check yourself
Which of these is a model most likely to get wrong without a source?
Why does a hallucinated reference look as convincing as a real one?
What is the most reliable way to get a correct answer about a specific document?
What to practise next
The Prompting Basics lesson starts putting this module to work, and Verifying AI Output shows how to check answers quickly when the stakes are real.