Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
Eager retrieval fires one query at turn start and guesses what the question needs; lazy retrieval lets the model issue queries during reasoning so context grows on demand, which is what multi-hop questions actually
Imagine asking a research assistant to answer a complicated question. The eager approach is to hand them one folder of articles at the start and say go. The lazy approach is to let them walk to the library, grab a book, read it, decide what to look up next, and walk back for more. For a simple fact-lookup the folder is fine. For a question like which papers cited the same theorem as this one, the assistant needs to walk back to the library several times because each visit tells them what to look for next. Lazy retrieval lets the model do that walking. The cost is a few extra trips; the benefit is finding things one trip could never have found.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 minutes: define eager vs lazy retrieval, name the multi-hop problem that breaks eager, walk through the search as tool loop, describe the hybrid 2026 default, mention max-iterations as a safety cap.
search_tool = {
"name": "search_kb",
"description": "Search the knowledge base. Returns top-5 chunks with [S<n>] tags.",
"input_schema": {
"type": "object",
"properties": {"query": {"type": "string"}},
"required": ["query"],
},
}
# Lazy retrieval loop (Anthropic SDK shape)
def run_lazy(user_question: str, max_iterations: int = 8):
messages = [{"role": "user", "content": user_question}]
for _ in range(max_iterations):
resp = client.messages.create(
model="claude-opus-4-7",
tools=[search_tool],
messages=messages,
)
if resp.stop_reason != "tool_use":
return resp.content # final answer
for block in resp.content:
if block.type == "tool_use":
result = kb.search(block.input["query"])
messages.append({"role": "assistant", "content": resp.content})
messages.append({"role": "user", "content": [
{"type": "tool_result", "tool_use_id": block.id, "content": result}
]})Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating eager and lazy retrieval as either-or rather than per-workload. Single-hop fact lookups want eager; multi-hop research wants lazy. Many production systems do both.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.