Why it makes things up: separating hallucination into three independently testable sources
A support bot turns "7-day no-questions returns" into "15-day". You add "never fabricate; answer only from the document" to the system prompt. The next day it fabricates again, only more confidently.
That sentence fails because "hallucination" is not one fault but at least three distinct pathways: the knowledge is not there at all, the knowledge is there but decoding did not lift it to the top, and the context conflicts with memory and it listened to the wrong side. The fixes do not transfer between them, so the first step is not a stronger prompt but a diagnosis.
Source 1: knowledge missing, and it does not stop
Lost in the Middle provides two comparison settings: closed-book (no documents, parameter memory only) and oracle (only the single document containing the answer). Same multi-document QA on NaturalQuestions, accuracy measured in 2023:
| Model | Closed-book | Oracle | Gap |
|---|---|---|---|
| GPT-3.5-Turbo | 56.1% | 88.3% | +32.2 |
| Claude-1.3 | 48.3% | 76.1% | +27.8 |
| LongChat-13B (16K) | 35.0% | 83.4% | +48.4 |
| MPT-30B-Instruct | 31.5% | 81.9% | +50.4 |
Same model, same questions; the only difference is whether the passage containing the answer is in context — a gap of 30 to 50 points. More telling: every question in this benchmark has a unique answer, and closed-book the model answered all of them, roughly 40% of them wrong. It has no default "I don't know" action, and "did not know" and "knew but answered wrong" look identical in your logs.
Test: put the source passage for the correct answer into context and ask again. If accuracy jumps above 80%, this is knowledge-missing, and the fix is retrieval and tools, not harsher wording. If it is still wrong with the passage present, go to source 2.
Source 2: the knowledge is there, but the smoother answer ranks first
What DoLa (ICLR 2024) does illustrates the mechanism: no retraining, no retrieval — at decode time it compares the model's later-layer and earlier-layer logits projected onto the vocabulary, and reranks the next token by the difference. As the paper puts it, factual knowledge tends to concentrate in specific layers, while later-layer outputs more readily produce generic, high-frequency continuations that suppress the earlier factual signal. With this change, LLaMA-family models gain 12–17 absolute points on TruthfulQA.
Put differently, part of hallucination is not "not knowing" but knowing without being selected — the most fluent, most corpus-statistical token outranks the correct fact at generation time.
Test: same prompt, same context, change only decoding settings (greedy vs sampling, number of samples, seed). If the answer moves, a meaningful share of accuracy is decided by the decoding path. More documents will not help; what helps is reducing randomness, majority voting over samples (self-consistency), and routing low-confidence results to a human.
Source 3: in a conflict, it picked the wrong side
Huang et al.'s survey (ACM TOIS) splits hallucination into two families: factuality hallucination (output contradicts the real world — entity errors, relation errors, unverifiable claims, overclaims) and faithfulness hallucination (output contradicts user input or context — instruction inconsistency, context inconsistency, logical inconsistency). The third family is not about the world being misrepresented; it is about the model not following you.
In RAG this conflict is the classic case: when a retrieved passage contradicts the model's memorized "common sense", who wins? The answer is — it depends on how the conflict is constructed. Longpre et al. built conflicts by entity substitution and found generative QA models leaning on parametric memory and ignoring context; Chen et al. used multi-passage settings and found models using almost exclusively contextual evidence. Same model, two papers, opposite conclusions; the difference is the experimental design, not the model.
The engineering implication: "please follow the document" cannot resolve conflicts, because whether a conflict is even noticed is itself unstable. Three things you can do: require the model to quote the source span for each claim (making citations an inspectable intermediate artifact), provide a legitimate "not in the document" exit with examples, and put counterfactual passages in your eval set (replace the correct answer with a value contrary to common sense and see whether it follows).
A triage table
| What you see | Test to run first | Likely source | Fix |
|---|---|---|---|
| Fluent detail answers, wrong numbers | Put the source text in context and re-ask | Knowledge missing | Retrieval, tool calls |
| Still wrong with the source present, and the answer varies between runs | Fix the context, sample repeatedly and compare | Decoding path | Lower randomness, self-consistency, threshold to human |
| Sides with the wrong party in document-vs-common-sense conflicts; invents when the document is silent | Add counterfactual passages and unanswerable questions | Faithfulness / conflict handling | Forced citation, legitimate empty answer, conflict-specific evals |
Closing
"Do not fabricate" is the weakest possible intervention: it operates on output wording only, and cannot reach whether knowledge is present, which token decoding selects, or who wins a conflict. Diagnose the source first, then decide whether to add retrieval, adjust decoding, or change conflict handling and eval criteria. Get the order wrong and you get the familiar outcome: the more you admonish it, the more confident it sounds.