RAG Retrieval Depth: How Much Context Is Enough?

RAG Retrieval Depth: How Much Context Is Enough?

RAG retrieval depth is the number of passages a retrieval system fetches and passes to the generator before it writes an answer — the depth of the search behind each response. The central question is how deep to go, and the honest answer is that there is no single right number: too shallow and the answer misses key facts, too deep and the generator drowns in irrelevant context while costs and latency climb.

Depth is one of the simplest dials in a RAG system and one of the most consequential. It is usually set once, early, and then forgotten while the team tunes everything else. That is a mistake. The right depth depends on the corpus, the question type, the reranker and the generator, and it changes as any of those change. Getting it right is worth more than most model upgrades.

Key takeaways

  • RAG retrieval depth is the count of passages fetched per query; it trades coverage against noise, cost and latency.
  • Shallow retrieval is fast and cheap but misses facts spread across documents.
  • Deep retrieval improves coverage until the extra passages become mostly noise.
  • Depth should vary by query type, not stay fixed for every question.
  • Measure answer quality at several depths on your own data — the optimum is empirical, not theoretical.

What retrieval depth means in practice

Retrieval depth has two layers that are often confused. The first is the candidate depth: how many passages the retriever pulls from the index, often 50 or 100. The second is the context depth: how many of those passages actually reach the generator, often 5 to 10 after reranking. The first number decides what the reranker gets to choose from. The second decides what the generator gets to read.

Both matter, and they fail in different ways. A candidate depth that is too small starves the reranker: the right passage never enters the shortlist, so no amount of reranking can surface it. A context depth that is too large overwhelms the generator: the right passage is in there, but buried among irrelevant ones, and the model may quote the wrong passage or blend facts from several. Our guide to RAG context recall explains the coverage side of this trade-off in detail.

Depth is also where cost hides. Every extra passage adds tokens to the prompt, and generator pricing scales with prompt length. Doubling context depth roughly doubles the retrieval-related cost of every answer, while latency grows with it. A system answering thousands of queries a day pays for depth on every single one, so even a small reduction that keeps quality steady is worth real money.

Why shallow retrieval fails

Shallow retrieval — fetching only three to five passages — works well for simple factual questions with a single clear answer. It fails the moment the answer is spread out. A question comparing two policies needs passages about both. A question about a process needs every step in order. A question whose answer sits in a document the retriever ranked sixth will simply never be answered correctly at depth five.

The failure mode is easy to miss because shallow systems fail quietly. The generator does not report that it lacked context; it writes a confident answer from whatever it was given. The result looks complete and reads well, which is exactly why it is dangerous. The only reliable way to catch it is evaluation: test questions whose answers require facts from several passages, and check whether the system finds them all. If it does not, depth is the first dial to turn.

There is a second, subtler cost to shallow retrieval. It makes the system brittle to chunking. If a key fact sits at the edge of a chunk, or a chunk boundary splits a passage in two, a shallow fetch may return the wrong half. Deeper retrieval papers over these cracks by returning neighbouring chunks as well. That is not a substitute for good chunking, but it is a useful safety net while chunking improves.

Why deep retrieval fails too

If shallow retrieval starves the generator, deep retrieval floods it. Language models do not weigh twenty passages equally: they favour the beginning and end of the context and underuse the middle, a pattern often called the lost-in-the-middle effect. Passages placed in the middle of a long context contribute less than the same passages in a short one. Fetching more can therefore make the answer worse even though the right facts are present.

Noise is the other problem. Every irrelevant passage is an opportunity for the generator to go wrong: to quote a superseded policy, to mix figures from two different years, to answer a different question than the one asked. The more passages in context, the more such opportunities. This is why the precision side of the trade-off matters as much as recall, as our guide to RAG context precision shows.

Deep retrieval also costs time. Fetching, reranking and transmitting more passages adds latency at every stage, and long prompts slow generation itself. For an interactive assistant, the difference between a one-second answer and a four-second answer is the difference between a tool people enjoy and one they avoid. Depth is a latency decision as much as an accuracy decision, which is why the latency breakdown in RAG retrieval latency is worth reading before you raise the dial.

Layered document cards fanning out on a desk with one card in sharp focus in front
Depth is a trade-off, not a target: each extra passage adds coverage, but also noise, cost and latency.

How depth interacts with the rest of the pipeline

Depth never acts alone. A strong reranker makes deeper candidate retrieval worthwhile, because it can sort a long shortlist accurately. A weak reranker makes deep retrieval pointless: the extra candidates just add noise the reranker cannot filter. If you plan to increase candidate depth, make sure the reranker can handle the longer list first.

