When the Answer Is Scattered Across Dozens of Notes, Top-K Won't Save You

Lately I’ve been working on retrieval for a local knowledge base. The setup isn’t complicated: notes are spread across dozens or hundreds of Markdown files, and when you ask a question, the relevant records may be spread across a dozen of them. Reach for standard Top-K and you hit a wall quickly.

Turn K down and you miss things. Turn it up and the context fills up, with tokens growing faster than quality. At first I tried to find the balance point in K, and after a few tries realized the direction itself was wrong: K is a single number carrying two conflicting jobs, and no setting makes both ends happy.

One K doing two jobs

Standard RAG is a straight line: chunk, index, take the Top-K most similar at query time, stuff them into the prompt. In that line, K decides two things at once — how big the candidate pool is, and how much actually gets written into the context. To miss less you need a big pool; to keep the context cheap you need a small one. Both goals hang on the same number, so it never sits comfortably.

Split the two numbers apart and things get clearer.

The recall stage should only care about breadth: pull back anything that might be relevant. Add a rerank layer in the middle for precision. Then decide what goes into the context by token budget. Three numbers set separately: K only governs the first-stage coarse recall, so you can safely make it big. Growing the candidate pool from 20 to 150 costs extra local vector search and rerank compute; it adds nothing to generation tokens. The expensive part is the final model call, and how much it sees is set by the budget, not by the pool.

Anthropic’s 2024 post on Contextual Retrieval gives one set of numbers: they prepended a model-generated context blurb to each chunk before indexing, which took Top-20 recall failure from 5.7% to 3.7%; adding BM25 as hybrid retrieval brought it to 2.9%; layering rerank on top pushed it to 1.9%, 67% fewer failures than the baseline.

What I care about more in that set is another line: they tried 5, 10, and 20 chunks of context, and 20 worked best. In other words, once you’ve done reranking and context enrichment upstream, showing the model more passages doesn’t wreck the answer.

How chunks are cut also affects recall. Slice a note into a few hundred characters and the information about what the note is about is gone — pronoun references and temporal context are all severed. Anthropic’s approach is to have a model prepend 50 to 100 tokens of document-level context to each chunk at ingest time, a one-off cost. Local notes have a cheaper option: just prepend the title, the heading hierarchy, the folder, and the tags to the chunk. That structure already exists; no model call needed.

Scattered answers need coverage

The pipeline above lifts recall a notch, but it doesn’t fix the situation I opened with.

For a single-hop question, the answer lives in one or two paragraphs, and finding the paragraphs that look most alike is enough. But an aggregation question — what decisions did a project make over the last six months, or in which notes were two concepts compared — has a set of scattered evidence as its answer. Now Top-K optimizes the wrong objective: it’s finding the most relevant passages, while what you need is coverage.

There are a few inexpensive ways to get coverage in a local note collection.

The most direct is to raise the retrieval unit from “chunk” to “note.” Generate a summary for each note at ingest, search the summaries to locate notes first, then go into the matched note for the specific chunks. When the answer is spread across a dozen notes, this change does far more than tuning K — summaries don’t get shredded, a note gets nominated as a whole as soon as it’s tangentially relevant, and which passage to actually read is left to a later step.

One level up is a hierarchical index: chunks, sections, notes, topics each get a layer, and a query drills down from the top. RAPTOR takes that road, recursively summarizing documents into a tree where any node can be a hit. For a personal note collection, the folder tree and backlinks already exist, so half the tree is ready-made.

The query side can be split too. A request like “summarize every decision about this topic” can’t be expressed by one vector at all; decompose it into several sub-queries, retrieve each, then merge, and the hit surface widens considerably.

While you’re at it, add deduplication. Adjacent paragraphs of the same long note tend to hit together, and five or six slots end up saying the same thing. Group results by note after retrieval and keep only the top one or two passages per note, or use a diversity-penalizing ranking like MMR to force the context to spread its slots across different sources.

Agentic search changes a different variable

