Hallucination is generated content that lacks support from the available evidence. It can be false, or merely impossible to verify from the supplied context. Fluency hides the failure: a language model predicts plausible tokens rather than checking each claim against reality.

Several mechanisms can produce the same symptom. Sparse or stale training data leaves the model with weak evidence. Preference tuning may reward a confident, agreeable answer. Sampling can then select an invented detail from several plausible continuations. None of these causes can be diagnosed from polished prose alone.

flowchart TD
    A[Query] --> B[Model generates claim]
    B --> C{Claim supported by context}
    C -->|Yes| D[Grounded]
    C -->|No| E[Hallucination]

If retrieved context says Austen wrote Pride and Prejudice and the answer names Dickens, the contradiction is visible. Many production failures are less obvious because the model adds a plausible date or citation that the source never mentioned. Generation explains how sampling and output constraints shape these continuations.

Intrinsic and Extrinsic Hallucination

Ji et al. separate two cases. An intrinsic hallucination contradicts the source, such as naming Dickens when the passage names Austen. An extrinsic hallucination adds a claim the source does not contain. That extra claim may happen to be true, but the response has no evidence for it. Intrinsic failures can often be found by comparing answer and context. Extrinsic claims need another source or an explicit abstention policy.

Detection

Detection starts by splitting an answer into claims. Each technique answers a different question about those claims.

  • NLI-based checking scores a claim against source context as entailed, neutral, or contradicted. It works best when the required evidence is already present and the relationship is stated clearly.
  • Self-consistency (SelfCheckGPT) compares several samples from the same prompt. Contradictory or unstable details are warning signals. But stable repetition still does not prove truth, even when the method needs no external knowledge base.
  • LLM-as-judge estimates answer faithfulness against supplied context. It handles semantic variation better than exact matching, but the evaluator is another fallible model and needs calibration against reviewed examples.
  • Atomic fact verification (FActScore) breaks a response into small claims, retrieves evidence for each one, and scores support separately. This makes the failing claim visible instead of hiding it inside an answer-level score.

For a RAG system, RAG Evaluation must measure retrieval and generation separately. A faithful answer cannot recover evidence that retrieval never supplied.

Mitigation

Grounding is the usual starting point. More expensive checks belong on claims whose failure has a real cost.

  • Retrieval grounding (RAG) supplies passages that the answer can cite and check against, turning many recall tasks into source-based synthesis. It reduces reliance on parametric recall without guaranteeing correctness. The legal-system study in the references still found hallucinations above 17% across evaluated tools. See RAG.
  • Chain-of-Verification (CoVe) drafts an answer, creates verification questions, answers them independently, then revises the draft. The separation matters because verification should not treat the draft’s own claims as evidence.
  • Constrained output enforces a schema and allowed values. It prevents structural invention, which protects downstream automation, but a valid field can still contain a false claim.
  • Abstention returns a defined fallback when evidence is missing. The threshold must be calibrated because an overly cautious system becomes useless.
  • Tool-backed generation sends factual subproblems to authoritative databases or calculators and synthesizes their results. The tool response still needs provenance and error handling.

Guardrails turns these techniques into enforced runtime behavior: citations can be checked, unsupported answers can abstain, and invalid tool requests can be rejected.

Pitfalls

RAG Does Not Eliminate Hallucinations

  • Failure. RAG is treated as proof that an answer is grounded.
  • Cause. The corpus may lack the fact, retrieval may miss it, or generation may add a claim beyond the returned passages.
  • Control. Track retrieval recall separately from faithfulness. Then verify material claims against the passages actually used.

Preference Tuning Can Reward the Wrong Signal

  • Failure. An answer becomes more agreeable or polished without becoming better supported.
  • Cause. Preference data can reward agreement with the user even when that agreement is wrong. The cited sycophancy work demonstrates this failure mode. It does not imply that every RLHF model is less factual.
  • Control. Evaluate factual precision and calibration alongside preference scores. Reviewed counterexamples should include prompts with a false premise so agreement is not mistaken for quality.

Over-Aggressive Mitigation Causes Over-Refusal

  • Failure. The system refuses answerable questions or returns fragments despite sufficient evidence.
  • Cause. A strict abstention threshold trades fabrication risk for under-answering.
  • Control. Measure answer coverage beside faithfulness and set thresholds by consequence. Medical advice and an internal search summary should not share the same operating point.

Tradeoffs

ApproachWhat it coversRuntime costMain limitation
RAG groundingSupplies external evidenceRetrieval and indexingBad retrieval silently caps answer quality
Self-consistencyFinds unstable claimsSeveral generationsRepeated agreement is not proof
NLI fact checkingFinds contradiction or missing support in contextOne or more checks per claimThe checker has its own error rate
LLM-as-judgeHandles semantic claim-to-context comparisonEvaluator-model callsRequires calibration and can reproduce model bias
Constrained outputPrevents structural fabricationUsually lowDoes not establish factual truth
Abstention policyStops unsupported answersLow at runtimePoor calibration causes over-refusal

For evidence-backed answers, start with retrieval and claim-to-context checks. Self-consistency is worth its extra calls when an unstable answer would be costly. An LLM judge is usually easier to calibrate offline before it is trusted as a live gate.

Questions

References