Grading evidence and adapting retrieval
hard 7 minAdaptive retrieval makes the next search conditional on the evidence already available.
Video lesson · Chapter 1 of 4
One search left for the missing date
Theory
Read or listen first. About 2 min.
What it is
Adaptive retrieval makes the next search conditional on the evidence already available. A grader must identify what is missing, an alternative path must plausibly supply it, and a stop rule bounds the extra work. An answer can end in a justified abstention.
Why it exists
Track which additional passages or verified facts each retry contributed. A loop that repeatedly finds the same text can consume its full budget without improving the answer. Measure gain over one-pass retrieval on the same questions.
A second search earns its place in the budget
Inside this chapter
Chapter sources- The "Grader" Node
- A grader node estimates whether retrieved evidence is relevant or sufficient. Calibrate it on labeled questions and include ambiguous cases. A high score is a routing signal. Record the actual passages and test whether the downstream answer can be supported by those passages.
A grader is usually a small model or a prompted LLM that reads the question and one passage and returns a label such as relevant, partial or irrelevant, ideally with the missing piece named. Its output is a routing decision, so its errors have a cost: a lenient grader lets thin evidence through to generation, and a strict one triggers needless extra searches. Calibrate it on a labelled set that includes tricky cases such as on-topic passages that lack the key fact, then check how often a passage marked sufficient actually supports the final answer.
Example. A passage mentions returns but supplies no date. Test whether the grader marks it insufficient for the actual date question.
Another example. In a payroll help bot, a passage describing how overtime is calculated is on topic for "what is the overtime rate from April?" but sufficient only if it names the April revision. A grader that only checks topic would pass it.
Relevant is not the same as sufficient
The grader asks two questions. A topical passage can still fail the second one. - Fallback Mechanisms
- When evidence is insufficient, a bounded fallback can query another authorized collection, ask a clarifying question or abstain. Select the path according to the missing information. Repeating the same search unchanged often yields the same failure while consuming latency and budget.
A fallback is only useful if it has a realistic chance of supplying what the first path lacked. That is why the grader should name the gap: a missing revision points to an archive, an ambiguous product name points to a clarifying question, and a fact that no authorised source holds points to abstention. Every branch needs its own budget and its own permission check, since an archive collection may have different readers from the main index.
Example. The first collection lacks a policy revision. Query an approved archive once, then abstain if neither collection supports the requested date.
Another example. An HR assistant cannot find a leave policy for contractors in the employee handbook. It queries the contractor terms collection once; when that also has nothing, it replies that no contractor leave policy was found and offers the HR contact route.
Choose the fallback by what is missing
Each branch targets a specific gap. Re-running the identical search is not one of the options. - Knowledge Refinement
- Knowledge refinement selects useful portions of retrieved material and removes irrelevant fragments before generation. Preserve source IDs and enough surrounding context to keep qualifiers intact. Removing “except during holidays” can turn a shorter, cleaner context into a misleading one.
Refinement usually splits each retrieved passage into smaller strips (sentences or short windows), scores each strip against the question, and keeps the ones above a threshold. The danger is that qualifiers often sit in a separate sentence from the fact they modify, so a strip-level scorer can keep "refunds within 30 days" and drop "this does not apply to customised items". Test refinement by asking questions whose correct answer depends on the exception and checking that it survives.
Example. Remove unrelated product text but retain “except customized items.” Recheck an answer about customization after shortening the context.
Another example. A warranty bot trims a 600-word policy page to the two sentences about battery replacement. A good refiner also keeps the following sentence, "Batteries damaged by liquid are excluded", because it changes the answer for a water-damage claim.
Refined context keeps
- Source ID and revision on every strip
- The qualifier
except customised items - Sentences either side of the matched span
Over-trimmed context loses
- The exception, so the answer overclaims
- Which document each fact came from
- Conditions stated one sentence earlier
- Self-Correction Loops
- A self-correction loop proposes an answer, evaluates it against evidence and revises when a check fails. Use an explicit quality criterion and a stop condition. A fluent self-critique is weak evidence unless an independent check confirms the corrected claim or calculation.
Asking a model to critique its own answer tends to produce confident-sounding edits whether or not the original was wrong. The loop becomes trustworthy when the check is external: compare a cited ID with the retrieved set, recompute a sum, run a test, or verify that each sentence is supported by a passage. Set a maximum number of rounds and log which check failed each time, so you can see whether revisions converge or just oscillate.
Example. A draft cites the wrong policy edition. Use the selected edition ID as an independent check before accepting the revised citation.
Another example. An expense assistant drafts "total is 412.50". A small calculator tool re-adds the line items, gets 421.50, and the loop revises once. Without the tool, a self-critique might simply reword the wrong number.
Draft, check independently, revise - 1Draft answercites policy edition 3
- 2Independent checkselected edition ID is 4
- 3Check failsedition mismatch recorded
- 4Revise citationnow cites edition 4
- 5RecheckID matches, accept
Repeat: back to Draft answerThe check compares against a stored fact, not the model's opinion of its own draft. Cap the number of revisions.
- The Retry Loop
- Retry a retrieval step only when another attempt can change the result, for example by adjusting a query or recovering from a transient timeout. Restrict attempts and total elapsed time. Distinguish a service failure from a valid empty result in the run record.
Retries fix transient failures such as timeouts, rate limits and dropped connections. They do not fix a query that genuinely has no answer in the index, so the run record must keep those cases apart: a valid empty result means change the query or fall back, a timeout means try again. Use a small attempt cap, back off between attempts, and enforce a total time budget so a slow dependency cannot hold the whole request hostage.
Example. A backend times out once and succeeds once. Keep both attempts under one operation identity and record that only the second returned evidence.
Another example. A legal search tool returns HTTP 429 on the first call and results on the second after a short back-off. The trace shows one logical search with two attempts, so latency dashboards attribute the delay to rate limiting rather than slow ranking.
Two attempts, one operation
Both attempts share one operation ID. An empty but successful response would be logged differently from a timeout. - Adaptive Retrieval
- Adaptive retrieval selects how much retrieval work to perform based on the question or observed evidence. A simple definition may need one lookup while a comparison needs several sources. Evaluate routing cost, answer quality and abstention together to detect policies that cheaply skip necessary research.
An adaptive router looks at the question (or a first-pass result) and picks a strategy: no retrieval, one lookup, or a multi-step search. It saves cost on easy questions, but a router tuned on cost alone learns to under-research. Evaluate it per question type with correctness, calls and abstention reported side by side, and include questions where the right move is to search more than usual.
Example. Give the router a single-fact question and a two-document comparison. Compare retrieval calls and correctness for each instead of averaging the costs.
Another example. A developer docs assistant answers "what does flag
--dry-rundo?" with one lookup, but "how did the retry defaults change between v2 and v3?" needs both version pages. Logging the route chosen per question makes it obvious when version questions slip onto the one-lookup path.Route by question shape, then score each group
Question type Retrieval calls Correct Abstained Single fact: what is the refund window? 1 yes no Comparison: plan A vs plan B limits 3 yes no Comparison sent down the cheap path 1 no, half the facts no Illustrative rows. Averaging calls across both types would hide that the cheap path broke comparisons.
How it works
Step through the idea, or press Play.
Evidence check. No effective date found
Understand it
Worked example
A second search earns its place in the budget
- 1
No effective date found
The question asks for the current policy. The first candidate set has topical passages but none establishes the effective date.
- 2
One retry for dated policy
The grader records the missing fact. Rewrite the query to address that specific gap instead of searching the same text again.
- 3
Dated source found or abstain
The second pass either returns an authorized dated passage or exhausts the budget. Record which condition caused termination.
Follow the handoffs
States of the bounded retry
What each pass contributed
| Pass | Query | New passages | Effective date found? |
|---|---|---|---|
| 1 | current returns policy | 3 | no |
| 2 | returns policy effective date revision | 0 (same top passage) | no |
| Result | 0 new facts from retry | abstain on the date |
Summary
The whole topic in one minute.
The system still lacks the required evidence. Repetition can increase confidence without adding information.
Track which additional passages or verified facts each retry contributed. A loop that repeatedly finds the same text can consume its full budget without improving the answer. Measure gain over one-pass retrieval on the same questions.