All guides
Concept· 3 min

Why do LLMs hallucinate?

Hallucinations are confident-sounding but false outputs — a natural consequence of models predicting likely text, not truth.

Key idea

LLMs optimize for plausible next tokens. When they lack real knowledge, they invent plausible-sounding facts, citations or code.

Example

Asking a model for research papers by author X may return real-looking titles, journals and years that don't exist.

What to remember

  • Ground answers with RAG or tool use to reduce hallucination
  • Ask for citations and verify them programmatically
  • Lower temperature and structured outputs help, but don't eliminate it