Hallucinations
A hallucination is a confident, fluent, and completely fabricated statement from an AI model: the single biggest obstacle to trusting LLMs in production, and something you manage with grounding and product design rather than eliminate.
Learning Objectives
- Explain what hallucinations are and why LLMs produce them.
- Distinguish the main types of hallucination with real examples.
- Apply practical techniques that reduce hallucination rates.
- Design product experiences that stay safe when the model is wrong.
- Know when hallucination risk rules out an AI use case entirely.
Why This Matters
Hallucinations are the number one reason AI pilots fail to reach production. A model that is right 95% of the time but confidently wrong the other 5% (with no signal telling you which is which) cannot be trusted for legal advice, medical information, or financial figures without safeguards. Every AI practitioner needs to know why hallucinations happen, how to reduce them, and how to design products that fail gracefully when they slip through.
Everyday Analogy
Imagine a brilliant student taking an exam who is never allowed to leave an answer blank. For questions they know, they write correct answers. For questions they do not know, they write something plausible-sounding in the same confident handwriting. Grading the paper, you cannot tell the difference by tone alone. LLMs are that student: trained to always produce the most plausible next token, never to say nothing.
What Exactly Is a Hallucination?
An LLM is a next-token predictor: it generates the most statistically plausible continuation of the text so far. "Plausible" and "true" usually overlap, but not always. When they diverge, the model produces fluent fiction with the exact same confidence as fact. Crucially, the model has no internal flag that distinguishes recalled knowledge from plausible invention.
The Main Types
- Factual fabrication: inventing facts, dates, statistics, or events. "The Eiffel Tower was completed in 1901" (it was 1889).
- Fake citations and sources: inventing papers, court cases, URLs, or book titles that look perfectly formatted but do not exist. The most dangerous type for professional work.
- Faithfulness failure, where you provide a document and the model summarizes things it does not say. The source is right; the model drifts from it.
- Instruction drift: you say "answer only from the provided context" and the model quietly blends in its own training knowledge anyway.
- Capability hallucination, where the model claims it did something it cannot do: "I have sent the email" when it has no email tool.
A Famous Real Case
In 2023, a New York lawyer submitted a legal brief written with ChatGPT. It cited six court cases, complete with names, docket numbers, and quotes. All six were fabricated. The judge sanctioned the lawyer, and the case became the canonical warning: the model produced perfectly formatted legal citations because it learned the format of citations, not a database of real cases.
Why Do Models Hallucinate?
- Training rewards fluency, not truth. Pre-training optimizes "predict the next token", and human raters historically rewarded confident complete answers over honest "I don't know".
- No knowledge boundary. The model cannot reliably tell what it knows from what it can plausibly generate.
- Compression is lossy. Terabytes of text compressed into model weights lose detail, especially rare facts seen only a few times.
- Stale knowledge. Anything after the training cutoff simply is not in the weights, but the model will still answer questions about it.
Reducing Hallucinations: The Practitioner's Toolkit
Ordered roughly by effectiveness:
- Grounding / RAG (AI-016). Retrieve real documents and instruct the model to answer only from them. Cuts fabrication dramatically for knowledge tasks: the single biggest lever.
- Require citations to provided sources. Forcing every claim to link to a retrieved chunk turns unverifiable prose into checkable claims, and lets the UI render links a human can click.
- Permission to say "I don't know." Adding "If the context does not contain the answer, say so" to the system prompt measurably reduces forced fabrication.
- Lower temperature for factual tasks. Sampling randomness amplifies fabrication; factual Q&A should run near temperature 0.
- Verification pass. A second model call that checks each claim of the first against the sources, catching faithfulness drift cheaply.
- Structured outputs and tools. For math, dates, or lookups, have the model call a calculator or database instead of generating the answer from weights.
- Evals with hallucination metrics (AI-025). Measure groundedness on a golden dataset before and after every prompt change: you cannot manage what you do not measure.
Designing for the Hallucinations That Remain
No technique reaches zero. Production AI products assume some hallucination and design for it:
- Show sources. Perplexity and Bing Copilot render citations inline so users can verify in one click.
- Calibrate the stakes. Brainstorming copy? Hallucination is a minor bug. Quoting drug dosages? It is a lawsuit. Match autonomy to risk (AI-053 covers human-in-the-loop patterns).
- Human review gates for high-stakes output. Legal, medical, and financial content gets a human approval step.
- Honest UI copy. "AI-generated β verify important details" sets user expectations and legally matters.
Real-World Showcase
- Perplexity built its entire product identity on grounded answers with inline citations, a direct product response to hallucination distrust.
- GitHub Copilot frames output as suggestions inside an editor where a compiler and tests catch fabricated APIs: the environment absorbs the errors.
- Air Canada's chatbot hallucinated a bereavement refund policy in 2024; a tribunal held the airline liable for its bot's invented policy. Hallucinations are now legal precedent.
Try It Yourself
Run this three-step experiment with any chatbot:
- Induce: Ask about something obscure or fictional: "Summarize the 1987 novel 'The Glass Cartographer' by Miriam Voss." (It does not exist.) Watch whether the model invents a plot or admits ignorance.
- Ground: Paste a short article and ask the same model to answer questions only from it, saying "not in the text" otherwise. Ask one question the article does not answer. Compare behavior.
- Verify: Ask for a fact with three sources, then actually check the sources. Count how many are real.
You have just reproduced the core hallucination eval loop that AI teams run at scale.
Common Mistakes
- Believing a low-hallucination demo means a low-hallucination product: rare failures appear at scale.
- Trusting confidence: fluent, detailed, well-formatted output is not evidence of truth.
- Treating hallucination as a bug the next model version will fix: it is inherent to next-token prediction; manage it with grounding and design.
- Skipping citation checks because the citations "look real": fake ones always do.
Key Takeaways
- Hallucinations are confident fabrications caused by models optimizing plausibility, not truth.
- The model gives no signal separating recall from invention: you must add that via grounding and verification.
- RAG plus required citations plus permission to say "I don't know" removes most of the problem.
- Design products that fail safely: show sources, gate high-stakes outputs, set honest expectations.
- Measure hallucination with evals before and after every change; never rely on vibes.
Glossary
- Hallucination
- A confident, fluent, fabricated statement: the student who never leaves an answer blank, writing plausible fiction in the same confident handwriting as fact. Produced because models optimize plausible next tokens, not truth, with no internal flag separating recall from invention. (see AI-009)
- Grounding
- Anchoring answers to provided source material (retrieved documents, databases, tools) instead of training-weight memory. The single biggest hallucination lever, and the "R" in RAG. (see AI-016)
- Faithfulness
- How accurately output reflects the source it was given: a summary adding claims the document never makes has low faithfulness even if those claims happen to be true. One of the five hallucination types alongside fabrication, fake citations, instruction drift, and capability claims.
- Fabricated Citation
- A perfectly formatted reference to a paper, case, URL, or book that does not exist, the type that sanctioned the 2023 New York lawyer whose six ChatGPT-cited court cases were all invented. The most dangerous type for professional work.
- Knowledge Cutoff
- The date the training data ends: the model has nothing after it but will still answer questions about later events, inviting fabrication. (see AI-007)
- Groundedness Metric
- The eval score measuring what fraction of claims are supported by provided sources, the core number hallucination evals track before and after every prompt change. (see AI-025)
- Verification Pass
- A second model call checking each claim of the first against the sources, flagging unsupported statements before users see them: a cheap catch for faithfulness drift.
- Temperature
- The sampling randomness dial: higher values raise creativity and hallucination risk together, so factual Q&A should run near zero. (see AI-009)
References
Diagram
Knowledge Check
8 questions