What is AI Hallucination?
AI hallucination is when a language model produces confident, fluent, factually wrong output. Why it happens, how to detect it, and how to reduce it.

Why the word “hallucination”
The term is borrowed from psychology. A hallucination is a perception that feels real to the person experiencing it but has no basis in external reality. An AI hallucination is text that reads as confident and authoritative but has no basis in fact.
A hallucinating model says “The CEO of Siemens Austria is [name]” with the same tone and confidence it uses to say “Vienna is the capital of Austria”. There is no signal in the output to indicate which statement it is sure about and which it invented.
A real hallucination example
Prompt: “Who won the Best Director Oscar for a film set in Vienna in 2022?”
Hallucinated response (paraphrased): “The 2022 Academy Award for Best Director went to [Director Name] for their film [Film Title], a critically acclaimed drama set in Vienna during the 1970s.”
This might sound plausible, include a plausible director name, a plausible film title, and a plausible plot description. Every specific factual claim can be completely fabricated. The model has generated a convincing answer to a question it did not actually know the answer to.
Where hallucination is most common
How to reduce hallucination
Technique 1: Ground the model in source documents
Instead of asking the model to recall facts from training, give it the facts in the prompt:
Context: [paste the actual document, policy, or data]
Question: Based only on the context above, what is the deadline
for filing under the EU AI Act Article 53?
If the answer is not in the context, say "I cannot find this
information in the provided document."This is the core of Retrieval-Augmented Generation (RAG): retrieve the relevant documents first, then have the model answer from those documents. The model’s job becomes reading comprehension, not memory recall.
Technique 2: Ask the model to cite its sources
Answer the question and for each factual claim, indicate
which sentence in the provided document you are drawing from,
using [sentence X] notation.Models that must cite their sources hallucinate less because citation forces the model to stay anchored to retrieved content.
Technique 3: Ask for confidence or uncertainty
Answer the following question. At the end of your response,
rate your confidence on a scale of 1-10 and explain what you
are uncertain about.Current models can estimate their own uncertainty reasonably well. A confidence score of 4/10 is a signal to verify independently.
Technique 4: Verify with code execution
For questions involving numbers, dates, and calculations, have the model write code that produces the answer rather than generating the number directly:
# Instead of asking "what is 15% of 847,320?"
# Ask the model to write this:
result = 847_320 * 0.15
print(f"15% of 847,320 is {result}") # 127,098.0Code is deterministic. A hallucinated number in code fails when you run it.
Why you cannot fully eliminate hallucination
Models do not know what they do not know. There is no reliable internal signal that says “this is beyond my knowledge”. Research into calibration (making models better at knowing when they are uncertain) is active, but no current model eliminates hallucination.
This is why AI tools should augment human judgment in high-stakes contexts, not replace it.
What’s next
- Building RAG Systems : Systematic approach to grounding LLMs in your own knowledge base
- Prompt Engineering Best Practices : How prompt design affects hallucination rates
- What is an LLM? : Why LLMs work the way they do, and why this leads to hallucination
Further reading
- Anthropic: Reducing Hallucinations : Practical techniques with Claude
- Hallucination in LLMs: a survey : Academic overview of the hallucination problem and mitigation strategies
- TruLens : Open-source framework for evaluating LLM output quality including hallucination detection
Frequently asked questions