Mental model
Hallucination occurs when a language model generates fluent assertions that contradict supplied context (intrinsic) or introduce unverified facts absent from inspected evidence (extrinsic). Grounding narrows the model's valid claim space through retrieved passages, deterministic tool outputs, atomic claim-level entailment checks, and calibrated abstention whenever evidence is missing, conflicting, or stale.
Theory
Treating "hallucination" as a single scalar defect obscures distinct failure mechanisms. Grounded systems separate unverified claims along two diagnostic axes: intrinsic hallucinations, which directly contradict or distort values present in retrieved passages ("passage states 14-day return window; answer claims 30 days"), and extrinsic hallucinations, which fabricate external dates, metrics, or citations absent from the prompt context altogether. Both failures frequently stem from parametric override: when pretraining priors clash with updated retrieved facts (a newly deprecated API flag or updated SLA), high-probability pretraining continuations overpower weaker contextual attention signals.
Reliable grounding separates retrieval adequacy from generation faithfulness. Retrieval adequacy asks whether ground-truth evidence entered the context window (Context Recall@K). Generation faithfulness decomposes a candidate answer into minimal atomic claims —single subject-predicate-object statements—and verifies whether at least one cited passage logically entails each claim above threshold :
Where mathematical calculations, database balances, or date differences are involved, generation should never compute values probabilistically; deterministic tool execution must supply the exact intermediate values before synthesis begins.
Context Faithfulness vs. Parametric Override
Parametric override spikes in two predictable scenarios: when retrieved passages bury the updated clause inside dense multi-paragraph boilerplate ("lost-in-the-middle" attention decay), and when domain terminology mirrors popular web conventions that differ from enterprise policy. Requiring the generator to extract verbatim evidence quote spans alongside each source_id before composing the user-facing sentence forces attention over the exact source tokens. Even when the model synthesizes across multiple passages, breaking the output into atomic subject-predicate-object claims exposes cross-passage splicing errors—such as merging an eligibility condition from Document A with a reimbursement cap from Document B—that human skimmers and document-ID checkers overlook.
Calibrated Abstention and Quantitative Error Reduction
When retrieved evidence is empty, below minimum rerank score, or mutually contradictory, prompting the model to "answer helpfully" invites fabrication. Grounded architectures enforce calibrated abstention ("I cannot verify this from the inspected sources"), accompanied by explicit citation gaps or conflicting-version notices.
Consider evaluating 500 production support answers averaging 4 atomic claims each (2,000 claims total). Baseline instrumentation observes two root failures: retrieval misses the required clause on 6% of queries (30 responses), and parametric override corrupts 4% of the remaining queries (19 responses)—yielding 49 / 500 = 9.8% hallucinated responses. Introducing two deterministic guardrails shifts system reliability quantitatively:
- Pre-generation Sufficiency Gate: Abstaining automatically whenever top reranker score drops below
0.35eliminates25of the30missing-evidence fabrications at the cost of6false refusals (1.2%false-refusal rate). - Post-generation Atomic NLI Gate: Decomposing claims and suppressing or flagging assertions with catches
16of the19parametric overrides.
Total user-visible hallucination drops from 9.8% (49 / 500) down to 1.6% (8 / 500)—an 83.7% reduction in unsupported responses while bounding unnecessary refusals cleanly.
Trade-offs
Tightening grounding controls trades answer coverage, inference latency, and natural prose fluidity against factual precision.
| Grounding Control | Failure Type Caught | Added Latency / Cost | Key Risk if Misconfigured |
|---|---|---|---|
| Context Sufficiency Abstention Gate | Extrinsic guessing on missing docs | < 1ms (uses reranker logit) | High false-refusal rate if threshold tuned poorly |
| Inline Quote-First Prompting | Intrinsic distortion & misattribution | +10–25% output tokens | Verbose responses on simple factual lookups |
| Atomic Claim + NLI Verifier | Parametric override & spliced facts | +80–220ms (batched NLI/LLM) | Over-strict entailment flags valid arithmetic/paraphrases |
| Extractive Span Selection Only | All synthesis fabrication | Lowest LLM cost | Robotic fragments when multi-doc synthesis is needed |
Using a cross-encoder NLI classifier (e.g., DeBERTa-NLI) runs 5–10x faster and cheaper than invoking a second frontier LLM as a post-hoc critic, though complex multi-passage synthesis can require pairwise claim checking across concatenated evidence spans.
Failure modes and misconceptions
Counting [1] [2] inline citation brackets as proof of faithfulness. Models readily emit valid-looking passage indices next to fabricated claims or swap numbers between two adjacent cited paragraphs; verification must check entailment against the exact referenced passage text, not just verify that the document ID exists.
Forcing an answer when retrieved passages conflict or lack timestamp provenance. If doc_v1 states a 30-day SLA and doc_v2 states 14 days, uncalibrated synthesis picks one arbitrarily or averages them; expose corpus timestamps and surface the conflict explicitly.
Tuning prompts to stop hallucinations when retrieval recall is the actual failure. Asking an LLM to "never hallucinate" cannot conjure evidence missing from top_K; always measure Context Recall on golden passages before rewriting generator prompts.
Confusing helpfulness with unconditional answering. Penalizing abstention on unanswerable adversarial tests trains models to guess aggressively under ambiguity—eroding user trust across high-stakes compliance and technical workflows.
Decision scenario
An enterprise HR policy assistant answers employee leave and benefits questions across regional handbooks. Audit telemetry reveals 11% hallucination rate despite strong 95% retrieval recall: the base model repeatedly substitutes US default leave rules when answering queries about regional EU policies (parametric override) and invents transitional exceptions when clauses are silent. Enforce a strict two-stage grounding gate: require the generator to emit JSON mapping every output claim to verbatim substring quote offsets from retrieved passages, run a lightweight NLI entailment check (tau = 0.72) over every (quote, claim) pair before streaming to the user, and trigger calibrated abstention ("I cannot verify that exception in the regional handbook") plus HR escalation link whenever any claim fails verification or retrieval scores fall below threshold.
Learning outcomes
- Classify grounding errors into intrinsic contradictions, extrinsic fabrications, parametric overrides, and stage-1 retrieval coverage gaps.
- Formulate atomic claim decomposition and passage-level NLI entailment scoring () to verify inline citations beyond ID existence.
- Tune sufficiency and entailment thresholds to minimize unsupported claims while keeping false-refusal rates bounded.
Implementation example
This Python claim verifier decomposes an answer into atomic sentences, scores each claim against its cited source passage via an entailment scorer, and returns a grounded pass/abstain verdict before display.
pythonfrom dataclasses import dataclass@dataclass(frozen=True)class CitedClaim:claim_text: strsource_id: strdef verify_grounded_response(claims: list[CitedClaim],passages_by_id: dict[str, str],nli_entail_prob_fn,entail_threshold: float = 0.72,) -> dict[str, object]:if not claims:return {"grounded": False, "action": "abstain", "reason": "no_verifiable_claims"}unsupported: list[dict[str, object]] = []min_score = 1.0for item in claims:passage = passages_by_id.get(item.source_id)if not passage:unsupported.append({"claim": item.claim_text, "reason": "missing_source_id"})min_score = 0.0continueprob = float(nli_entail_prob_fn(premise=passage, hypothesis=item.claim_text))min_score = min(min_score, prob)if prob < entail_threshold:unsupported.append({"claim": item.claim_text, "source_id": item.source_id, "entail_prob": round(prob, 3)})if unsupported:return {"grounded": False, "action": "abstain", "unsupported_claims": unsupported}return {"grounded": True, "action": "deliver", "min_entail_prob": round(min_score, 3)}
Why does verifying only that a cited document ID exists fail to prevent intrinsic hallucinations, and what check catches parametric overrides?