The AI Handbook Open in the app →

Hallucination

Inference & Prompting · Beginner · 4 min read

What is it?

A hallucination is when an AI model produces confident-sounding information that is actually false or made up.

Explain like I'm 5

A hallucination is like a student who didn't study but answers anyway with total confidence — it sounds right, but it's invented.

Why was it created?

This isn't a feature anyone built; it's a known failure mode of models that generate the most likely-sounding text rather than verified facts.

Where is it used?

  • Risk to manage in AI assistants
  • Quality checks for AI output
  • Reason to add grounding (RAG)
  • Evaluating model reliability

Why should developers care?

Hallucinations are the biggest reliability risk when using LLMs, so anyone building with them must plan to detect and reduce them.

How does it work?

An LLM predicts plausible next tokens based on patterns, not a database of facts. When it lacks the right information, it can still generate a fluent, confident — but wrong — answer.

Real-world example

Asked for a citation it doesn't know, a model may invent a realistic-looking but nonexistent paper title and author.

Common use cases

  • Identifying AI failure modes
  • Designing verification steps
  • Choosing to ground answers in data
  • Setting user expectations

Advantages

  • (Not desirable) — but understanding it guides safer designs
  • Highlights the need for grounding and review

Disadvantages

  • Confident but false output
  • Hard to spot without checking
  • Erodes user trust
  • Can cause real harm if unverified

When should you use it?

Always assume hallucination is possible and design checks accordingly.

When should you avoid it?

You can't fully avoid it, but you can reduce it with grounding, verification, and clear limits.

Alternatives

Grounding with RAGHuman or automated verificationRestricting answers to known data

Related terms

Large Language ModelRetrieval-Augmented GenerationPrompt EngineeringInference

Interview questions

Beginner

  • What is an AI hallucination?
  • Why do models sound confident even when wrong?

Intermediate

  • Why do LLMs hallucinate?
  • How does RAG reduce hallucinations?

Senior

  • How would you detect hallucinations in production?
  • What guardrails reduce their impact?

Common misconceptions

  • "Hallucinations mean the model is broken" — they're an inherent risk of how generation works, not a simple bug.
  • "A confident answer is a correct answer" — confidence and accuracy are unrelated in LLM output.

Fun facts

  • The term borrows from human perception, describing seeing something that isn't there.
  • Grounding answers in retrieved sources is the most common mitigation.

Timeline

  • 2020s — Hallucination becomes a central concern as LLMs go mainstream

Learning resources

Quick summary

A hallucination is confident but false AI output, an inherent risk of LLMs that you reduce with grounding and verification.

Cheat sheet

  • Confident but false output
  • Inherent to text generation
  • Reduce with RAG + verification
  • Never trust unverified facts

If you remember only one thing

LLMs can state false things with total confidence — always verify facts you can't afford to get wrong.