An AI chat model predicts text that fits. Nothing inside it checks whether the text is true. When the text is wrong but reads as right, people call it a hallucination.
The useful news is that the mistakes are not random. They come in seven kinds, and each kind has its own check.
Real failures stack. A bad answer often holds two or three kinds at once: an old fact, a made-up number, and a source that does not exist. One check catches one kind. Running all the checks that apply catches the rest.
1. Fabricated facts
A false name, date or number, stated with full confidence. For example, a model says the Great Fire of London was in 1766. It was 1666.
Catch it
Why it happens, and how to prevent it
The model picks words that are likely to come next. It does not look anything up. A wrong date that sounds right is just as easy for it to write as the true one. This is step 6 of how an LLM works.
Prevent it: give the model the source material, and tell it that "I don't know" is an acceptable answer.
2. Fake citations
A paper, link, quote or legal case that looks real and does not exist. This has reached real courtrooms, in filings that cited cases no court ever decided.
Catch it
Why it happens, and how to prevent it
The model has seen millions of citations, so it knows exactly what one looks like. It never learned which ones exist. It can build a perfect-looking reference out of a real journal, a plausible author and a title that was never written.
Prevent it: hand the model your sources, and accept citations only from that set.
3. Outdated answers
Old information presented as current. For example, a model names a company's former chief executive as the person who runs it today.
Catch it
Why it happens, and how to prevent it
A model's training data stops on a cutoff date. The model has no clock, so it cannot tell that months or years have passed since then.
Prevent it: tell it today's date, and give it fresh data to work from.
4. Invented code
A function, setting or package that nobody ever published. For example, code that imports a library that does not exist.
Catch it
Why it happens, and how to prevent it
Programming libraries follow patterns. The model blends names from libraries that look alike, and the result is a name that fits the pattern and was never real.
Prevent it: paste in the current documentation. Never install a package whose name you cannot verify. People do publish harmful packages under names that models tend to invent.
5. Ignored instructions
It says it followed your rules, but it skipped one or changed one. For example: "Here are 5 bullets." There are 7.
Catch it
Why it happens, and how to prevent it
A long prompt, or one whose rules pull against each other, spreads the model's attention thin. Each rule gets a little less weight. See step 3: attention.
Prevent it: keep rules short and numbered. Repeat the most important ones at the end.
6. Context conflict
It contradicts the document you gave it, or adds things that are not there. For example, a summary says revenue rose when the report says it fell.
Catch it
Why it happens, and how to prevent it
What the model absorbed in training can override the page in front of it. Very long inputs also lose detail. See step 5: the context window.
Prevent it: say "answer only from this document," and require a quote for every claim.
7. Broken reasoning
Every step sounds right, but the logic or the arithmetic does not hold. For example, the right formula with a wrong sum in the third step.
Catch it
Why it happens, and how to prevent it
The model predicts the next word. It does not calculate. A number that looks like the right kind of answer is what it produces.
Prevent it: have it use a calculator or code tool for anything with numbers.
The short version
- Treat a confident answer as a draft. Confidence tells you nothing about truth.
- Match the check to the kind. A date needs a source. A link needs opening. A sum needs redoing.
- Give it what it needs. Your documents, today's date, and permission to say it does not know.
Go deeper
- Why any of this happens: How an LLM Works, in Six Steps.
- The short version to keep: the Learn shelf.
Sources and credit
- The grouping into seven kinds follows an infographic by Poornachandra Kongara. The explanations and examples here are our own.
- For the research view: Huang and colleagues, A Survey on Hallucination in Large Language Models (2023).