Hybrid Search Evaluation with Frozen Query Set
In this article
Yes, you can build a hybrid search system that you evaluate with a frozen query set, and doing so is a standard practice in information retrieval. A frozen query set means you fix a list of test queries and their expected relevant results before you start tuning, and you only use that set to measure changes in retrieval quality as you adjust the hybrid ranking.
What Hybrid Search Is and Why It Needs Evaluation
Hybrid search combines two or more retrieval methods—typically a keyword-based method (like BM25) and a vector-based method (like dense embeddings)—into a single ranking. The goal is to get the precision of exact keyword matching and the semantic flexibility of vectors. But combining them introduces a new problem: how do you decide the weight each method gets? A frozen query set gives you a stable yardstick to test different weightings, thresholds, and fusion techniques without re-running user studies each time.
How a Frozen Query Set Works
A frozen query set is essentially a labeled test set. You create it once, store it, and never change it during development. It usually contains:
- Queries: real or representative user questions, typically 50–200 for a balanced set.
- Relevance judgments: for each query, a list of documents marked as relevant, non-relevant, or graded (e.g., 0–3).
- Metadata: query type (e.g., navigational, informational), expected result count, and any notes about edge cases.
Once frozen, you run your hybrid pipeline on these queries, compute metrics like nDCG@10 or Mean Reciprocal Rank (MRR), and compare results across versions. Because the queries never change, any difference in scores is attributable to your system changes, not to test-set drift.
Building the Hybrid Pipeline with Evaluation in Mind
To make evaluation clean, structure your hybrid search so that the fusion step is configurable. A typical pipeline looks like this:
- Retrieve candidates: Run the query through BM25 and through a vector search (e.g., using a precomputed embedding index).
- Normalize scores: Because BM25 scores and vector distances are on different scales, you must normalize them (e.g., min-max scaling or rank-based normalization).
- Fuse: Combine the two ranked lists using a method like weighted sum, Reciprocal Rank Fusion (RRF), or a learning-to-rank model.
- Evaluate: Compute your chosen metric on the frozen set, and log the configuration.
For example, if you use RRF with a constant k (often 60), you can tune that k and the relative weights of BM25 vs. vector scores. Each change is a new experiment, and the frozen set tells you if it helped.
Choosing the Right Evaluation Metrics
Your metric should match your user goal. Common choices for hybrid search evaluation:
- nDCG@k: Best when you have graded relevance (e.g., a document can be highly relevant, somewhat relevant, or irrelevant). It rewards putting highly relevant results at the top.
- MRR: Good for question-answering or “find the one right answer” scenarios, since it only cares about the first relevant result.
- Recall@k: Useful when you care about not missing any relevant documents, even if ranking isn’t perfect.
- Precision@k: Good when false positives are costly (e.g., showing irrelevant results in a small UI).
For a typical hybrid search, nDCG@10 is a safe default because it balances ranking quality and user attention. But you should also track a secondary metric like Recall@50 to ensure you’re not losing coverage.
Common Pitfalls and How to Avoid Them
Even with a frozen set, you can fool yourself. Watch for these issues:
- Overfitting to the frozen set: If you tune too many parameters, you’ll eventually memorize the test set. Use a separate held-out set for final validation, or limit the number of tuning iterations.
- Leakage in relevance judgments: If the person creating the judgments sees your system’s output, they might unconsciously bias the labels. Keep judgments independent.
- Ignoring query diversity: A frozen set full of similar queries won’t reveal weaknesses in handling long-tail or ambiguous queries. Include a mix of short, long, and misspelled queries.
- Changing the set mid-experiment: If you add or remove queries, your results aren’t comparable. Freeze it and only update with a versioned release.
Another subtle mistake is using the frozen set to tune the embedding model itself. If you retrain or fine-tune embeddings on the same queries, you risk overfitting. Keep a separate validation set for model training.
Tools and Frameworks for Evaluation
You don’t need a commercial tool; open-source libraries work well. For Python, ranx and ir-measures provide standard IR metrics. You can also write a simple script that reads your results in TREC format (query ID, Q0, doc ID, rank, score, run name) and computes metrics. For large-scale experiments, consider using a vector database that supports hybrid search natively (e.g., Weaviate, Qdrant, or Elasticsearch with dense vectors), but you’ll still need to implement your own evaluation harness.
Cost and Maintenance Considerations
Building a frozen query set isn’t free. You need time to collect queries, judge relevance, and maintain the set as your corpus grows. The cost is usually small compared to the benefit of avoiding bad ranking changes. To keep costs reasonable:
- Start with 50–100 queries that cover the most common user intents.
- Use a pool-based approach: run your current system, take the top 20 results per query, and judge those. This is cheaper than judging the entire corpus.
- Re-evaluate the set periodically (e.g., every quarter) to ensure it still reflects user behavior, but treat any change as a new version.
Frequently Asked Questions
How many queries should I have in a frozen set?
There’s no magic number, but 50–200 is typical. Fewer than 50 makes metrics noisy; more than 200 becomes expensive to judge. If your corpus is niche, even 30 well-chosen queries can be useful for catching regressions.
What if I don’t have relevance judgments?
You can use implicit feedback like click-through data from your logs, but that’s noisy. A better start is to use a small set of queries with manually labeled results, even if only 20–30. Alternatively, use a public benchmark like MS MARCO or BEIR, but those may not match your domain.
Can I use the same frozen set for both training and evaluation?
No. If you tune any parameter (like fusion weights) on the frozen set, it becomes a training set. You need a separate test set for final evaluation. Many teams use a three-way split: train, validation (for tuning), and test (frozen, used only once).
How do I compare hybrid search to pure BM25 or pure vector search?
Run the same frozen queries through each system and compute the same metrics. If hybrid doesn’t beat the best single method by a meaningful margin, you may need to adjust your fusion or reconsider whether you need hybrid at all. Sometimes a well-tuned BM25 is enough.
What is the best fusion method for hybrid search?
Reciprocal Rank Fusion (RRF) is a strong, simple baseline that doesn’t require score normalization. Weighted sum works well if you normalize scores properly. Learning-to-rank models can outperform both but require training data. Start with RRF and tune the constant k.
How often should I update the frozen query set?
Only when your corpus or user base changes significantly. If you add a new content type, you might need new queries to cover it. Otherwise, keep it stable to allow long-term comparisons. When you do update, version the set and document what changed.