Agentic retrieval moves the decision of what to read next from the engineer to the model (or to a router, or to nobody, with the whole corpus in the window). It pays only when the next query can name what the last search found, and every extra call re-reads everything before it.
Fig. 1 follows one recorded question through three deciders, the running example's Qwen3-1.7B answering each time; each slab is one model call, its length the prompt tokens, to scale.
You need: one search done well, The retrieval pipeline; the agent loop and native tool calling down to tokens, Building a harness. The parent, Topic: rag-and-retrieval, compares these strategies in its section 5 (who decides what to read), and its shared runs (src/agent) measured them; this page reuses those recorded runs and adds its own.
src/scripts/run_pending.sh reruns them from cache.F1 against tokens billed per question (every call's whole prompt plus output), Qwen3-1.7B on the topic's 200 two-hop questions measured on Apple M1 Pro. The agent loop (ReAct, 0.411) is level with the top-5 search (0.402) at 3.3 times the tokens; the best point is long context with the question's own 10 paragraphs (0.456), and the same idea with 8k tokens of near-misses is among the worst (0.320). No retrieval at all scores 0.142 (off the chart).
| Approach | Who decides what to read | Model calls | F1 here | Tokens | Pays off when |
|---|---|---|---|---|---|
| No retrieval ("closed book") | nobody; the model's memory | 1 | 0.142 | 60 | common knowledge the model was trained on |
| Single-shot pipeline, top 5 | the engineer, in advance | 1 | 0.402 | 735 | the answer is in one or two passages similar to the question |
| Decompose, then retrieve (a fixed program) | the model writes sub-questions once; the program runs them | 4 | 0.335 | 1,961 | questions with a predictable shape (two hops, a comparison) |
| Agent loop (ReAct) | the model, at every step | 2 to 5 | 0.411 | 2,458 | multi-hop and exploratory questions |
| IRCoT (reasoning sentence as query, then a reader) | the model's own reasoning text becomes the next query | 2 to 6 | 0.442 | 1,015 | multi-hop, when the reasoning names the bridge entity |
| Self-Ask, FLARE | explicit follow-up questions; the model's token confidence | 2 to 9 | 0.286 / 0.400 | 4,112 / 811 | when the model asks well-formed follow-ups or knows when it is unsure |
| CRAG-style evaluator (search again?) | a cross-encoder decides; the model rewrites the query | 1 to 2 | 0.332 | 1,050 | when the evaluator can tell good results from bad (barely, here) |
| Router in front (comparison-word rule) | a rule, classifier or small model, once | 1 + the route | 0.444 (best here) | 1,143 | traffic mixing question types that need different strategies |
| Long context, gold always in the window | nobody; everything is read | 1 | 0.456 (1.5k tok), 0.320 (8k) | 1,455 / 7,944 | a small corpus read once or as a whole |
| Deep research | a planner model and parallel sub-agents, for minutes | tens to hundreds | not run here (needs a web search API) | open-ended reports with citations | |
| Agent memory | the agent, over its own history | any | read-time curation measured in section 9 | long tasks and repeated sessions | |
A pipeline commits to one query and one k before it has seen a result; if that search misses, nothing notices. Handing the search to the model lets it read a result and react. The search is a tool: a function the harness runs for the model. The model sees a tool description, may answer with a tool call (structured text naming the tool and its arguments), the harness runs the search and appends the result as an observation, and the model is called again with everything so far, until it answers or the step budget runs out. That is the reason-then-act loop of ReAct; how a harness renders the tool schema into the chat template and parses the call is on Building a harness. What matters here is what the loop reads and what it pays.
With s the first call's prompt (instructions, tool description, question) and r what each step adds (the model's thought and action plus the observation), n searches and a final answer bill
Over the 200 recorded trajectories the formula, with s and r measured per question, predicts the billed tokens within 2.5% on average (worst 15%, from r varying between steps) measured; with one search it is exact by construction. On average 1,022 of the 2,258 billed tokens were actually computed. An API with prompt caching bills the re-read part at a discount (the Long-context calculator has dated prices); it does not make each step's generation faster.
| Searches n | Questions | Formula | Billed (recorded) | Actually prefilled (prompt cache on) |
|---|---|---|---|---|
| 1 | 69 | 817 | 817 | 506 |
| 2 | 84 | 1,867 | 1,845 | 941 |
| 3 | 19 | 3,676 | 3,696 | 1,538 |
| 4 | 28 | 6,205 | 6,067 | 2,186 |
The tool description is text in the system turn, paid on every call. Counted with Qwen3's own chat template (tokenizer only, measured): the question alone is 37 tokens; with the root's text protocol (Thought:, Action: search[...], finish[...], a budget rule) 174; with an OpenAI-style JSON function schema passed as tools=[...] 207; with that schema plus a two-line budget prompt 232. The description is also the main lever on query quality: say what the tool returns and what a good query looks like ("a short query naming one entity or fact"). Every tool added to an agent is paid on every call.
Results per search, same agent measured: 1 paragraph F1 0.452 (1,540 tokens), 3 (the root's run) 0.411 (2,458), 5 0.424 (3,569). One per search scored highest and cost less than three, within noise (one against three: +0.041 (paired 95% interval -0.019 to +0.102)): smaller observations do not hurt this model, because it searches again.
The same 3 results formatted four ways, mean Qwen3 tokens over the 406 searches the root's 1.7B agent made measured. The first sentence carries more than expected: 287 of the 486 labelled supporting sentences of these 200 questions (59%) are a paragraph's first sentence. That is the case for the two-tool design many agents use: search returns titles and a snippet, read returns one document in full, so full text is paid only when chosen. JSON wrapping costs about 12% more than the same text as a plain list, for no gain.
What the agent did with a budget of 4 (recorded trajectories): it saw both gold paragraphs in 114 of 200, after the first search in 32, the second in 72, the third or fourth in 10, and searched again after already having both 28 times. It stopped too early (answered without ever seeing the second gold paragraph) in 75 trajectories, 52 of them wrong: stopping is a judgment from its own reading, and a small model is overconfident. It repeated a query in 28 trajectories and used the whole budget in 28 (mostly the same ones: stuck loops only the budget ended); 17 times it wrote no parseable action. Long trajectories are mostly failing trajectories, so a tight budget costs little. How to check yours: log every call's prompt tokens and every query with its results; count calls per question, repeated queries, unparseable steps and budget hits. They are cheap and find most loop bugs.
The same ReAct agent with a search budget of 1, 2, 3, 4 (the root's run) and 6, 200 questions measured: F1 0.278, 0.400, 0.407, 0.411, 0.407 at 938, 1,702, 2,095, 2,458 and 3,270 tokens. Budget 6 against 4: -0.004 (paired 95% interval -0.043 to +0.036). A budget of 1 forces an answer from 3 paragraphs and falls well below the top-5 pipeline (-0.134 (paired 95% interval -0.196 to -0.071) against the root's budget-4 run).
The tool every agent on this page calls (src/scripts/demo_tool.py; real output, paragraphs cut to 160 characters):
def search(query, k=3, exclude=()):
"""bge-small exact search over the 9,760 paragraphs; already-seen paragraphs are skipped"""
return A.ranking(query, exclude)[:k]
first = search(q["question"])
second = search("Russian Civil War end date", exclude=first)
Question: Alexander Kerensky was defeated and destroyed by the Bolsheviks in the course of a civil war that ended when ?
Observation:
[1] Russian Civil War: The Russian Civil War (Russian: ... November 1917 - October 1922) was a multi-party war in the for...
[2] Alexander Kerensky: Alexander Fyodorovich Kerensky (Russian: ... 4 May 1881 - 11 June 1970) was a Russian lawyer and ...
[3] Kerensky-Krasnov uprising: Kerensky-Krasnov uprising was an attempt by Alexander Kerensky to regain power after the ...
Observation:
[1] Battle of Romanovka: The Battle of Romanovka was fought in June 1919 during the Russian Civil War. ...
[2] Communism in Russia: Communism in Russia began after Tsar Nicholas II lost his power during the February Revolution. ...
[3] Left-wing uprisings against the Bolsheviks: The left-wing uprisings against the Bolsheviks were a series of ...
gold: ['Socialist Revolutionary Party', 'Russian Civil War']
The answer (October 1922) is in the first result; the second gold paragraph (the Socialist Revolutionary Party, which links Kerensky to the war) is never found, and a second search for the war's end date only returns more war. Excluding already-seen paragraphs is a design choice of the root's tool: every search must show something new.
Qwen3's chat template renders a JSON tool as a <tools> block in the system turn and asks for calls inside <tool_call> tags: "native tool calling" is a prompt convention the model was trained on, and the call is text the harness parses (Building a harness shows the full rendering).
A bridge question ("Where was the music festival Billy McFarland was charged with wire fraud for supposed to take place?") names the first thing (Billy McFarland) but not the second (the Fyre Festival). The question finds the first paragraph easily: one gold paragraph is in the top 3 for 198 of 200 questions. The second paragraph is about something the question never names, so it ranks low (median rank 3); for 78 questions it is not in the first top 3. What should the second search say?
So every iterative method in section 3 is a different way of getting the bridge entity into the next query. ReAct lets the model write the query; Self-Ask makes it ask an explicit follow-up question; IRCoT uses its last reasoning sentence verbatim; decomposition writes the sub-questions in advance, so it cannot know the entity unless it fills in the first answer. A larger model writes better queries; a small one benefits from structure that forces the entity in. "Did the next query contain the entity just read" is a cheap trajectory metric (section 6).
Of the 78 questions whose second paragraph is not in the first top 3, how many each second query finds in the top 3 (bge-small, first search's results skipped) measured. The exact entity name finds it every time (its title is the entity). HotpotQA's labelled supporting sentence of hop 1, what a perfect reasoning step would write after reading it, finds it for 37; the question plus that sentence for 50. The 1.7B ReAct agent made a second query for 55 of these questions; where its own first query had not already found hop 2 (50), the second found it in the top 3 for 18 (median rank 22), and only 12 of its 55 second queries contained the entity's name; the decomposition program's second sub-question found it for 11 of 60. The gap between the oracle bars and the agent's is query writing, not retrieval.
Five published ways to interleave retrieval with generation differ in two things: where the next query comes from and who decides to stop. All are run here on the same 200 questions, tool and generators; the papers' own results are on other models and corpora and sit in the closed blocks.
Most flexible, and it pays the quadratic tokens of section 1 and every failure of a model judging its own progress. Here F1 0.411 at 2,458 tokens and 3.67 s per question (root's run), level with the top 5 (paired difference +0.009, 95% interval -0.060 to +0.081): better on 48 questions, worse on 53. With Qwen3-4B, 0.574 against 0.490 for the top 5: the larger model gets more out of the loop.
Press et al. 2022 named the compositionality gap: the share of two-hop questions a model gets wrong although it answers both sub-questions right, roughly 40% across GPT-3 sizes. A follow-up question is a well-formed query that usually names the entity. Here F1 0.286 (95% interval 0.231 to 0.345) at 4,112 tokens: the 1.7B rarely decided it was done, ending by itself in 34 of 200 runs and using all 4 follow-ups in 144, often repeating the first one word for word. The 4B ended by itself in 194 of 200.
Trivedi et al. 2022: retrieve with the question, write one chain-of-thought sentence, search with that sentence, repeat until a sentence contains "answer is:". The oracle "sentence" bar of section 2 is IRCoT's best case here (37 of 78). Here, with a separate reader over everything collected, F1 0.442 (95% interval 0.384 to 0.504) at 1,015 tokens, the best iterative method; but it barely iterated: the 1.7B wrote "So the answer is" in its first sentence for 196 of 200, so the gain comes from a reasoning sentence plus a reader, not from a second retrieval. Given both gold paragraphs it was right 62% of the time, the highest of any strategy. The 4B comes within a few points of its ReAct loop at less than half the tokens.
Jiang et al. 2023: if any token of the draft sentence has probability below θ, search with the sentence (tokens below β masked) and regenerate; the decision costs nothing extra, since the probabilities come with the tokens. Here (θ 0.8, β 0.4, the paper's 2WikiMultihopQA setting) F1 0.400 (95% interval 0.342 to 0.461) at 811 tokens, level with the top 5 at about its cost. The draft was confident enough to skip the second search for 119 of 200, and a confident draft is not a right one: confidence in a short answer says little about whether the second hop was found.
A fixed program: one call plans, the program executes, the model never decides to stop or search again. Easy to bound (always 4 calls here), and it cannot loop; but a sub-question written before reading cannot name the bridge entity unless "#1" is filled correctly (11 of 60 second sub-questions found it). Here F1 0.335 at 1,961 tokens (root's run). LangGraph's plan-and-execute template and most deep-research planners have this shape (section 7).
Jin et al. 2025 train Qwen2.5-3B and 7B with reinforcement learning (PPO; GRPO also tested) to emit <search> queries inside their reasoning; a retriever inserts the results, and only the final answer's exact match is rewarded. The retrieved tokens are masked out of the loss, so the policy is not trained to predict text it did not write. The policy learns when and what to search, which is the query-writing gap of section 2. Not run here (GPU-days); RL itself is on Topic: rl.
F1 with Qwen3-1.7B (open dot) and Qwen3-4B (filled dot), same 200 questions, tool and answer prompt (s3; the root's one-call 4B runs used prompt s2, which did not hurt the 4B: 0 wrongly typed yes/no answers, root README) measured. Every method gains between 0.09 and 0.17 F1 from the larger model (the top 5 the least, Self-Ask the most), about as much as separates the best and the worst method at either size. ReAct with Qwen3-4B: 0.574 at budget 4, 0.549 at budget 2 and 0.572 at budget 6.
ReAct: Yao et al. 2022, the ReAct paper page: free-text "Thought", a tool "Action", an "Observation", repeated.
Self-Ask (arXiv 2210.03350): the prompt makes the model write "Are follow up questions needed here: Yes." / "Follow up:" / "Intermediate answer:" / "So the final answer is:", each follow-up sent to a search engine. Published (Table 1, Davinci-002): Bamboogle chain of thought 46.4%, Self-Ask 57.6%, Self-Ask with search 60.0%; 2WikiMultiHopQA 29.8, 30.0, 40.1 published. Run here as a chat-model version: each call writes the next line, a follow-up is searched with top 3 and answered from those paragraphs, and a reader answers at the step limit of 4; 5.34 s per question. On 60 held-out questions the original completion-style prompt scored 0.116 (the chat model restarted the question instead of continuing the trace); the chat version 0.365.
IRCoT (arXiv 2212.10509): until "answer is:" or 8 steps, keeping at most 15 paragraphs (BM25, K of 2 to 8 per step, tuned on dev). Published answer F1 (Table 4), one retrieval against IRCoT: HotpotQA 49.7 to 59.1 with Flan-T5-XXL and 53.6 to 60.7 with GPT-3 (code-davinci-002); 2WikiMultihopQA 54.8 to 68.0 with GPT-3 published. Run here with bge-small top 3 per step, at most 4 steps, then a reader over everything collected (IRCoT separates retrieval from reading); the prompt chosen on 60 held-out questions, 0.541 against 0.459 for a variant that forbade answering early; 1.48 s per question.
FLARE (arXiv 2305.06983): published (Table 1, text-davinci-003, 2WikiMultihopQA EM / F1): single retrieval 39.4 / 48.8, question decomposition 47.8 / 56.4, FLARE 51.0 / 59.7 (θ 0.8, β 0.4, Table 9) published. Run here with token probabilities from llama-server's OpenAI-compatible logprobs field: a draft from the top 3, and on low confidence 3 more paragraphs found with the question plus the confident part of the draft.
Search-R1 (arXiv 2503.09516): retriever E5, top 3, 2018 Wikipedia; no format reward. Published: about 24% (7B) and 20% (3B) average improvement over RAG baselines across seven QA sets; average EM 0.304 for RAG against 0.431 for Search-R1 with Qwen2.5-7B base (Table 2) published.
The 4B runs (this page, answer prompt s3) measured: IRCoT 0.548 (1,098 tokens), Self-Ask 0.457 (1,361), FLARE 0.526 (792), CRAG-style 0.458 (1,030); the root's 4B runs: top 5 0.490, decomposition 0.488, long context 0.576.
A pipeline answers from whatever came back; a loop searches again only when the model notices. A retrieval evaluator judges the results separately (good enough, useless, in between), so extra searches are spent only where needed. Two published designs: Self-RAG (Asai et al. 2023) trains the generator itself to emit reflection tokens (Retrieve: search now?; ISREL: is this passage relevant?; ISSUP: is my sentence supported by it?; ISUSE: how useful is the answer); CRAG (Yan et al. 2024) puts a small fine-tuned T5-large in front that scores each document and picks Correct (keep and refine), Incorrect (discard, rewrite the query, search the web) or Ambiguous (both).
The best paragraph's cross-encoder score scores AUROC 0.43 for "both gold in the top 5", below a coin: a very relevant top paragraph usually means the search locked onto the first hop, and the rest are near-copies of it. The second-best score is the useful one (0.64), and agreement between BM25 and dense search is the best single signal (0.69). For multi-hop questions an evaluator must judge the set against everything the question needs, not each result against the question; CRAG's per-document scores were designed for single-hop sets (PopQA, PubHealth, ARC, biographies). No signal predicts the 1.7B's answer well: the best is the second-best cross-encoder score (0.60), and a cross-validated logistic regression on all 8 signals reaches 0.57.
Three evaluator policies, measured. Escalate when the evaluator's best score is below its median (use the agent loop's recorded answer, else the top 5): F1 0.390 (against always-pipeline -0.012, 95% interval -0.055 to +0.034), the same as escalating a random half (0.406). Correct, as CRAG does: thresholds at the 33rd and 67th percentiles split the questions into 66 correct, 68 ambiguous and 66 incorrect; on incorrect the model rewrites the question into keywords and the new top 5 replaces the old, on ambiguous it is added. F1 0.332 (95% interval 0.274 to 0.391) at 1,050 tokens, below the plain top 5 (0.402): throwing away results that found the first hop, because the set "looks wrong", removes half of what a two-hop question needs. Self-check, as an untrained Self-RAG: the same 1.7B asked whether the paragraphs support its top-5 answer said "supported" for 187 of 200 answers, only 77 of them right; falling back to the agent loop on "no" scored 0.420 at 1,632 tokens. An untrained small model is not a critic of its own answers, which is why Self-RAG trains one.
For each signal the pipeline has before generating, the AUROC: the probability that a question where the search succeeded scores higher than one where it failed (0.5 is a coin). Targets: both gold paragraphs in the top 5 (137 of 200) and the pipeline's answer right (F1 at least 0.5, 80 of 200). The cross-encoder is the running example's 22 M ms-marco MiniLM-L6 over the top 5, standing in for CRAG's T5 measured on Apple M1 Pro (CPU), deterministic.
Self-RAG (arXiv 2310.11511): Retrieve takes yes, no or continue; ISSUP fully, partially or not; ISUSE 5 to 1. A critic model (Llama2-7B trained on 4k to 20k GPT-4 judgments per token type) labels about 150k training examples offline (145,619), and the generator (Llama2 7B or 13B) is fine-tuned on them; at inference the tokens drive retrieval and a beam search over segments. Published (Table 2): PopQA 54.9 / 55.8% for Self-RAG 7B / 13B against 51.8% for Llama2-chat-13B with retrieval; PubHealth 72.4 / 74.5 against 52.1 published.
CRAG (arXiv 2401.15884): the T5-large (0.77 B) scores each document from -1 to 1; any above an upper threshold means Correct, all below a lower threshold Incorrect, otherwise Ambiguous. Kept documents are cut into strips, scored and filtered ("decompose then recompose"). Thresholds are set per dataset (for PopQA upper 0.59, lower -0.99). Published: on the Self-RAG 7B generator, PopQA 52.8 for plain RAG against 59.8 for CRAG, PubHealth 39.0 against 75.6 (Table 1); the evaluator tells relevant from irrelevant with 84.3% accuracy against 58.0% for ChatGPT prompted to judge (Table 4) published.
| Signal (computed before generation) | AUROC: both gold in top 5 | AUROC: answer right |
|---|---|---|
| cross-encoder logit of the best of the top 5 (CRAG-style) | 0.43 | 0.54 |
| cross-encoder logit of the second best | 0.64 | 0.60 |
| bge-small cosine of the top 1 | 0.64 | 0.56 |
| top-1 minus top-3 cosine | 0.59 | 0.47 |
| BM25 and bge-small agree on how many of the top 5 | 0.69 | 0.58 |
| question contains a comparison word (or, both, first, older, ...) | 0.62 | 0.50 |
| logistic regression on all 8 signals, 5-fold cross-validated | n/a | 0.57 |
The agent loop costs 2,458 tokens per question against 735 for the pipeline, and most real traffic is easy. A router looks at the question once and sends it to the cheapest strategy likely to answer it. Adaptive-RAG (Jeong et al. 2024) trains a T5-Large classifier on question complexity to choose no retrieval, one search or the multi-step loop, and gets close to always-multi-step accuracy at well under half its time, although its classifier is right only about half the time (details below). Here every router chooses between two recorded strategies per question, so each policy is exact and costs no new generation (the router's own cost is not counted: the signals come from the search the pipeline makes anyway; the cross-encoder adds 58 ms for 10 pairs on this laptop, root pipeline runs).
Most routers land on the grey line between always-pipeline and always-agent: the learned router barely sends anything to the agent, and the evaluator-based one does no better than a random split. One beats the line: the rule that sends questions containing a comparison word (or, both, first, older, ...) to the agent, F1 0.444 at 1,143 tokens, +0.042 over always-pipeline (paired 95% interval +0.003 to +0.081). On the 49 questions with such a word (33 of them HotpotQA comparison questions) the agent scores 0.602 against 0.43 for the pipeline: two named things are two searches, and the loop makes them. The learned router's cross-validated AUROC for "the agent beats the pipeline on this question" is 0.48; the agent won on 48 questions, lost on 53 and tied on 99, and beyond the comparison cue which ones is mostly how a 1.7B model happened to read. The oracle over all 8 recorded strategies would reach 0.731 at 927 tokens, headroom nothing measured here can predict.
A router cannot help when the expensive path is not better. On the mixed set of the root's agent runs (Topic: rag-and-retrieval) (199 questions, about half constructed one-hop), always-pipeline scored 0.512 at 766 tokens, always-agent 0.451, its learned router 0.500 and its LLM router 0.520 (which sent almost nothing to the agent). An Adaptive-RAG-style three-way router prompted to the 1.7B on the 200 two-hop questions labelled 0 none, 0 one and 200 many: right every time, so routing reduced to always-agent (F1 0.411 at 2,458 tokens). How to check a router: put it on the cost-accuracy plane against always-cheap, always-expensive, a random split of the same share and the oracle; it must beat the random split, on your own traffic mix.
Intervals are 95% bootstrap intervals over questions (500 resamples, fixed seed). The learned router is a logistic regression on 8 query-time signals, 5-fold cross-validated, so each question's probability comes from a model that never saw it (src/scripts/s_router.py). The comparison-word rule escalates the questions containing one, so its share does not move.
| Policy | F1 | 95% interval | Tokens | Sent to the agent |
|---|---|---|---|---|
| always the top-5 pipeline | 0.402 | 0.341 to 0.463 | 736 | 0% |
| rule: comparison word in the question → agent | 0.444 | 0.381 to 0.507 | 1,143 | 24% |
| learned router (logistic regression, cross-validated), p ≥ 0.5 → agent | 0.407 | 0.346 to 0.468 | 782 | 3% |
| random half → agent | 0.406 | 0.346 to 0.466 | 1,452 | 50% |
| CRAG-style evaluator below median → agent | 0.390 | 0.332 to 0.450 | 1,794 | 50% |
| always the agent | 0.411 | 0.349 to 0.474 | 2,458 | 100% |
| oracle: whichever of the two scored higher | 0.555 | 0.495 to 0.616 | 1,108 | 24% |
| oracle over all 8 recorded strategies | 0.731 | 0.678 to 0.780 | 927 | n/a |
Adaptive-RAG with FLAN-T5-XL reached 46.94 F1 against 48.85 for always multi-step, at 3.60 against 8.81 times the single-step time (Table 1), although the classifier was right only 54.52% of the time (Table 4); a perfect router would have reached 56.28. Per-query times: 0.35 s with no retrieval, 3.08 s with one search, 27.18 s multi-step (Table 3) published.
A final answer is right or wrong, but the run behind it is a sequence of decisions: which query, which results, when to stop. Scoring only the answer cannot tell a retrieval failure from a reading failure, or a lucky guess from a grounded answer. The root splits a pipeline's accuracy as A = rK × pk|K × g (retrieved, placed in the prompt, used); for a trajectory the same split applies to everything the model read along the way, which puts every question of every strategy in one of four bins ("right" = F1 at least 0.5) measured:
Each step adds one strategy's bar; the buttons on the card switch the comparison.
The top-10 pipeline put both gold paragraphs in front of the model for 164 questions, the agent for only 114 (it often stopped early, section 1), long context for all 200. Given both, reading success is similar for every retrieval strategy: agent 59%, top 10 51%, top 5 53%, top 2 58%, the question's own 10 paragraphs 48%, falling to 32% in an 8k window. The biggest single loss is the second hop never read (56 questions for the agent, 53 for the top 5). Re-answering each multi-search trajectory from everything it read, in one prompt without the thoughts, gives F1 0.412 against the agent's own 0.407 on the same 131 questions: what the loop adds is evidence, not better reading.
Two cautions. The agent was right 23 times without reading both gold paragraphs (comparison questions answered yes or no, or from memory; closed book was right on 32): an answer metric credits those. And reading can fail for reasons unrelated to retrieval: the first 1.7B runs used an answer prompt that made the model answer "yes" or "no" to open questions (63 of 200 single-shot answers, found by the root), and the same top 5 scored 0.249 instead of 0.402, a larger gap than between any two architectures here. Counting answers of the wrong type is a one-line check.
| Metric | What it catches | Here (agent loop, 200 questions) |
|---|---|---|
| gold evidence read anywhere in the trajectory | retrieval failure against reading failure | both gold: 114; one: 56; none: 7 |
| searches until the evidence was complete | efficiency; wasted searches after it | 32 at 1, 72 at 2, 10 at 3 or 4; 28 wasted |
| stopped before the evidence was complete | overconfident stopping | 75 (52 wrong) |
| repeated query, unparseable step, budget hit | stuck loops and format failures | 28, 17, 28 |
| next query contains the entity just read | the second-hop query-writing gap | 12 of 55 second queries (section 2) |
| right answer without the evidence | guessing, memorisation, leakage | 23, and wrong with both in hand 47 |
All of these need gold evidence labels (which paragraphs answer each question). Without labels the same questions go to a judge model ("does this observation contain what the next step needs?"), with the judge's own error measured on a labelled sample: Agent and trajectory evaluation and RAG and retrieval evaluation. The Trajectory comparer shows 40 of the 200 questions step by step under five strategies, with these bins and counters.
Some questions are reports, not facts ("compare the GPU export rules of three countries since 2022"): dozens of searches, more text than one window holds, and a cited write-up. Deep-research systems scale the agent loop with three additions: a planner that splits the task, parallel sub-agents that each research one part in their own context window, and compression of what each found before it returns, so the lead's window holds summaries, not pages. Not run here: each needs a web search API key, and this topic runs without paid APIs; the shapes are read from the open projects' source at pinned commits and the vendors' documentation.
Fig. 4 is the shape of open_deep_research (LangChain, read at commit 1b7d2e8) with its default budgets (the counts are its defaults, the sizes illustrative); Anthropic's Research system has the same orchestrator-worker shape (a lead "spins up 3-5 subagents in parallel", each using "3+ tools in parallel").
ConductResearch; up to 5 researcher sub-graphs run at once (extra calls are rejected).What it costs and buys (vendor claims, on vendor-run evaluations): Anthropic reports that agents "typically use about 4× more tokens than chat interactions, and multi-agent systems use about 15× more", that on BrowseComp "token usage by itself explains 80% of the variance", and that the multi-agent system "outperformed single-agent Claude Opus 4 by 90.2% on our internal research eval" (Anthropic engineering, 13 June 2025) vendor. OpenAI's BrowseComp (arXiv 2504.12516, 1,266 hard-to-find questions) scores GPT-4o 0.6%, GPT-4o with browsing 1.9%, o1 9.9% and Deep Research 51.5% (Table 3; Deep Research was trained on similar data); human trainers solved 29.2% published by OpenAI. Three lessons carry over to a retrieval system you build: the sub-agent's value grows with how much must be read, and its cost is the 15 times tokens; check citations in code (open_deep_research's citations are written by the model and never checked; GPT Researcher only tells the writer not to cite sources it was not given); and stopping is set by budgets in prompts and config, as in section 1, only larger. Context engineering covers sub-agents and compaction as harness techniques; LangChain and LangGraph the graph framework two of these are built on.
| System (read on) | Shape | Default budgets and stopping | Compression |
|---|---|---|---|
| open_deep_research, commit 1b7d2e8 (2026-08-10) | brief, supervisor, parallel researcher sub-graphs, report | 6 supervisor rounds, 5 parallel units, 10 tool calls per researcher | pages to "about 25-30 percent"; findings compressed with citations |
| GPT Researcher v3.7.0 (2026-09-26) | 3 sub-queries plus the original, in parallel; one writer pass; deep mode breadth 3, depth 2 | one pass, no reflective loop; context 25,000 words | extractive (BM25 over chunks), not an LLM summary |
| dzhng/deep-research, commit 1f8f3e2 | recursive breadth x depth, half the breadth per level; default 4 x 2 | depth reaches 0 | only "learnings" carried forward |
| Anthropic Research (post of 13 June 2025) | lead (Claude Opus 4) and 3-5 parallel sub-agents (Sonnet 4) | prompt rules: 1 agent and 3-10 tool calls for a simple fact; over ten sub-agents for complex research | sub-agents condense before returning; a CitationAgent places citations |
| OpenAI deep research (launched 2 Feb 2025) | a version of o3 trained for browsing | 5 to 30 minutes; API max_tool_calls | not disclosed |
| Gemini Deep Research (docs of 2026-10-13) | an agent in Google's Interactions API, background only | up to 60 minutes; about $1 to $3 per task ($3 to $7 for Max) | not disclosed |
Products change monthly; the table is dated per row and its latest numbers belong to tech news. Vendor figures are labelled vendor.
open_deep_research (main at 1b7d2e80): clarify, write a research brief, a supervisor calling ConductResearch, researcher sub-graphs in parallel (asyncio.gather), final report (deep_researcher.py lines 708-716, 303). Supervisor rounds max_researcher_iterations = 6; max_concurrent_research_units = 5 (extra calls rejected); researcher tool calls max_react_tool_calls = 10 (configuration.py lines 64-108); prompt rules "Simple queries: 2-3 search tool calls ... Always stop: After 5" (prompts.py 166-168). Two compression stages: each web page summarised to "about 25-30 percent of the original length" by gpt-4.1-mini; each researcher's findings compressed "verbatim" with inline citations before returning; the supervisor sees only compressed_research.
GPT Researcher v3.7.0 (0957c301): MAX_ITERATIONS = 3 counts sub-queries, not rounds; deep mode recurses with breadth 3, depth 2 (9 nested researchers) and stops at depth 1. BM25 (k1 1.5, b 0.75) over 1,000-character chunks keeps chunks scoring at least half the best, up to 25 (context/select.py, lexical.py); real cost tracking from provider usage (utils/costs.py).
dzhng/deep-research (main at 1f8f3e28): write up to breadth search queries, extract at most 3 "learnings" and follow-up questions each, recurse with half the breadth (src/deep-research.ts 176-294); pages cut to 25,000 tokens; can point at any OpenAI-compatible endpoint, llama-server included.
Anthropic Research: sub-agents search in parallel "before condensing the most important tokens for the lead research agent".
Dated prices and scores vendor: Gemini Deep Research is offered as deep-research-preview-04-2026 and deep-research-max-preview-04-2026 with Google Search, URL context and code execution; Google's April 2026 chart puts Deep Research Max at 85.9% on BrowseComp. OpenAI's deep-research API models (o3-deep-research at $10 / $40 per million input / output tokens, o4-mini-deep-research at $2 / $8) had a shutdown date of 23 July 2026 in OpenAI's docs, read 2026-10-14; background mode was recommended.
Qwen3-1.7B and 4B read 32,768 tokens natively (their model cards; the GGUF files declare 40,960), frontier models a million or more. If the documents fit, why retrieve? The root's section 5 prices one query both ways (retrieval against the whole corpus in the window); the published head-to-head results are in this page's closed blocks; this section measures what reading more does to accuracy and what it costs on this laptop. How much of a window a model really uses (effective context) is owned by Long context.
Same 200 questions, same 1.7B model and prompt; only how much is read changes (root's recorded runs) measured. More retrieved paragraphs raise the chance that both gold paragraphs are present (top 2: 94 questions, top 10: 164) and buy a little F1: top 2 0.385, top 5 0.402, top 10 0.425, so one plain top-10 search scores above the agent loop (0.411). Long context guarantees them for all 200: the question's own 10 paragraphs (about 1.5k tokens) score 0.456, the best strategy here (+0.054 over the top 5, paired 95% interval +0.003 to +0.108); an 8k window full of on-topic distractors scores 0.320, below every retrieval strategy, at 14.64 s per question. Qwen3-4B: 0.576 and 0.475.
F1 with the gold block at five positions among on-topic distractors, at 5, 10, 40 and 80 paragraphs (mean prompt tokens 749, 1,485, 5,943, 11,890), first 50 questions, Qwen3-1.7B measured. First / middle / last: 5 paragraphs 0.603 / 0.548 / 0.556; 10: 0.641 / 0.519 / 0.569; 40: 0.577 / 0.467 / 0.522; 80: 0.588 / 0.360 / 0.529. At 80 paragraphs a gold block in the middle loses 39% of the F1 it has at the start; the start holds up at every length. With 50 questions each cell is noisy (95% bootstrap intervals about ±0.12): the trend across lengths is the finding. Published, the effect's name: Liu et al. 2023 (arXiv 2307.03172), GPT-3.5-Turbo with 20 documents, 75.8% with the answer document first, 57.2% fifth, 53.8% tenth, 55.4% fifteenth, 63.2% last, against 56.1% with no documents (Tables 1 and 6) published. For retrieval: put the best-ranked passages first and keep the window short.
F1 by where the gold block sits, at four window lengths; 50 questions per point, Qwen3-1.7B measured.
Before its first token the model runs every prompt token through every layer (prefill): a part linear in the prompt length (the weight matrices, once per token) and a part that grows with its square (each token's attention reads all earlier keys and values). A model fitted to the 5,497 generator calls the root recorded (llama-server's own timings, prompt cache on, 1.7B, up to 8,065 tokens), with nnew the tokens computed and nctx the whole prompt:
Extrapolated, the model gives about 27 s at 16k tokens and 80 s for a full 32k window, 67% of it attention (at 1,500 tokens attention is 8%); 32k remains an extrapolation. Decoding also slows as the cache grows: about 10.4 + 0.67 ms per output token per thousand tokens of context (fitted on 5,497 calls). The shape (a linear term, an attention term that dominates past a few thousand tokens, a cache that grows with the window) holds on any GPU; datacenter GPUs and FlashAttention kernels change the constants by an order of magnitude or more (not run here). Hosted APIs hide prefill in the time to first token and bill it per token; a cached prefix is billed at a discount and skips the prefill. The Long-context calculator puts both sides together: tokens, dollars at dated list prices, seconds on this laptop, KV memory.
Recorded prompt-processing time against the formula, both log scale; a point on the dashed line is predicted exactly. Blue: held-out calls within the fitted range; fitted on half the calls, it predicts the other half within 4.0% on average (3.3% on the 221 calls over 2,000 new tokens). Orange: 49 calls of this page's lost-in-the-middle run at 9k to 15,077 tokens, off by 5.9% on average measured on Apple M1 Pro (Metal). An independent check: the RAG in production child timed 9.34 s to the first token for a 7,611-token prompt; the model gives 9.34 s.
Published head-to-heads say the same. More retrieved passages is not monotone: for many long-context models quality "initially improves" and then declines as the count grows, mostly because of hard negatives (passages that look relevant and are not); reordering the retrieved passages, without training, recovers part of it (Jin et al., arXiv 2410.05983, Oct 2024). And there is no single winner: LaRA's 2,326 test cases over 11 models (seven open, four proprietary) found that "the optimal choice between RAG and LC depends on a complex interplay of factors": model size, long-text ability, context length, task type and the retrieved chunks (LaRA, arXiv 2502.09977, Mar 2025). So evaluate recall@k and end-to-end accuracy together across k, on your own questions.
KV cache at fp16 from the configs (2 × layers × KV heads × head dimension × bytes; sizing in general is on Long context): Qwen3-1.7B 114,688 bytes (112 KiB) per token, so 3.5 GiB for 32k tokens; Qwen3-4B 144 KiB, 4.5 GiB, on a 16 GB machine that also holds the weights.
A window size says what the model accepts, not what it uses. How RULER turns a falling curve into one "effective length" (and the claimed against effective lengths it publishes), the Qwen3 rows of its leaderboard that contradict its own rule, and NoLiMa's drop once question and answer share no words are owned by Long-context and multimodal benchmarks (its RULER and NoLiMa sections).
An agent working for hours, or across sessions, produces more history than fits in its window, and re-reading it all on every step is the quadratic cost of section 1. Agent memory stores that history outside the window and retrieves from it: everything about retrieval carries over, except that the corpus is written by the process that will search it and changes on every step. What to write, when to curate, fact stores (Mem0), temporal graphs (Graphiti) and memory files are owned by Context engineering, which measured all three in a twelve-session experiment. The retrieval question this page measures: once the task is known, which of the agent's own reads should the final step keep? Write-time curation (distil each step into a fact) loses whatever the distillation dropped; read-time curation keeps the raw history and selects with the current task as the query (Just-in-Time Memory argues for it and gains 16.2 points on ALFWorld, mostly from training the curator). The plainest read-time design is also the baseline every memory system must beat: Bao et al. 2026 (arXiv 2610.30755) run "Raw-RAG", dense retrieval plus a reranker over the raw conversation history, against agentic memory systems on LoCoMo, LongMemEval, MEME and MemoryAgentBench, and it "ranks first among the compared memory systems in six of seven benchmark-model settings", by 0.13 to 5.53 points over the strongest one published. Their reading: raw history covers more of the needed evidence, which outweighs the reader using it less efficiently, and even full access to a transformed memory store leaves an accuracy gap, because the transformation already lost information.
Re-answering from the curated memory in one prompt (no thoughts), on the 131 trajectories with at least two searches (the agent's own answers: F1 0.407) measured: everything read 0.412 at 1,131 tokens, the last observation 0.296 at 481, the top 3 by question plus last thought 0.378 at 442. How to check a memory system: plant facts in early turns and ask about them later, measuring recall of the planted memory (did retrieval return it) apart from the answer; add superseded facts (an old address, then a new one) and check the newer wins; log every write, so a wrong answer can be traced to a write that never happened, a retrieval that missed, or a reading failure.
The 92 root trajectories that searched at least twice and read both gold paragraphs; what the final step keeps, bge-small similarity, deterministic measured. A sliding window (the last observation only) keeps both gold paragraphs 1 time in 92: in a multi-hop task the first hop is, by construction, not in the last observation. The top 3 read paragraphs by similarity to the question plus the agent's last thought keep both in 85 of 92 at 341 instead of 885 tokens; with the question alone, 75. Top 2 / 4 by question plus thought: 73 / 90 at 225 / 467 tokens.
Mem0 (arXiv 2504.19413) extracts facts per turn and updates a store of them; its published latency, token and accuracy figures against full context, and a recorded run of it, are on Context engineering, section 8. Zep's Graphiti (arXiv 2501.13956) stores facts in a temporal graph with validity windows; LongMemEval 71.2% against 60.2% for full context with gpt-4o published by the Zep authors. The Proactive Memory Agent adds the timing question: a second model deciding when to remind the worker.
Optional rehearsal; each answer points back to the section that measures it.
These are the recorded runs this page reuses (the root page's src/agent). Machine: Apple M1 Pro (8 performance and 2 efficiency cores, 16 GB unified memory), llama.cpp build 11146 with Metal for the generator, PyTorch on the CPU for the search tool's query encoder, October 2026. Generators: Qwen3-1.7B and Qwen3-4B, 4-bit GGUF (Q4_K_M), temperature 0, seed 0, thinking switched off (enable_thinking: false), one request at a time, prompt cache on; outputs are cached by exact prompt, so every number is reproducible without rerunning the models. Search tool: bge-small-en-v1.5, exact search, and the agent is never shown a paragraph twice (each search returns the 3 best paragraphs it has not seen); search time is milliseconds and is included in seconds per question. Qwen3-Embedding lists HotpotQA among its training data, so its HotpotQA results are in-domain, not zero-shot; that is why the search tool is bge-small. Metrics: HotpotQA's official answer normalisation (lowercase, strip punctuation and the articles a, an, the, collapse spaces), exact match and token F1 with its yes/no rule; "gold seen" is the share of the two gold paragraphs that reached any prompt. Each strategy's answer prompt was chosen among two candidates on 60 held-out HotpotQA dev questions (from the other 800 whose paragraphs are in the corpus), never on the 200 test questions. Held-out tuning had picked a prompt without the list of answer forms ("Give only the answer, in as few words as possible"), but a scripting error kept it out of the first 1.7B test runs; every one-call 1.7B row was rerun with the held-out choice, and the first runs are kept as out/strategies_s2prompt.json. The 4B was unaffected: its single-shot, long-context and position runs used the other candidate prompt, made no yes/no mistakes with it, and were not rerun. Not run: the full HotpotQA corpus (5.2 million paragraphs, too large to embed on the laptop), thinking mode (about 8 s per answer, hours for a loop over 200 questions), and long context beyond 8k tokens (prefill alone about 25 s or more per question for the 1.7B, extrapolated from 9.3 s at 7.6k tokens).
Sources: measured results come from the root's recorded agent runs and this page's scripts (src/scripts/), on an Apple M1 Pro, 2026-10-14; published results link their papers and are the authors' or vendors' own runs. Reruns from cache: src/scripts/run_pending.sh (all runs made by 2026-10-15). Old-page corrections: src/coverage.md.
One question, five strategies, side by side, from the root's recorded agent runs (Qwen3-1.7B Q4_K_M, temperature 0; nothing is generated in the page). Each search shows its query and the 3 paragraphs it returned, gold paragraphs in green; the agent's thoughts are in italics (cut to about 110 characters). Press play to run all lanes on one clock in recorded seconds: the pipeline is done while the agent is still on its first step. Counters: model calls, tokens billed (every call's whole prompt plus output), tokens actually computed with llama-server's prompt cache, and seconds. Bins as in Reading section 6: right (F1 at least 0.5), read wrong (both gold read), one gold read, none.
The 40 questions are the first 40 of the 200 in the running example's seeded order (13 where the agent beat the pipeline, 5 where it lost). Seconds are wall-clock on the laptop under the root's bench lock, generator and search together; the first search of each recorded run also loaded the encoder, which shows as a slow first step (about 5 s) on the first question. The whole 200 are summarised in the Reading tab; the root page's step-by-step replay of selected questions was retired with its Agentic lab on 2026-10-24; its numbers are in the closed block at the end of the Reading tab.
The same question answered two ways: retrieve k chunks, or put the whole corpus in the window (once fresh, or with the corpus as a cached prefix). Tokens and dollars come from the formula C = pin Tfresh + pcache Tcached + pout Tout (plus a cache-write charge where the provider bills one) at dated list prices; seconds come from this page's prefill model fitted to the root's recorded Qwen3-1.7B calls on the laptop; memory from the Qwen3 configs.
Whether the prefill model holds (predicted against recorded, in and beyond its fitted range) and the accuracy of each choice are in Reading section 8.
Prices: vendor list prices read 2026-10-14 by the RAG in production child (OpenAI pricing page and Anthropic pricing page), per million tokens; Anthropic bills a 5-minute cache write at 1.25 times the input price, OpenAI bills no write. 4B seconds are the 1.7B model scaled by the measured ratio of the two models' time to first token at 7,611 tokens (23.6 s against 9.3 s, RAG in production child), labelled derived. KV memory is fp16 (llama-server's default), not counting the weights (about 1.1 GB for the 1.7B and 2.5 GB for the 4B at Q4_K_M). Beyond 40,960 tokens neither model runs without YaRN rope scaling.
The parent: the stage map and section 5 (who decides what to read) compare these strategies; its shared runs (src/agent) are the five strategies, tokens per step, lost in the middle on 20 paragraphs and a router on a mixed set, now taught here. 19 min
Global questions, graphs, communities, HippoRAG, text-to-SQL: the structure this page leaves out. 40 min
Chunking, query rewriting (HyDE, multi-query, decomposition), hybrid search and filters: what each search call is made of. 47 min
Cross-encoders (the evaluator used here), calibration and abstention, LLM rerankers. 34 min
Latency budgets, prefix caching, cost per query, access control. 37 min
The search tool's encoder and why Qwen3-Embedding is in-domain on HotpotQA. 30 min
Grading actions, not messages: judges for trajectories. 30 min
Faithfulness, groundedness, judged retrieval metrics. 27 min
Window budgets, caching, compaction, sub-agents, and agent memory: fact memory, temporal graphs, paging. 40 min
The loop, tools and budgets as harness design. 24 min
LangGraph, LlamaIndex and peers that implement these loops; LangChain and LangGraph in depth. 34 min
RULER, NoLiMa and how long-context claims are tested. 27 min
Prefill, KV cache, prefix caching on the serving side; Local and on-device inference for llama.cpp. 41 min
The RL behind Search-R1-style trained search agents. 20 min
The reason-act loop. 21 min
Where the term started. 19 min
When to remind an agent. 27 min
Read-time curation, trained. 19 min
Interleaving retrieval with chain of thought. 40 min
The compositionality gap and follow-up questions. 35 min
Active retrieval on low-confidence tokens. 35 min
Reflection tokens, trained. 40 min
A retrieval evaluator and corrective actions. 30 min
Routing by question complexity. 30 min
RL-trained search agents. 40 min
Orchestrator and sub-agents, token economics. 20 min
Supervisor, researchers, compression in about 700 lines. 60 min
The deep-research benchmark. 25 min
Position effects in long prompts. 30 min
Effective against claimed context. 30 min
Long context without literal matches. 30 min
Controlled pipeline against agent comparison. 45 min
A head-to-head evaluation. 45 min
An argued essay on retrieval in the age of agents (vendor blog; its "8 to 82 times cheaper" is their estimate). 12 min