Skip to content

Command Palette

Search for a command to run...

← All concepts
Concept

Hallucination

When an LLM generates plausible-sounding but factually incorrect or unsupported content.

Simple explanation

Hallucination is when the LLM makes things up. It sounds confident but is wrong. This happens because LLMs generate the most likely next token, not the most truthful one. RAG and grounding reduce hallucination.

Engineering explanation

Hallucination occurs when the model extrapolates beyond its training data or provided context. Causes: no grounding (free generation), ambiguous prompts, model verbosity (more tokens = more chance to drift). Mitigations: RAG (ground in retrieved context), structured output (constrain format), low temperature for factual tasks, faithfulness eval, and 'I don't know' refusal when context is insufficient.

Example

Without RAG: 'Our refund policy is 30 days.' (hallucinated). With RAG: 'Our refund policy is 14 days. [Source: Refunds Policy, Section 2]' (grounded).

When to use it

N/A — hallucination is a failure mode to prevent, not a feature.

Common misconception

Hallucination is NOT a bug you can fully fix. It's inherent to how LLMs work. You can reduce it (RAG, eval, guardrails) but never eliminate it. Always eval faithfulness.