Chunk size interacts with depth too. Large chunks carry more information each, so fewer of them are needed to cover the same ground. Small chunks are more precise but need greater depth to assemble a complete answer. When you change chunk size, revisit depth at the same time; the two settings are two sides of one decision.

Query type is the third interaction, and the most useful one. Factual questions need little depth. Multi-hop questions need more, because each hop adds passages. Comparative questions need depth on both sides of the comparison. A fixed depth for all queries is a compromise that serves none of them well. The better design is adaptive depth: let the query type, or a simple difficulty signal, set the depth for each request.

Query type Typical candidate depth Typical context depth Why
Simple factual 10–20 3–5 One passage usually holds the answer
Procedural 20–30 5–8 Steps must arrive in order and complete
Comparative 30–50 6–10 Evidence needed for each side
Multi-hop 50–100 8–12 Each hop adds passages to cover
Exploratory 50–100 8–12 Broad coverage matters more than precision

Best for most teams: start with a candidate depth of 20 to 30 and a context depth of 5 to 8, then adjust per query type based on measured answer quality.

How to tune depth on your own data

Tuning depth is an experiment, and like any experiment it needs a fixed test set and a clear metric. Build a set of questions that covers your main query types, including questions whose answers need facts from several passages. Then run the system at several depths — say context depths of 3, 5, 8 and 12 — and score the answers for groundedness and completeness.

Plot the results. You will usually see quality rise steeply at first, flatten, and then sometimes fall as noise takes over. The sweet spot is the depth where quality stops improving, not the depth where it peaks by a fraction of a point. A depth of 8 that scores nearly the same as a depth of 12 is the better choice: it is cheaper, faster and less fragile.

Repeat the experiment when things change. A new document collection, a different chunk size, a new reranker or a new generator can all move the optimum. Depth tuning is not a one-off task; it is part of the regular evaluation cycle. The habits in our RAG pipeline optimisation guide apply here: change one thing, measure, keep what works.

Two practical techniques help when the optimum is unclear. The first is context compression: summarise or filter retrieved passages before they reach the generator, so depth can stay high without flooding the model. Our guide to RAG context compression covers the options. The second is staged retrieval: start shallow, and fetch more only when the generator signals that the context is insufficient. Staged retrieval costs extra engineering, but it gives you the speed of shallow retrieval with the coverage of deep retrieval.

Depth tuning checklist

  • Separate the two depths. Track candidate depth and context depth independently.
  • Build a mixed test set. Include questions needing facts from several passages.
  • Test at least four depths. Compare context depths of 3, 5, 8 and 12 on the same questions.
  • Score groundedness and completeness. Fluency alone will not reveal depth problems.
  • Pick the plateau, not the peak. Choose the smallest depth that reaches near-maximum quality.
  • Vary depth by query type. Factual questions need less depth than multi-hop ones.
  • Check the cost per query. Price the depth you choose at real traffic volume.
  • Re-tune after pipeline changes. New chunks, rerankers or generators move the optimum.

Frequently asked questions

What is RAG retrieval depth?

RAG retrieval depth is the number of passages a system fetches per query and passes to the generator. It has two layers: candidate depth, the number pulled from the index, and context depth, the number that actually reaches the generator after reranking.

How many passages should a RAG system retrieve?

There is no universal number. A common starting point is 20 to 30 candidates narrowed to 5 to 8 passages for the generator. Tune from there on your own data, and vary depth by query type where possible.

Does retrieving more passages always improve answers?

No. Quality usually rises with depth at first, then flattens and can fall as irrelevant passages add noise. Models also underuse passages in the middle of long contexts, so extra depth has diminishing returns.

What is the difference between retrieval depth and context window size?

Retrieval depth is how many passages you choose to fetch. Context window size is the maximum the model can accept. A large window allows deep retrieval, but it does not make deep retrieval wise — the quality and cost trade-offs still apply.

Should depth be the same for every query?

Ideally not. Factual questions need little depth, while multi-hop and comparative questions need more. Adaptive depth, set by query type or a difficulty signal, serves each question better than a single fixed number.

How do I know if my depth is too shallow?

Test with questions whose answers require facts from several passages. If the system gives confident but incomplete answers, or misses facts that exist in the corpus, depth is the first dial to check.

Retrieval depth looks like a minor setting, but it sits at the centre of the accuracy, cost and latency triangle. Treat it as an experiment, not a default: measure quality at several depths, pick the smallest depth that reaches the plateau, and let different query types use different depths. Your users will get better answers, faster, for less.

Latest articles

Scroll to Top