Skip to content
mentoor

Topic 4 of 5 · 4 min read

Measuring what each retrieval upgrade buys

Goal: Run or read a comparison table of retrieval variants and decide which upgrade is worth its latency and cost.

Never add a retrieval upgrade on a hunch: run baseline, hybrid, reranked and contextual variants over the same query set, and keep an upgrade only if its measured gain justifies its added latency, cost and complexity.

Check yourself · 1 of 3

What makes a comparison of retrieval variants fair?

Choose one answer

Why it matters

Each upgrade in this skill costs something. Hybrid search needs a second index. A reranker adds latency on every query. Contextual retrieval adds an LLM pass over the whole corpus and again at every re-index. Teams often adopt them because a blog post said so, then cannot say whether answers got better. Gains also depend on the corpus: a wiki full of error codes benefits from BM25, a corpus of long narrative essays may not.

How to do it

  1. Build a query set: 50 to 200 real questions, each with the chunk or document that answers it. Pull them from logs or support tickets, not from invention. Include exact-term queries and paraphrased ones.
  2. Define the metric. For retrieval, recall@k (is the right chunk in the top k?) and MRR (how high is it?) are the standard choices. For the whole pipeline, also grade final answers.
  3. Run every variant on the same queries, with the same chunks and the same k.
  4. Record cost and latency next to quality: p50 and p95 latency per query, and index-time cost.
  5. Decide against a rule fixed in advance, such as "keep if recall@5 rises by 5 points and p95 stays under 800 ms".
Variant recall@5 p95 latency Added cost
Vector only 0.71 120 ms none
Hybrid (BM25 + vector) 0.79 150 ms second index
Hybrid + rerank (N=50) 0.88 520 ms rerank per query
Contextual hybrid + rerank 0.91 530 ms LLM pass at indexing

These numbers are an illustration, not a benchmark.

Reading the table

Hybrid buys 8 points for 30 ms: take it. Reranking buys 9 points for 370 ms: worth it for a chat assistant, maybe not for autocomplete. Contextual retrieval adds 3 points at no query-time cost but a real indexing bill, so the decision is about how often the corpus changes.

What goes wrong

  • Too few queries. With 20 queries, a 5-point difference is one question. Use enough that differences are not noise.
  • Tuning on the test set. If you pick k and N on the same queries you report, the result is flattered. Hold some queries out.
  • Measuring retrieval only. A recall gain that does not change the final answer is not worth paying for.
  • Forgetting cost. A variant that is 1 point better and 5 times slower is a loss.

Examples

Deciding between two upgrades

Hybrid adds 8 recall points for 30 ms. A reranker adds 9 more for 370 ms. For a support chat that waits 3 seconds for a model answer anyway, the team keeps both. For a search-as-you-type box with a 200 ms budget, they keep hybrid and drop the reranker.

A gain that is noise

A team tests 20 queries. Variant A finds the answer in 14, variant B in 15. That is one question, and a different phrasing could reverse it. They grow the set to 150 queries before choosing.

Key points

  • Compare every variant on the same real queries, chunks and k, or the numbers mean nothing.
  • Use recall@k and MRR for retrieval, and grade final answers too, since a recall gain may not change the answer.
  • Put p50 and p95 latency and added cost beside quality in the same table.
  • Set the acceptance rule before running, for example a minimum recall gain and a latency ceiling.
  • Hold out some queries so that tuning k and N does not flatter the result.

Common mistakes

  • Judging an upgrade from a demo of three queries.
  • Comparing variants with different chunk sizes or different k.
  • Reporting recall without latency or cost.
  • Picking N and k on the same queries used to report the final score.

Check yourself · 2 of 3

Reranking raises recall@5 from 0.79 to 0.88 and p95 latency from 150 ms to 520 ms. Your product must answer search-as-you-type within 200 ms. What should you do?

Choose one answer

Check yourself · 3 of 3

You tuned k and N on your 100 test queries and now report recall@5 on those same 100. What is the problem?

Choose one answer

Practice items, not counted towards your mastery.

Start here