So far retrieval happens once, just as broadly and precisely as possible. Agentic search — the iterative retrieval that TREC 2025’s RAG track has been exploring, for instance by GRILL Lab and Glasgow Terrier — changes something else: it moves the moment when you decide the retrieval budget.

Static RAG has to fix K before it ever sees the question, because it doesn’t know how many pieces of evidence the question needs. In agent mode, the model can decide as it goes: search once, look at what came back, fill the gaps, stop when it has enough. A simple question and an aggregation question can spend completely different budgets.

Concretely, the loop looks roughly like this: the model writes its own query, reads results, decides whether to dig further or change direction; after hitting a note summary, it decides whether to call a tool to read the full text; at the end of each round it checks what it has found and what’s still missing. Retrieval becomes a tool in the model’s hands rather than a hard-coded function call.

Put the two structures side by side and the differences cluster in a few places:

Static RAG Agentic search
Retrieval passes Fixed, one Decided by the model as it goes
Basis for the next query Written before the question What the last round returned
Stopping condition K is used up Evidence is sufficient
How context enters Loaded in one batch Read as needed, keep only what’s useful
Main failure mode Missed recall Random search, repeated search, never stopping

How context enters also drives cost. Static RAG stuffs all K results in at once, most of them unused. An agent reads and filters as it goes, so by generation time the context holds mostly material it can actually cite. For cost-sensitive local deployments, that difference is not small.

But the price is direct too, starting with latency. Every step in an agent is serial: the model writes a query, retrieves, judges, and five to eight rounds means tens of seconds is normal. Total tokens may not be lower either; as rounds pile up, the cost of history and re-reading compounds, and you have to compress history mid-run and keep only conclusions to stay in control.

Two other costs are subtler. First, the quality of the underlying retriever is still the ceiling: an agent can only assemble what the index can bring back, so if recall is bad, it just repeats the same miss eight times. Second, behavior is unstable — duplicate queries, chasing irrelevant threads, not stopping when it should — and has to be boxed in by hard round limits and evidence checklists.

A paper from November 2025 (arXiv:2511.18177) compared several approaches on 1,200 SEC filings and 150 questions: agentic RAG based on hybrid retrieval plus metadata filtering beat a purely hierarchical retriever with no vectors, with a 68% win rate and slightly lower latency (5.2 s vs 5.98 s). But the same experiments contain two other numbers worth noting: a single cross-encoder rerank layer raised MRR@5 by 59 percentage points; small-to-big retrieval had a 65% win rate and cost only 0.2 s more.

So agentification does pay, but cheap improvements like rerank and small-to-big also pay clearly, and are much easier to build.

Agentic search is being sold as a cure-all lately. What it actually adds is two things: requests a single query can’t express, and retrieval budgets you can’t set before seeing the question. If the question is single-hop, or the material simply isn’t in the index, no number of rounds will help.

Tools matter more than prompts

If you really want to try agentic search on a local note collection, a few interface details matter far more than prompt wording.

The search interface should return note-level summaries, matching passages, and a note_id, leaving the full text for the model to fetch by id so it decides how deep to read. Add a separate grep tool — with a few thousand to a few tens of thousands of Markdown files locally, exact string matching comes back in milliseconds, and it beats vectors for finding numbers, names, and proper nouns. If you keep wikilinks in your notes, add a tool for walking to neighbor notes.

On the control side, cap rounds at 6 to 10, require each round to state what it already knows and what’s missing, and compress old retrieval results and intermediate output into summaries promptly so the context doesn’t balloon.

That said, I wouldn’t start with a full agent loop. Build a semi-fixed version first: retrieve normally by default, and only when the model judges the evidence insufficient, allow one or two extra rounds. The backbone looks roughly like this:

