Insight Hub
The Grounding Contract: How RAG Actually Controls Hallucination

The Grounding Contract: How RAG Actually Controls Hallucination

Retrieval doesn't automatically prevent hallucination. Grounding (faithful to context) and factuality (true in the real world) are two different axes - and they need two different controls.

Part of: The RAG Pipeline: 5 Decisions That Control Answer Quality

Bolt a retriever onto an LLM and it's tempting to assume hallucination is solved - after all, the model now has real documents to work from instead of just its training data. It isn't solved. A model with access to relevant context can still ignore it, blend it with unrelated background knowledge, or answer questions the context never addressed, all while sounding exactly as confident as it does when it's right.

Grounding is the property of an answer actually being traceable to the context it was given. It's necessary for a trustworthy RAG system, but on its own it isn't enough - and treating it as the whole solution is where a lot of hallucination mitigation efforts quietly fail.

The Grounding Contract Flow

Context + query
Generate (with 'context-only' instruction)
Break into atomic claims
Is each claim supported by context?
Grounded answer

Retrieval Alone Doesn't Prevent Hallucination

Handing a model relevant context doesn't force it to use only that context - nothing about the architecture of a RAG pipeline prevents the model from falling back on parametric knowledge from training, especially when the retrieved context is incomplete or doesn't fully answer the question. Zep's research on reducing LLM hallucinations makes this explicit: grounding is a necessary condition for trustworthy generation, not a sufficient one. Without an explicit instruction constraining the model to the provided context, retrieval just gives the model more material to optionally use - it doesn't obligate the model to use only that material.

Grounding and Being Correct Are Two Different Axes

Anthropic's work on contextual retrieval draws a distinction worth internalizing: factuality (is this true in the real world?) and grounding or faithfulness (is this supported by the context provided?) are separate properties, and an answer can land on either side of each axis independently. A grounded-but-wrong answer means your retrieval and generation worked exactly as designed, but the source document itself was stale or incorrect - a data quality problem. A factual-but-ungrounded answer looks fine on the surface but means the model reached outside the context you gave it, which is invisible until the one time it reaches for something wrong. Two different failure modes, two different fixes - conflating them means fixing the wrong thing.

Why "Answer Only From Context" Has to Be an Explicit Instruction

It's tempting to assume a well-behaved model will naturally stick to what it's given, but Zep's guidance treats the instruction to answer only from the provided context as a mandatory step, not an optional refinement. Left unconstrained, a capable model will often try to be maximally helpful - filling gaps in incomplete context with plausible-sounding inference rather than saying "the provided information doesn't address this." That instinct is usually a feature; in a RAG pipeline where every claim needs to be auditable back to a source, it's the exact behavior that needs to be explicitly turned off.

The Grounding × Factuality Matrix

Context provided

"Refund policy: customers have 30 days from purchase to request a refund." (current document)

Query

How many days do I have to request a refund?

Generated answer

You have 30 days from your purchase date to request a refund.

Grounded?
Yes
Factually correct?
Yes
Why

The answer matches the context exactly, and the context itself matches the real policy - this is the ideal case, both axes pass.

Checking Grounding at the Claim Level, Not the Answer Level

A binary "is this answer grounded" judgment misses the common case where an answer is mostly grounded with one ungrounded detail slipped in. The more useful unit of analysis is the atomic claim: decompose a generated answer into its individual factual assertions, then check each one against the retrieved context independently. This is more work than a single pass/fail check on the whole answer, but it's what lets you catch the specific failure mode where a model correctly grounds nine claims out of ten and quietly invents the tenth - the kind of error that a whole-answer review is most likely to miss entirely.

What a Grounding Failure Actually Looks Like in Production

In practice, ungrounded claims rarely announce themselves. They read with the same fluency and confidence as grounded ones, they often sit right next to accurate information in the same response, and they tend to surface on exactly the queries where the retrieved context was thinnest - which is also where a team is least likely to have manually reviewed the output. This is why grounding needs a systematic check rather than spot-checking a handful of transcripts: the failures concentrate precisely in the cases that are easiest to overlook.

Claim-Support Rate by Control Layer

Grounding score = (claims supported by context) / (total claims in the answer)

Worked example on a single 5-claim answer - not a measurement from a specific benchmark.

No 'answer only from context' instruction
~3/5 claims supported

The model freely blends in background knowledge when context is thin - some claims happen to be true but nothing in the context confirms them.

Explicit instruction in the prompt
~4/5 claims supported

The instruction meaningfully reduces improvisation, but doesn't eliminate it - some unsupported claims still slip through.

Instruction + automated claim-level check
5/5 claims supported

Answers with unsupported claims get blocked or flagged before reaching the user, instead of relying entirely on the model voluntarily following the instruction.

The instruction is necessary, the check is sufficient

A 'context-only' instruction reduces hallucination but doesn't guarantee zero - an automated claim-level check is the second layer of defense, not an optional extra.Grounding ≠ Factuality

Grounding score measures whether the answer is faithful to the context - it says nothing about whether that context is true in the real world. A 5/5-grounded answer can still be wrong if the context itself is stale (see the grounding × factuality matrix above).

Building a Grounding Contract Into Your Pipeline

A grounding contract has three layers, and skipping any one weakens the whole thing: an explicit instruction constraining generation to the provided context (and telling the model what to say when context is insufficient, instead of leaving that case undefined); an automated claim-level check that runs before an answer reaches a user, flagging or blocking responses with unsupported claims; and a feedback loop back to error analysis, since a spike in ungrounded answers on a particular query type usually points at a retrieval gap - the right document simply wasn't there - rather than a generation problem to prompt-engineer away.

Common Pitfalls in Grounding

A few mistakes show up repeatedly: assuming retrieval alone solves hallucination and skipping the explicit context-only instruction entirely; treating a grounded answer as automatically correct and never checking whether the source context itself is accurate or current; running grounding checks at the whole-answer level and missing single-claim failures buried in an otherwise solid response; and treating a spike in ungrounded answers as a prompting problem when it's actually a signal that retrieval isn't surfacing the right documents for that query type. Grounding is a contract enforced through explicit instruction and systematic checking - not a property that emerges automatically from adding a retriever to the pipeline.