What if the fastest way to improve a RAG system has nothing to do with the language model at all? Teams spend weeks swapping models, tuning prompts, and rewriting system messages. Then someone looks at the retriever and finds that half the retrieved passages were never relevant in the first place. That is the uncomfortable truth of retrieval-augmented generation: the generator can only be as good as the evidence it receives.
This article walks through what actually moves the needle in RAG retrieval optimization, where teams go wrong, and how to measure progress without fooling yourself.
Why retrieval, not generation, is usually the bottleneck
The original RAG method, introduced by Lewis and colleagues in 2020, paired a dense retriever with a sequence-to-sequence generator and showed gains on knowledge-intensive tasks. The design was deliberately simple: retrieve a fixed number of passages, feed them into the prompt, generate an answer. Everything downstream inherits the retriever’s mistakes. If the right passage is not in the candidate set, no amount of prompt engineering recovers it.
In practice, this means retrieval optimization is a precision problem first and a recall problem second. Getting more documents into the prompt feels productive, but it often makes answers worse. Research on how language models use long contexts found that information buried in the middle of a long prompt is used less reliably than information at the start or end. That finding alone argues for tighter, better-ranked context rather than bigger context.
Start with a baseline you can trust

Before changing anything, measure what you have. A dense retriever trained with dual encoders, like the DPR approach, is the standard baseline that most later work compares against. But it is not automatically the right choice for every corpus.
A practical first step is to run three configurations on the same evaluation set:
| Configuration | Strength | Weakness |
|---|---|---|
| BM25 only | Strong on exact terms, names, codes | Misses paraphrases and synonyms |
| Dense only | Handles semantic similarity well | Weak on rare entities and exact strings |
| Hybrid (BM25 + dense) | Covers both cases | Needs tuning of the fusion weights |
The BEIR benchmark study is the reference point here. It evaluated retrieval across many datasets and found that BM25 is a surprisingly strong zero-shot baseline, while dense models that win on one dataset often lose on another. The practical lesson: do not assume a dense retriever is better. Test it.
Hybrid retrieval is usually the cheapest win
Combining lexical and dense scores is one of the most reliable improvements reported across the literature, especially for rare entities, product codes, and exact-match queries. The mechanics are simple: run both retrievers, normalize the scores, and merge the ranked lists. The hard part is the fusion weight. A 50/50 split is a reasonable starting point, but corpora with lots of jargon or identifiers usually need more weight on the lexical side.
A common mistake is tuning the fusion weight on the same queries used to report final results. Hold out a set of queries, tune on one slice, and report on another. Otherwise the improvement is partly imaginary.
Reranking: the second stage most teams skip
Retrieval and ranking are different jobs. A bi-encoder embeds queries and documents separately, which makes it fast enough to search millions of passages but limits how much interaction it can model. A cross-encoder reads the query and passage together, which is far more accurate and far slower.
The standard pattern, established in work on passage re-ranking with BERT, is to retrieve a wide candidate set (say, the top 100) with a fast retriever, then rerank that shortlist with a cross-encoder and keep the top handful. This two-stage design gets most of the accuracy of the expensive model at a fraction of the cost.
In practice, reranking is often the single highest-return change a team can make. It also tends to reduce the number of passages needed in the prompt, which helps with the lost-in-the-middle problem described earlier.
What actually works in practice
A few habits separate teams that get reranking right from teams that waste a month on it:
- Start with a small, well-labeled evaluation set of 100 to 300 queries before touching the reranker.
- Log the candidate set before reranking, so you can tell whether a miss came from retrieval or from ranking.
- Measure latency at the 95th percentile, not the average, because rerankers are the usual cause of tail latency spikes.
- Cap the candidate set. Going from 100 to 500 candidates rarely pays for itself.
Chunking decisions deserve more attention than they get
Dense retrievers are typically trained on passage-level units, so how you split documents matters. Most teams settle on a few hundred tokens with some overlap, then move on. That is fine as a default, but it is not a law.
The trade-off is straightforward. Small chunks retrieve precisely but lose surrounding context. Large chunks preserve context but dilute the embedding, because a single vector has to represent more content. Overlap helps avoid splitting an answer across a boundary, at the cost of duplicate results.
What actually works is matching chunk size to the question type. Factual lookups (“what is the refund window?”) do well with small, tight chunks. Explanatory questions (“why does this policy exist?”) need larger units or a parent-document scheme where you retrieve a small chunk but pass its larger section to the generator.
If you want a structured way to check whether your chunking and ranking choices are actually paying off, a practical checklist for evaluating retrieval quality is a useful companion to this section.
Query rewriting: useful, but not a default
Sometimes the problem is the query, not the index. Users write short, ambiguous, or context-dependent questions. Query rewriting expands those into something the retriever can match.
One well-known approach, HyDE, generates a hypothetical answer to the question and embeds that instead of the raw query. The intuition is that an answer-shaped document looks more like the documents in the index than a question does. It improves zero-shot retrieval on some benchmarks.
The catch is that gains are inconsistent across domains, and the method adds a generation call to every query, which costs latency and money. Treat query rewriting as a targeted fix for a measured problem, not a default setting. If your logs show users asking multi-turn follow-ups like “and what about the second one?”, rewriting is worth testing. If queries are already specific, it probably is not.
Evaluation: measure retrieval and answers separately
The most common evaluation mistake is judging the whole pipeline by answer quality alone. When an answer is wrong, you cannot tell whether the retriever missed or the generator ignored good evidence.
Split the measurement in two. For retrieval, use Recall@k, MRR, and nDCG against a labeled set of relevant passages. For end-to-end quality, frameworks such as RAGAS have formalized metrics like faithfulness, answer relevance, and context precision and recall. These are useful, but LLM-as-judge scores have known reliability limits, so treat them as a signal rather than a verdict.
A useful discipline is to review a sample of retrieval results by hand each time the index changes. A short, repeatable review of access to a retrieval index catches permission and freshness bugs that automated metrics never see.
A simple evaluation loop that fits in a sprint
- Collect 150 real queries with their correct source passages.
- Record Recall@10 and nDCG@10 for your current pipeline as the baseline.
- Change one variable at a time: fusion weights, chunk size, or reranker depth.
- Re-run and compare. Keep the change only if it clears a threshold you set in advance.
- Spot-check 20 results manually to catch anything the metrics miss.
Common mistakes that quietly undo good work
Several patterns show up again and again in RAG systems that underperform despite solid components.
Raising top-k as a reflex. More passages mean more noise and more tokens. If recall is already high at k=10, pushing to k=50 mostly adds distraction.
Ignoring metadata filters. Date, tenant, language, and access-level filters often improve precision more than any model change. Apply them before the vector search, not after.
Testing on the training queries. If your evaluation queries came from the same source as your tuning data, your numbers are optimistic.
Forgetting index freshness. A retriever is only as good as its index. Stale embeddings produce confident, wrong answers.
Skipping the boring infrastructure review. Vector search mechanics, index types, and memory settings matter more at scale than most teams expect. The official FAISS wiki explains how similarity search and index structures work, which helps when you need to reason about recall and speed trade-offs.
Where to spend effort first
Not every optimization is worth the same. A rough priority order for most teams:
| Priority | Change | Typical effort | Typical payoff |
|---|---|---|---|
| 1 | Fix evaluation set and logging | Low | High (enables everything else) |
| 2 | Add hybrid retrieval | Medium | High |
| 3 | Add a cross-encoder reranker | Medium | High |
| 4 | Tune chunking | Low | Medium |
| 5 | Query rewriting | Medium | Variable |
| 6 | Swap vector database | High | Low to medium |
The pattern is clear: the wins cluster around measurement and ranking, not around infrastructure swaps. Teams that change databases first usually end up back where they started, with better hardware and the same relevance problems. (News)
Conclusion
RAG retrieval optimization is less about finding a magic model and more about disciplined engineering. Build an evaluation set you trust. Combine lexical and dense retrieval. Rerank a shortlist with a cross-encoder. Match chunk size to the questions your users actually ask. Keep context tight, because more passages do not mean better answers.
None of these steps is glamorous, and none requires a research team. They require the willingness to measure before changing, and to change one thing at a time. Do that, and the generator gets a fair chance to do its job.
FAQ
What is RAG retrieval optimization?
It is the practice of improving the retrieval stage of a retrieval-augmented generation system so the generator receives more relevant, better-ranked evidence. It covers hybrid search, reranking, chunking, query rewriting, and evaluation, and it usually delivers bigger quality gains than swapping the language model.
Is hybrid retrieval always better than dense retrieval alone?
No, but it is a strong default. Lexical search handles exact names, codes, and rare terms that dense embeddings often miss, while dense search handles paraphrases. The right fusion weight depends on your corpus, so test it on held-out queries rather than assuming an even split works.
How many passages should I retrieve before reranking?
A candidate set of around 100 is a common starting point. Going wider improves recall only marginally while adding latency and cost. Measure Recall@k at several values first; if recall plateaus at 20, retrieving 200 candidates is wasted work.
What chunk size works best for RAG?
There is no universal answer. Smaller chunks retrieve precisely but lose context; larger chunks preserve context but dilute the embedding. Match the size to your question types, and consider retrieving small chunks while passing their larger parent section to the generator.
Do I need a reranker if my retriever is already good?
Often yes. Retrieval and ranking are different tasks, and a cross-encoder that reads query and passage together is more accurate than a bi-encoder that embeds them separately. The two-stage pattern, wide retrieval followed by reranking, is the standard way to get that accuracy without paying for it on every document.
How do I know if retrieval optimization actually helped?
Measure retrieval and generation separately. Track Recall@k and nDCG against labeled relevant passages, and track answer quality with a separate framework. Change one variable at a time and keep a change only if it clears a threshold you set before running the test.







