Sub topic 3
What we mean by a hallucination
This chapter assumes you have used a chat-based LLM assistant and know that models are trained on large text collections. The earlier chapters in this tutorial covered next-token prediction and why fluent text is not the same as true text. This chapter uses those ideas to define the problem precisely, because "hallucination" is used loosely and the loose use hides useful distinctions.
A working definition
A hallucination is output that is fluent and presented as if it were reliable, but that is not supported by reality or by the material the model was given. Three parts of that definition matter.
- Fluent. The text reads well. A garbled answer is a failure, but it is an obvious one, and it is not what people mean here.
- Presented as reliable. The model states the claim in the same tone it uses for true claims. It gives no signal that the claim is shaky.
- Not supported. Something outside the text should back the claim up, and nothing does. That something is either the real world or the documents in the prompt.
The model is not lying. Lying requires knowing the truth and choosing to say something else. The model has no step where it compares a claim to the world, so an unsupported claim comes out of the same process as a supported one. The word "hallucination" suggests perception, which is misleading. "Fabrication" or "confabulation" describe the behavior more accurately. This tutorial uses "hallucination" because it is the common term.
Two reference points: the world and the context
You can only call an output unsupported if you say what it should be supported by. Research on this problem usually separates two reference points.
- Factuality. Is the claim true about the world? A made-up court case or a wrong founding date fails this test.
- Faithfulness. Is the claim consistent with the source material in the prompt? A summary that adds a detail the article never mentioned fails this test, even if the detail happens to be true.
The two tests are independent. A summary can be faithful to an article that is itself wrong. It can also be factually correct but unfaithful, for example when the model adds true background knowledge you asked it to leave out. When someone reports a hallucination, ask which test the output failed. The fix depends on the answer.
Faithfulness failures are often split further.
- Contradiction (sometimes called intrinsic): the output conflicts with the source. The report says revenue fell, and the summary says it rose.
- Unsupported addition (sometimes called extrinsic): the output adds something the source neither confirms nor denies. The report never names a cause, and the summary names one.
The second kind is harder to catch, because you must check what is missing from the source and not only what is contradicted.
A taxonomy you can use
The table below combines the two reference points into the categories you will meet most often.
| Kind | What fails | Example | Where it comes from |
|---|---|---|---|
| Fabricated entity | Factuality | A paper, person, function, or case that does not exist | Plausible patterns with no real fact behind them |
| Wrong attribute of a real thing | Factuality | A real author credited with a book they did not write | Associations that are close but wrong |
| Invented detail | Factuality | An exact figure or date that sounds right | Pressure to give a specific answer |
| Contradicting the source | Faithfulness | Summary reverses a finding in the document | Weak use of the supplied context |
| Adding to the source | Faithfulness | Summary includes a cause the document never states | Filling gaps with likely text |
| Accepting a false premise | Both | Explaining why a nonexistent event happened | Following the framing of the question |
The last row shows that the categories overlap. A question such as "Why did the 2019 Treaty of Lisbon Accords collapse?" contains a false premise. An answer that explains the collapse is unfaithful to the question's real situation and factually wrong at once. A later chapter covers how prompts lead models astray in this way.
What a hallucination is not
A loose definition makes every error a hallucination, and then the word stops helping. These cases are different.
- Outdated information. The model says a company's CEO is someone who has since been replaced. The claim was once true. The cause is a training cutoff, and the remedy is to supply current information or use a tool that can search.
- Reasoning errors. The model has all the right facts but makes an arithmetic slip or a faulty logical step. The facts are not invented, and the process is wrong. Some papers include these under hallucination, but the checks differ. You catch a reasoning error by re-deriving the steps. You catch a fabrication by checking an external source.
- Contested or subjective claims. "The best programming language for beginners" has no single true answer. A confident opinion is a different problem from a false fact.
- Following your instructions. If you ask for a fictional biography or a plausible-sounding example, producing invented content is the correct behavior. The failure only exists when invented content is presented as real.
- Deliberate errors in the prompt. If you paste a document with a mistake and the model repeats it faithfully, the model is faithful. The source is wrong.
These distinctions matter because each cause calls for a different response: fresher data, a calculator, a clearer prompt, or a source check.
The same surface, different causes
Two outputs can look identical and still need different handling. Suppose a model answers "The study was published in 2017 in Nature Neuroscience." Several different situations could lie behind that sentence.
- The study exists and the claim is correct.
- The study exists, but it appeared in a different journal. The model blended nearby facts.
- No such study exists. The model produced a plausible citation shape.
- The study exists, but the answer reflects a stale record that has since been corrected.
From the text alone you cannot tell these apart. This is the central difficulty of the topic. Because generation does not check facts, a true statement and a fabricated one carry no difference in wording that you can rely on. The rest of this tutorial focuses on checks that happen outside the text: comparing samples, looking up sources, and supplying documents.
Hallucination comes in degrees
It is tempting to treat an answer as either hallucinated or clean. Real outputs are mixed. A long answer might contain nine correct statements and one invented one, and the invented one is hard to find because it is surrounded by correct material. For this reason it helps to think at the level of individual claims and not whole answers. A claim is a statement that could be checked on its own, such as a date, a name, a quotation, a number, or a causal link.
Rates also vary widely by task. Models tend to do better on widely documented topics and worse on obscure ones. They do better on summarizing a short supplied passage than on recalling specifics from memory. A single quoted "hallucination rate" from a benchmark tells you little about your own use. Treat any such number as specific to the test that produced it.
A decision path for a suspicious output
When an answer looks wrong, a short sequence of questions helps you name the problem before you try to fix it.
Why the definition matters for the rest of the tutorial
Naming the failure correctly decides which tool you reach for. Factuality failures call for checking against primary sources. Faithfulness failures call for comparing the output to the supplied text, and a design that makes that comparison easy, such as requiring quotations. Reasoning errors call for re-running the steps. Outdated facts call for current data.
Key points
- A hallucination is fluent output, presented as reliable, that nothing supports. The support should come from the world or from the supplied context.
- Factuality asks whether a claim is true. Faithfulness asks whether it matches the source. The two can fail independently.
- Outdated facts, reasoning errors, subjective claims, and requested fiction are different problems with different fixes.
- The text itself rarely shows which case you are in, so checks must come from outside the text.
- Evaluate individual claims. Whole-answer judgments hide the one invented detail.
Exercise
A model is given a one-page press release stating that a company opened a new office in Leeds. Asked to summarize it, the model writes "The company opened a new office in Leeds, which will create 200 jobs." The press release never mentions jobs. Which kind of failure is this, and which reference point does it fail? Does the answer change if the claim about 200 jobs turns out to be true?
Show answer
This is an unsupported addition, a faithfulness failure, because the summary adds a claim the source neither confirms nor denies. The answer does not change if the claim turns out true: the summary is still unfaithful to the source, and the figure could not be verified from the supplied text. It would pass a factuality check only if you found an outside source that confirms it.
Exercise
For each case, say whether it is best called a hallucination, and name the better label if it is not. (a) A model states that a retired player is still on a team's roster. (b) A model, asked for a short fictional diary of a lighthouse keeper, invents a keeper named Maren. (c) A model correctly lists the facts of a word problem and then adds two numbers incorrectly. (d) A model cites a journal article with a plausible title and authors that does not exist.
Show answer
(a) Not best called a hallucination. It is outdated information from a training cutoff. (b) Not a hallucination. Invented content was requested, and it was not presented as real. (c) A reasoning error. The facts are not invented, and the process failed. (d) A hallucination, specifically a fabricated entity, which is a factuality failure.