flowchart LR
    Q(["Question"]) --> Recall["1. Hybrid coarse recall<br/>(BM25 + vectors + note summaries)<br/>candidate pool K = 150"]
    Recall --> Rerank["2. Rerank and dedupe<br/>(cross-encoder + same-note folding)"]
    Rerank --> Pack["3. Pack to token budget<br/>final context ≈ 10~20 items"]

    Pack --> Check{"Enough evidence?"}

    Check -- "single-hop / evidence sufficient" --> LLM(["Generate answer"])

    Check -. "missing evidence (max 1~2 rounds)" .-> Tools["call local tools as needed<br/>grep | read_note(id) | wikilink"]
    Tools -. "compress intermediate results, append context" .-> Check

    style Recall fill:#f0f7ff,stroke:#91caff
    style Rerank fill:#f0f7ff,stroke:#91caff
    style Pack fill:#f0f7ff,stroke:#91caff
    style Check fill:#fffbe6,stroke:#ffe58f
    style Tools fill:#f6ffed,stroke:#b7eb8f,stroke-dasharray: 5 5

This compromise gets most of the benefit, keeps latency predictable, and is easier to align during evaluation. Once it runs smoothly, consider lifting the round limit.

The order I would do it in now

Starting from scratch, my order is fixed: hybrid retrieval plus rerank plus budget packing first — that’s the foundation, and without it every later step is dragged down by recall quality; then note-level indexing, which specifically addresses cross-document aggregation; then a semi-fixed loop that allows one or two extra retrieval rounds; full agent last.

flowchart TB
    subgraph S1["Phase 1: standard static RAG (one K, two jobs)"]
        direction LR
        Q1(["Question"]) --> V1["Vector retrieval (Top-K)"]
        V1 -- "stuff K items straight in<br/>(small K misses / large K blows tokens)" --> L1["LLM"]
    end

    subgraph S2["Phase 2: decouple recall and context (foundation)"]
        direction LR
        Q2(["Question"]) --> H2["Hybrid coarse recall<br/>(vectors + BM25 + summaries)<br/>large candidate pool K=150"]
        H2 --> R2["Rerank"]
        R2 --> B2["Dedupe by note &<br/>pack to budget"]
        B2 --> L2["LLM"]
    end

    subgraph S3["Phase 3: semi-fixed loop -> full agent (iterate as needed)"]
        direction LR
        Q3(["Question"]) --> H3["Phase 2 foundation<br/>first-round retrieval + packing"]
        H3 --> E3{"Evidence complete?"}
        E3 -- "missing piece: 1~2 extra rounds" --> T3["call tools: rewrite query /<br/>grep / read full text / follow wikilinks"]
        T3 --> C3["compress history & update checklist"]
        C3 --> E3
        E3 -- "enough" --> L3["LLM"]
    end

    S1 ~~~ S2 ~~~ S3

    style S1 fill:#fafafa,stroke:#d9d9d9
    style S2 fill:#f0f7ff,stroke:#91caff
    style S3 fill:#f6ffed,stroke:#b7eb8f
    style E3 fill:#fffbe6,stroke:#ffe58f

Whether to go all the way to a full agent comes down to two things. One is how often your everyday questions are aggregation or multi-hop: if they’re occasional, semi-fixed extra retrieval is enough; only a high share justifies a full loop. The other is the latency budget: if you need sub-second responses, a serial multi-round design can be dropped outright.

There is also a case where you don’t need RAG at all. Anthropic’s post notes that if the knowledge base is under 200k tokens (roughly five hundred pages), stuffing the whole thing into the prompt with prompt caching is simpler. If the local note collection is only a few hundred notes, do that math first — it may be far less work than building a retrieval pipeline.

Evaluation doesn’t need to be elaborate either. Three layers are enough: did the retrieval layer bring back the notes it should have (Recall@K); how much of what got packed into the context is actually relevant (context precision and recall); and is the answer correct, with citations that genuinely support it. You don’t need many questions — thirty to fifty you would really ask, with gold answers and the corresponding notes marked by hand, is enough to settle K and the budget.

If you already have a pipeline and can change only one thing, add rerank and budget packing first. The architecture barely moves, latency rises only slightly, and it beats blind trial and error on K, with steadier results.

Once that line is stable, decide whether to move toward an agent.