LLM Hallucinations
What is a hallucination and why do LLMs hallucinate?
A hallucination is a fluent, confident answer that's factually wrong or unsupported. It happens because an LLM is trained to produce plausible next tokens, not to verify truth — so when it lacks the fact, it fills the gap with something that sounds right.
It optimizes for likely text, with no internal “is this true?” check.
Facts after its training cutoff, or rare/long-tail facts, are guessed.
Tuning makes it helpful, which can mean confidently answering when it shouldn't.
- “Intrinsic vs extrinsic hallucination?” — Intrinsic contradicts the given source; extrinsic adds facts not in the source.
How do you reduce hallucinations?
The biggest lever is grounding: give the model the facts and tell it to use only those. Retrieval, lower randomness, and explicit “say I don't know” instructions all help.
- RAG / grounding — answer from retrieved sources and cite them. (See RAG.)
- Lower temperature — less random, more conservative output. (See Sampling.)
- Instruct to abstain — “If the context doesn't contain the answer, say so.”
- Verify — tool calls, a second model to check claims, or human review for high stakes.
- “Does fine-tuning fix it?” — It can reduce certain errors but also bakes in stale facts; RAG is usually better for factual accuracy.
How do you detect or measure them?
Measure faithfulness (is every claim supported by the source?) and factual accuracy against references. Use an LLM-as-judge, self-consistency checks, or human evaluation.
- “What is LLM-as-judge?” — Using a strong model to score another model's outputs for groundedness/quality at scale. (See Evaluating LLMs.)
- “Can confidence scores help?” — Token probabilities correlate weakly with truth; they flag uncertainty but aren't reliable on their own.
- “Will bigger models fix it?” — Scale reduces but never eliminates hallucination; grounding remains essential.
What types of hallucination are there?
It helps to distinguish two kinds:
- Output contradicts the provided source/context.
- e.g. a summary that misstates the article.
- Output adds claims not supported by (or checkable against) the source.
- e.g. inventing a citation or statistic.
How does this connect to evaluation and RAG?
Reducing hallucination is largely about grounding and measuring faithfulness. RAG supplies sources to cite, and faithfulness metrics check the answer is actually supported by them. See evaluating LLMs.
- “Can you eliminate hallucinations?” — No — they're inherent to probabilistic generation; you can only reduce and detect them.