Hallucinations and building trust
Before we begin
A hallucination is when an LLM states something confident but false — fake citations, wrong numbers, invented features.
Why do LLMs hallucinate? They optimize for plausible continuation, not verified truth.
What you will learn
- Name common hallucination triggers.
- Apply grounding and evaluation patterns.
- Design UX that helps users verify answers.
Before this lesson
Why it happens
- Training — models absorb myths, outdated facts, fiction.
- Pressure to answer — prompts that forbid “I don’t know.”
- No retrieval — question about your private doc but model guesses.
- High temperature — more random completions.
- Long reasoning chains — errors compound.
Mitigations
| Technique | Effect |
|---|---|
| RAG + cite sources | Ground in text user can check |
| Low temperature for facts | Less random drift |
| Explicit refusal | “Answer only from context” |
| Tool use | Calculator, SQL, search APIs (Module 8) |
| Human review | High-stakes decisions |
Evaluation
Build a golden set of 20–50 questions with known answers from your docs.
Track:
- Faithfulness — answer supported by retrieved chunk?
- Citation accuracy — link matches claim?
- Refusal rate — correct “I don’t know” when info missing?
Re-run when you change prompts, chunk size, or model.
UX trust patterns
- Show source snippets beside answers.
- Highlight when confidence is low.
- Log retrieved chunks for debugging.
- Never present legal/medical output as professional advice without review.
Checkpoint
Why do LLMs hallucinate?
Answer sketch
They predict likely text, not facts; without grounding they fill gaps with plausible-sounding fiction.