CertPrep
Domain 6 · Lesson 6.4 · 5 min read

Grounding Answers and Citing Sources

Exam skillGrounding and Source Citation

Constructing a request that grounds answers in the supplied documents, cites their source, and returns 'not found' when the documents do not contain the answer. This includes deciding, based on corpus size, cost, and freshness, whether to supply the full document set in context or retrieve only the relevant passages.

Build requests that answer only from supplied documents, cite the passages they used and say "not found" when the documents are silent, and decide from corpus size, cost and freshness whether to put the whole document set in context or retrieve only the relevant passages.

What you need to know

Three parts of a grounded request

  1. Supply the sources clearly: each document in its own tags with a title and ID, documents before the question.
  2. 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.
  3. 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

CorpusSizeChangesApproach
30-page product manualFits easilyMonthlyFull context with prompt caching
900,000 tokens of pharmacy policiesToo large for one requestTwice a weekRetrieval
40,000 help articlesFar too largeDailyRetrieval
300,000 tokens that fit, but 10,000 questions a day and hourly updatesFitsHourlyRetrieval, 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

Question 1

The assistant answers from general knowledge when policies are silent. Prompt fix?

Show answer

Answer: B. Restriction plus an explicit abstain path.

Question 2

40,000 help articles that change daily. Which approach?

Show answer

Answer: C. Size and freshness rule out full context.

Question 3

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

Exercise · about 25 minCase: Larkspur Pharmacy

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.

  1. Choose full context or retrieval, with reasons.
  2. Write the request structure: system instructions, documents, question.
  3. Improve retrieval for policy questions.
  4. Add citation checks before an answer is shown.
    Done when: every shown claim links to a supporting passage, and uncovered questions say "not found."
Check your work
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.

Key termsChunkingCitationsEmbeddingGroundingHybrid searchReranking

Sources