What you need to know
Three parts of a grounded request
- Supply the sources clearly: each document in its own tags with a title and ID, documents before the question.
- Restrict and permit: answer only from the documents, and say "not found in the provided documents" when they do not contain the answer. Without explicit permission to abstain, the model fills gaps.
- Cite: enable the citations feature on document blocks (or pass your own retrieval results as search result blocks) so each claim links to a passage. Verify citations in code before display.
Two more techniques from Anthropic's hallucination guidance: ask the model to extract the relevant quotes first, then answer from them; and let it say "I don't know."
Full context or retrieval
| Corpus | Size | Changes | Approach |
|---|---|---|---|
| 30-page product manual | Fits easily | Monthly | Full context with prompt caching |
| 900,000 tokens of pharmacy policies | Too large for one request | Twice a week | Retrieval |
| 40,000 help articles | Far too large | Daily | Retrieval |
| 300,000 tokens that fit, but 10,000 questions a day and hourly updates | Fits | Hourly | Retrieval, for cost, latency and freshness |
Full context is simpler and often more accurate when the corpus fits and is stable; caching makes repeated questions cheap. Retrieval earns its complexity when the corpus is large, expensive to resend, or changes faster than a cache lives.
When retrieval misses
Find the failing stage first. If the right passage never reaches the model, fix retrieval, not the prompt:
- Contextual chunks: add a short description of where each chunk sits in its document before indexing.
- Hybrid search: combine keyword (BM25) and embedding search.
- Reranking: retrieve more candidates, then rank and keep the best.
Evaluate both directions
A grounding evaluation includes questions the documents answer (with the expected source) and questions they do not (expecting "not found"), plus a check that each cited passage supports its claim.
In the exam
Items describe a corpus and a requirement (answer only from sources, cite, say not found) and ask how to build the request, whether to retrieve, or why answers are wrong. Pair restriction with permission to abstain, use citations and verify them, choose retrieval by size, cost and freshness, and locate the failing stage. Distractors ask the model to "be careful," put huge changing corpora in context, or fix retrieval misses in the prompt.
Check your understanding
The assistant answers from general knowledge when policies are silent. Prompt fix?
Show answer
Answer: B. Restriction plus an explicit abstain path.
40,000 help articles that change daily. Which approach?
Show answer
Answer: C. Size and freshness rule out full context.
The right passage is often missing from the top five retrieved. What helps?
Show answer
Answer: A. The failure is in retrieval, so the fix is too.
Apply it: Ground Larkspur's policy assistant
Larkspur's policy corpus is 320 documents (about 900,000 tokens) and changes twice a week. Pharmacists found 9% of answers cite a policy that does not support the claim and 4% answer questions the policies do not cover. Retrieval returns five chunks by embedding search only.
- Choose full context or retrieval, with reasons.
- Write the request structure: system instructions, documents, question.
- Improve retrieval for policy questions.
- Add citation checks before an answer is shown.
Done when: every shown claim links to a supporting passage, and uncovered questions say "not found."
Show model answer
1. Retrieval: the corpus does not fit one request, changes twice a week, and is queried 6,000 times a month.
2. System: "Answer pharmacists' questions using only the policy passages provided. Quote the supporting text first, then answer. If the passages do not answer the question, reply: Not found in Larkspur policies. Then name the closest policy." User turn: retrieved passages as search result (or document) blocks with policy ID, title and effective date, citations enabled; then the question.
3. Contextual chunks (policy title and section added to each chunk), hybrid keyword plus embedding search (drug names and codes need keyword matching), retrieve 30 candidates and rerank to 8; reindex on every policy update.
4. In code: every citation must point into a supplied passage; an LLM check confirms each cited passage supports its sentence; answers failing either show "Please check policy X directly" with the link.