Hallucination: Why AI Confidently Lies
A hallucination is when an AI makes something up โ but states it as if it were certainly true.
What is it?
A hallucination is a false statement from an AI that still sounds confident and convincing. For example, the AI might invent a book, a law, or a function in a library that doesn't actually exist โ and phrase it as plain fact.
Why does it happen?
An LLM predicts the most likely next word, one at a time (see LLM). It has no built-in "truth checkbox". If it doesn't actually know the real answer, it still fills the gap with plausible-sounding text โ because sounding plausible is exactly what it was trained to do.
When does it happen most?
- With very specific facts (names, numbers, quotes)
- With questions about things after the training cutoff
- With niche topics that had little training data
- When asked about things that don't exist ("tell me about function X in library Y")
What helps against it?
- Give the AI real sources or documents as context instead of letting it guess
- Always double-check important facts, especially numbers, quotes, API names
- Ask the AI to state uncertainty instead of guessing
EXAMPLE
Ask: 'Quote paragraph 5 of the (made-up) law XYZ.' A hallucinating AI invents plausible-sounding text instead of saying: 'This law doesn't exist.'
QUICK QUIZ
Why do LLMs hallucinate?
SOURCES
- Wikipedia: Hallucination (artificial intelligence) โ en.wikipedia.org
- Anthropic docs: Reduce hallucinations โ docs.anthropic.com