Hallucination and Grounding
A language model does not have a "do not know" state to fall into. It has a probability distribution, and a distribution always sums to one — so the mass has to go somewhere, and it goes onto whatever is most plausible.
Overview
Quick Context
Ask a model something it has barely seen and it does not go quiet. Next-token prediction produces a distribution over the whole vocabulary, that distribution sums to one, and decoding picks from it. There is no branch in the architecture where "insufficient evidence" lives.
So the mass lands on whatever is most plausible: a real researcher who works in the area, a plausible-looking citation, an API method that ought to exist. The output is fluent because fluency is what was trained, and being wrong does not make it any less fluent.
What The Model Has
how often the true fact appeared in the pretraining data
puts the supporting passage in the prompt
Letting It Decline
answer only when the top candidate clears this
"Who wrote the 1978 paper on Kessler syndrome?"
—Every candidate is a complete, fluent, confident sentence. Fluency is not the failure — the distribution is.
Where The Probability Goes
Outcomes
Reading It
Hallucination: A Practical Guide
Not a bug in the model. A property of asking a distribution for a fact.
Where hallucinations come from
- Thin evidence. A fact that appeared once in pretraining is a weak signal competing with strong, generic patterns.
- Sampling. Temperature exists to make text less repetitive, and it spends probability mass on the tail to do so.
- The training objective. Nothing in pretraining rewards abstaining, and preference tuning often rewards a confident, complete answer over a hedge.
- Prompts that presuppose. Ask about a paper that does not exist and the likeliest continuation is a description of it, not a correction.
- Stale or absent knowledge. Anything after the cutoff, or behind a login, was never there to be recalled.
Why a model invents things
A language model is trained to produce text that looks like its training data. It is not trained to be true, and it has no mechanism for checking.
So when it does not know something, it does not stop — it produces the most plausible continuation. A fabricated citation looks exactly like a real one, because "author, year, journal" is a pattern the model has seen tens of thousands of times.
That is the whole explanation, and it has an important consequence: fluency and accuracy are unrelated. The confident tone is a property of the text distribution, not evidence about the content.
The recognisable categories:
| Type | Example |
|---|---|
| Fabricated facts | A plausible statistic with no source |
| Fabricated citations | A paper that does not exist, by real authors |
| Wrong details in a true frame | Correct event, wrong date |
| Contradicting the provided context | Retrieved document says 30 days; answer says 14 |
| Overconfident guessing | Answering a question about a document it was not given |
| Reasoning errors | Valid-looking steps to a wrong conclusion |
The fourth is the one that matters most in RAG systems, and the one that is measurable.
Grounding: constraining the answer to sources
Grounding means every claim in the output traces to a supplied document. It is the main defence, and it works at three levels.
Retrieval. Put the relevant documents in the context. If the answer is not there, no prompt will conjure it.
Prompting. Instruct the model to use only the context, to cite the source of each claim, and — crucially — to say when the answer is absent.
Answer using only the context below. Cite the source number after each
claim. If the context does not contain the answer, reply exactly:
"Not found in the provided documents."
Context:
[1] {chunk}
[2] {chunk}
Question: {question}Verification. Check the output against the context afterwards, either with a model asked "is this claim supported by this passage?" or by matching cited spans.
The escape hatch is the part people leave out. A model given no permission to fail will always produce something, and what it produces will be plausible.
Measuring it
Two metrics, and they answer different questions:
Groundedness (faithfulness) — is every claim in the answer supported by the retrieved context? Measured by splitting the answer into claims and checking each against the context, usually with a model as judge.
Correctness — is the answer right, against a known ground truth?
They can diverge, and the divergence is informative:
| Grounded | Correct | Diagnosis |
|---|---|---|
| Yes | Yes | Working |
| Yes | No | Retrieval brought the wrong document, faithfully used |
| No | Yes | Model answered from memory and happened to be right — unreliable |
| No | No | Hallucination |
The third row is the dangerous one, because it looks like success. A system that answers correctly from parametric knowledge rather than from sources will fail silently the moment the question moves outside what the model memorised.
Why a model invents things, and what actually reduces it
A model hallucinates because its objective rewards a plausible next token and never rewards silence. That is a property of the training signal, not a bug, and it explains which interventions work and which cannot.
Guided tour
- Start on thin ice. With evidence at 2.0 the correct name holds about half the mass and three plausible wrong ones hold the other half, so the hallucination rate reads 49.6%. Nothing here is broken; this is what a weak memory looks like written as a distribution.
- Turn the temperature up. At 2.0 the distribution flattens: the correct answer falls from 50.4% to 36.9% and the hallucination rate climbs past 63%. Temperature is a fluency control that doubles as a hallucination control.
- Ground it. Tick Ground It With Retrieval. The supporting passage is in the prompt, the correct answer takes almost all the mass, and the hallucination rate collapses. This is why RAG is the first thing anyone reaches for.
- Let it decline. Turn retrieval off again and tick Allow “I Don’t Know”. The top candidate is 50.4%, under the 0.60 threshold, so the system declines outright: the hallucination rate goes to zero, and so does the chance of getting an answer at all.
- Now lower the bar. Drag Confidence Threshold down to 0.45. It answers again, and the hallucination rate comes straight back. A system that never answers is safe and useless; a system that always answers is neither. The threshold is where you choose between them.
- Give it real evidence. Raise Evidence In Training to 5. The correct answer dominates without any of the machinery — models are not unreliable in general, they are unreliable at the edges of what they saw.
What actually helps
- Retrieval with citations. Move the fact from the weights into the prompt, and show where it came from so a reader can check.
- An explicit escape hatch. Tell the model it may answer "not in the provided context", and mean it. Without permission to decline, declining is off-distribution.
- Constrain the output. Enums, schemas and IDs from a real list cannot be invented if the decoder is constrained to them.
- Verify afterwards. Check every claimed citation resolves, every quote appears in the source, every number matches the table. Cheap, and catches the failures that matter.
- Lower the temperature for factual work. Creative writing wants a warm tail; a support answer does not.
What does not help: asking the model whether it is sure. Self-reported confidence is generated by the same process that produced the answer, and is largely uncorrelated with being right.
What to remember
A model hallucinates because it answers by sampling a distribution that has no state for "I do not know" — the mass has to go somewhere, and when the true fact is thinly represented it goes onto whatever is most plausible instead. That makes hallucination a property of the setup rather than a defect to be patched out: thin evidence, high temperature and prompts that presuppose all raise it, while putting the fact in the context, allowing an explicit abstention, constraining the output and verifying claims afterwards all lower it. Every mitigation trades coverage for precision, so the honest question is not "has it stopped hallucinating" but "how often does it answer, and how often is it right when it does".
What reduces it, ranked by effect
1. Better retrieval. The largest single factor. Most "hallucinations" in a RAG system are the model doing its best with context that did not contain the answer. Measure recall@k first.
2. An explicit "I don't know" option. Costs one sentence in the prompt and removes a large class of fabrication.
3. Required citations. Asking for a source per claim makes the answer checkable, and appears to reduce unsupported claims by itself.
4. Temperature 0. Sampling introduces variation, and variation in factual output is error.
5. Smaller, cleaner context. Contradictory or irrelevant chunks actively cause wrong answers. Fewer, better chunks beat more.
6. A verification pass. A second call asking whether each claim is supported. Doubles cost, catches a lot.
7. Structured output. Requiring JSON with a source field per claim makes unsupported statements structurally awkward to produce.
Note what is not on that list: telling the model to "be accurate" or "do not hallucinate". Instructions of that kind have little measurable effect, because the model is not knowingly inventing.
Where it cannot be fixed by prompting
Some limitations are structural and need a different tool:
Arithmetic and counting. Tokenisation fragments numbers, so calculation is unreliable. Give the model a calculator tool.
Current events past the training cut-off. No amount of prompting supplies information the model does not have. Retrieval or a search tool.
Precise quotations from memory. Verbatim recall is unreliable. Retrieve the source and quote from it.
Its own uncertainty. A model's stated confidence is poorly calibrated, and asking "how sure are you?" produces a plausible number rather than a measured one.
The general principle: if a fact must be right, it should come from a source in the context, not from the weights.
Questions people ask
Can hallucination be eliminated? Not entirely with current models. It can be reduced substantially and, importantly, made detectable through citations and verification.
Do bigger models hallucinate less? Generally yes on well-covered topics, and they remain confident when wrong, which can make errors harder to spot.
Does RAG solve it? It addresses the root cause for domain facts, and only if retrieval works. A RAG system with poor recall hallucinates while appearing grounded.
How do I detect it automatically? A model-as-judge groundedness check per claim, or entailment models. Neither is perfect; both are far better than nothing.
Does temperature 0 stop it? It removes sampling variance, not fabrication. A deterministic wrong answer is still wrong.
Why does it invent citations specifically? Because citation format is a very strong pattern in the training data, and filling a pattern is exactly what the model does.
Recap in one screen
- Models produce plausible text, not true text, and fluency carries no information about accuracy.
- Grounding constrains answers to supplied documents: retrieve, instruct, verify.
- Give an explicit "not in the documents" option — without one, the model will always produce something.
- Groundedness and correctness are different metrics, and a correct-but-ungrounded answer is a warning, not a success.
- Better retrieval reduces hallucination more than any prompt wording.