Grounding & Factuality
Every claim with a receipt
Grounding means every claim traces to a chunk. It's not just retrieval plus a prompt — it's explicit design: force citation, gate on support, and refuse when the corpus has no answer.
What you will learn
- Structure prompts that force grounded answers
- Design no-answer behavior
- Distinguish supported vs unsupported generation
What is this?
Grounding is the discipline of making the model answer only from retrieved chunks. It combines prompt contracts ('answer only from context; if absent say unknown'), retrieval that actually covers the claim, and output-side checks (citations, support scoring, refusal). Grounded systems still hallucinate when context is thin — the answer is design, not hope.
Why do you need it?
- Unfettered fluency is the single biggest trust killer in AI products.
- Refusal beats confident fabrication — a product decision, not an add-on.
- Citations give humans a verification path and debuggability.
- Grounding lets you catch failures in evaluation, not only in user complaints.
Mental model
A witness who can point to sources
Grounding
'Yes, the policy changed — here's clause 4.2, page 3' (grounded). 'Yes, the policy changed' with no source (ungrounded). A witness who refuses to testify on matters outside their materials is the trustworthy variant.
How it works
- Prompt: 'Answer only from the context. If context lacks the answer, say you don't know.'
- Retrieve enough, well-enough ranked chunks to actually cover the claim.
- Force citations: ask the model to reference chunk ids per claim.
- Validate: claims must (a) cite a chunk and (b) be contained therein.
- Refuse: no satisfying context → the 'unable to answer' path.
Grounded answer contract.
In production
- Legal support bots cite the clause id and refuse anything not in the contract.
- Medical triage extras restrict claims to retrieved guidelines and state limitations.
- Insurance responses auto-flag any span without a corresponding chunk for human review.
Best practices
- Front-load the grounding rule in the system prompt; reinforce at the end.
- Require chunk ids; verify citations point at real, containing chunks.
- Ship a not-found answer: same tone, no fabrication.
- Evaluate groundedness on a labeled claim set, not vibes.
Common mistakes
- Putting 'be grounded' in the prompt and calling it done — no verification.
- Retrieving 100 chunks so context becomes noise and support breaks.
- Answering 'the docs don't say' as 'yes, based on general knowledge'.
Common issues
Model invents policy detailsGrounding rule weak + unsupported chunks
Reinforce prompt rule, reduce chunk noise, add support-check, verify citations.
Refuses even when context has the answerContainment too strict or chunks misaligned
Loosen matching (semantic containment), improve retrieval, keep refusal for valid gaps.
Debugging tips
- Confident wrong policy → citation check: is the cited chunk actually the source?
- 'I can't find' when the answer exists → retrieval coverage; check top-k and rerank.
- Citations point to irrelevant chunks → containment validation is broken or misattributed.
Interview checkpoint
Quick quiz
A grounded answer is one that…
Refusing to answer is always a product failure.