Hallucination is the AI industry's most diplomatically named problem. LLMs generate confident-sounding false information with the same fluency they generate accurate information — and they don't always know the difference.
What Hallucination Actually Is
When you type a question into an LLM, it doesn't look up a database of facts. It generates the statistically most plausible continuation of your prompt based on patterns learned from training data.
For common, well-documented facts, the most plausible continuation is usually correct. For niche, recent, or highly specific facts, the most plausible continuation might be a made-up-but-realistic-sounding answer.
The model isn't "lying" in any intentional sense. It's doing exactly what it was trained to do — generate fluent, contextually appropriate text — and that process sometimes produces wrong information presented with the same confidence as correct information.
Categories of Hallucination
Factual Confabulation
The model generates false facts that sound plausible:
Prompt: Who wrote "The Midnight Library"?
Correct: Matt Haig (2020)
Hallucinated: "The Midnight Library was written by Sarah Morrison in 2019..."
(Name and year both wrong but follow the format of a real answer)
Citation Fabrication
One of the most dangerous hallucination types. Models frequently generate fake academic citations:
Prompt: Give me a study supporting the benefits of cold exposure.
Hallucinated: "Søberg et al. (2021) in Nature Metabolism found that cold
exposure increases brown adipose tissue activation by 43%..."
(The Søberg study exists, but the journal, year, and statistics may be wrong
or the citation may be completely invented)
Never trust LLM-generated citations without verification. This is non-negotiable for any academic, legal, or medical use.
Temporal Hallucination
Facts that were true at training time but are now outdated, or facts that postdate training that the model invents:
Prompt: What is Claude's latest model?
(Model may state an outdated version or invent a version number)
Technical Hallucination
Invented function calls, API methods, or library behavior:
# LLM-generated code referencing a function that doesn't exist:
result = pandas.read_table_smart("data.csv", auto_detect_types=True)
# "auto_detect_types" is not a real parameter
Especially problematic in older or niche libraries where training data is sparse.
Why Some Facts Are Higher Risk
Not all facts are equally likely to be hallucinated. The risk correlates with:
| Factor | Higher risk | Lower risk |
|---|---|---|
| Training data density | Sparse (niche topics) | Dense (major topics) |
| Specificity | Highly specific (exact stats) | General (concepts) |
| Recency | After training cutoff | Historical |
| Domain | Specialized (legal, medical, academic) | General knowledge |
| Verifiability | Hard to verify (obscure) | Easy to verify (famous) |
Techniques to Reduce Hallucinations
1. Ground the Model in Retrieved Facts (RAG)
The most effective approach: provide the actual facts in the context and instruct the model to use only those:
Answer using only the provided documents. If the answer is not in the
documents, say "I don't have that information" rather than guessing.
[Retrieved documents with actual facts]
Question: [User's question]
2. Ask the Model to Flag Uncertainty
Explicitly request uncertainty acknowledgment:
Answer the following question. If you're not certain about any facts,
explicitly say "I'm not certain about this" and recommend the user
verify independently.
Models often have some calibration about their own uncertainty — but only if you ask them to express it.
3. Request Chain-of-Thought Reasoning
Having the model show its reasoning makes hallucination more visible:
Think step by step. For each factual claim you make, note the source
or basis for that claim. If you're inferring or estimating, say so.
4. Lower Temperature
Higher temperature = more creative but less precise. For fact-sensitive tasks, use low temperature (0.0–0.3) to reduce variance in outputs:
response = client.messages.create(
model="claude-opus-4-6",
temperature=0.0, # Deterministic, lowest hallucination risk
messages=[...]
)
5. Use Verification Prompts
After the model generates an answer, ask it to verify its own claims:
Turn 1: [Generate answer]
Turn 2: "Review your previous answer. Identify any specific statistics,
citations, dates, or technical details and rate your confidence in each
(High/Medium/Low). For any Medium or Low confidence claims, note that
the user should verify independently."
6. Domain-Specific Framing
Explicitly framing the domain and expected limitations:
You are answering questions about machine learning concepts as of early 2026.
For specific research papers, implementation details, or benchmark numbers,
acknowledge that these should be verified against primary sources.
Highest-Risk Use Cases
These applications require extra caution around hallucination:
| Use Case | Risk | Mitigation |
|---|---|---|
| Medical information | Life-threatening if wrong | RAG from verified medical sources, human review |
| Legal advice | Professional and legal liability | RAG from legal databases, always recommend attorney |
| Academic research | Career consequences for wrong citations | Never trust citations, always verify |
| Code generation | Bugs, security vulnerabilities | Always test generated code, review API usage |
| Financial analysis | Monetary consequences | Verify all statistics, use current data sources |
Building Hallucination-Aware Systems
When building LLM applications:
- Source grounding: Always prefer RAG over relying on model memory for facts
- Explicit uncertainty: Instruct models to flag uncertainty rather than guess confidently
- Verification gates: For high-stakes outputs (medical, legal, financial), add human review
- Citation checking: Automatically verify any citations using DOI lookup or search APIs
- User education: Tell users what the system might get wrong, not just what it does well
Key Takeaways
- Hallucination is inherent to probabilistic text generation — models can't fully know what they don't know
- Highest-risk: citations, statistics, recent events, niche domain knowledge, code APIs
- Most effective reduction: RAG (provide facts in context), explicit uncertainty instructions
- Never trust LLM-generated citations without verification
- For high-stakes domains (medical, legal, financial), build in human review or verification gates