Hallucination
Ảo giác AI (Hallucination)
When an LLM generates factually incorrect, fabricated, or nonsensical content presented with apparent confidence.
Hallucination is when an LLM confidently states something that is false, fabricated, or unsupported by its context. The term is borrowed from psychology, where hallucinations are perceptions without external stimulus. In LLMs, the model generates plausible-sounding text that has no grounding in reality.
**Types of hallucination**
- *Factual hallucination*: Wrong facts — wrong dates, wrong names, nonexistent citations. "The Eiffel Tower was built in 1823" (it was 1889). - *Entity hallucination*: Fabricating people, papers, companies, products that don't exist. - *Attribution hallucination*: Correct idea, wrong source — "Einstein said..." when Einstein never said it. - *Logical hallucination*: Internally inconsistent reasoning that reaches confident wrong conclusions.
**Why LLMs hallucinate**
LLMs are fundamentally next-token predictors. They don't have a fact-checking mechanism — they don't "know what they know." When the training data is sparse on a topic, the model interpolates from patterns rather than retrieving stored facts. This can produce grammatically correct, confident-sounding nonsense.
**Mitigation strategies**
- *RAG*: Ground answers in retrieved documents. The model quotes its sources. - *Constrain the task*: Ask the model to say "I don't know" if it's uncertain. - *Reduce temperature*: Lower randomness reduces (but doesn't eliminate) hallucination. - *Fact-checking layer*: Add a verification step, either another model call or human review. - *Citations required*: Instruct the model to cite the exact passage it's drawing from.
**Pitfalls**
No current LLM is hallucination-free. Higher confidence in tone does not correlate with higher factual accuracy. Hallucinations are worst in long-tail, niche topics and best for well-represented, stable facts.