CertPrep
Domain 2 · Lesson 2.4 · 7 min read

Retrieval and Grounding at Scale

Exam skillRetrieval and Knowledge Grounding at Scale

Evaluating retrieval architecture for knowledge-grounded production applications, including agentic search versus RAG tradeoffs, chunking and embedding strategy, hybrid search, and reranking, and designing grounding practices such as source citation, uncertainty declaration, and confidence signals, and diagnosing retrieval-quality failures by stage.

Choose between agentic search and RAG for a production corpus, tune chunking, embeddings, hybrid search and reranking from stage-level measurements, and design grounding (citations, declared uncertainty, calibrated confidence, permission-aware retrieval) so answers can be checked.

What you need to know

A grounded answer can fail at four stages: the evidence was not in the index (data), was not retrieved (recall), was retrieved but ranked too low to reach the model (ranking), or reached the model and was not used correctly (generation). Fixing the wrong stage wastes effort. Diagnose by stage first.

Diagnose by stage

For a sample of wrong answers, check where the right passage was lost:

FindingStageTypical fixes
The document is missing or outdated in the indexDataIncremental indexing with deletions; version and date metadata
The right passage is not in the candidate setRecallBetter chunking, contextual embeddings, hybrid search, metadata filters
It is in the top 50 but not the top 5RankingA reranker; choose cutoffs from measured recall
It reached the model, which used another passageGenerationInstructions, quote-first answering, citations

Measure stages separately: recall at k isolates retrieval, and groundedness (are the answer's claims supported by the passages provided?) isolates generation.

Agentic search versus RAG

Favors agentic search (list, grep, open, query)Favors RAG (index, retrieve, rerank)
Content changes many times a day (code, live records)Large, slowly changing corpus
Answers follow references across files or recordsOne retrieval step answers most questions
Freshness matters more than speedTight latency targets

Agentic search usually costs more tokens and time per question; it buys freshness and multi-hop reasoning.

Chunking and embeddings

  • Structure-aware chunking keeps tables whole with their headings and respects section boundaries. Fixed-size cuts split tables from their labels.
  • Contextual retrieval prepends a short, generated description of each chunk's place in its document before embedding, so chunks like "the limit in clause 4.2 shall not exceed this amount" become retrievable and interpretable.
  • Embedding model changes require re-embedding the whole corpus, ideally into a new index switched over after evaluation; vectors from different models are not comparable.

Hybrid search, filters and reranking

Dense embeddings blur exact tokens such as part numbers and codes. Hybrid search adds keyword matching (for example BM25) and merges the lists. Metadata filters (product, tenant, version, access rights) remove wrong-scope content before ranking. A reranker reorders a larger candidate set so the best passages reach the model; tune how many candidates it scores from recall curves, since scoring hundreds per query costs latency.

Grounding practices

PracticeHow
Source citationSend documents with citations enabled, or pass retrieved passages as search result blocks, so claims link to exact text
Uncertainty declarationInstruct Claude to say when the sources do not cover the question, rather than answering from memory
A no-evidence pathWhen nothing passes a relevance threshold, a designed response and a route to a person
Confidence signalsDerive from evidence (how many passages support the answer, whether they agree), then calibrate against reviewed answers
Source policyApply the same allowed sources to every retrieval path; a second, unrestricted search tool bypasses the policy

Permission-aware retrieval

Filter results by what the user may see before they reach the model. Once a confidential memo is in the context, no instruction can un-retrieve it, and ranking tweaks do not enforce access.

In the exam

Retrieval items give stage-level evidence or a symptom (wrong product, exact codes failing, tables failing, stale policies, citations that do not support claims). Locate the stage, then choose the fix for that stage. Distractors change the prompt for a recall problem, retrieve far more passages, enlarge chunks blindly, drop a stage that drives quality, or answer from training data.

Check your understanding

Question 1

Questions with exact part numbers return passages about similar parts. Which change helps most?

Show answer

Answer: D. Embeddings blur exact identifiers; keyword matching and structured filters find them directly.

Question 2

Recall at 20 is 92% but recall at 5 is 61%. What does the evidence support?

Show answer

Answer: A. The right passage is usually retrieved but ranked too low; reranking targets exactly that gap.

Question 3

An HR assistant returned an excerpt from a confidential compensation memo to an employee. What is the fix?

Show answer

Answer: C. Access control must apply before content enters the context; prompts and ranking cannot enforce it.

Apply it: Diagnose Tidewater's grounding

Exercise · about 30 minCase: Tidewater Analytics

Tide's groundedness is 91% on a sample, but large tenants complain about wrong answers on documents with tables and on questions with product codes. The index is rebuilt nightly; tenants upload and delete documents all day. A sample of 150 wrong answers has been labeled by stage: 30 used a deleted or superseded document, 55 never retrieved the right passage (most of them table or product-code questions), 40 retrieved it below the top 5, and 25 had it in context but answered from another passage.

  1. Rank the stages by impact and propose one fix per stage.
  2. Choose the metrics that will show each fix worked.
  3. Design the no-evidence path for questions the tenant's documents do not cover.
  4. State the access rule that keeps one tenant's documents out of another's answers.
Check your work
Show model answer

1. Stages and fixes

StageCountFix
Recall55Structure-aware chunking that keeps tables whole; contextual retrieval; keyword search and product-code metadata in the hybrid index
Ranking40Rerank the top 50 candidates, cutoff chosen from recall at 5 and 20
Data30Incremental indexing on upload and delete, with version metadata; superseded versions excluded
Generation25Citations on; quote the supporting passage before answering

2. Metrics. Recall at 5 and at 50 on a labeled question set, split by question type (tables, codes, prose); share of answers citing superseded documents; groundedness of claims against provided passages on sampled traffic.

3. No evidence. If no passage passes a relevance threshold, Tide says the tenant's documents do not cover the question, shows the closest documents it searched, and offers to open a support request. It does not answer from training data.

4. Access. Every query carries the tenant ID and user ID from the gateway; the index filters by tenant and by the user's document permissions before ranking. No passage from another tenant can be retrieved, whatever the prompt says.

Key termsChunkingCitationsContextual retrievalEmbeddingGroundingHybrid searchMetadata filterPrecision and recall

Sources