Evaluating Vector and Hybrid Search
This lesson explains how to measure search relevance and latency and which levers improve them.
Learning outcomes
After completing this lesson, you will be able to:
- Describe relevance metrics such as recall@k and MRR.
- Explain how to measure ANN recall against KNN.
- Identify the main tuning levers for search performance.
Measuring relevance
Relevance is measured with an evaluation set: realistic questions paired with the items that should be found, created by domain experts or from logged searches and clicks. Common metrics are listed below.
- Recall@k: the fraction of relevant items that appear in the top k results; key for RAG, where missing items cannot be used.
- Precision@k: the fraction of the top k results that are relevant.
- Mean reciprocal rank (MRR): how high the first relevant result appears, averaged over questions.
- NDCG: rewards relevant items near the top, with graded relevance.
For ANN, recall against exact KNN measures index quality separately from model quality: run each query with VECTOR_SEARCH WITH APPROXIMATE and with exact kNN, and compute the overlap of the top k. Comparing full-text, vector and hybrid results on the same evaluation set shows which approach and fusion weights suit the data.
Relevance metrics
Measuring latency and cost
Performance is measured end to end and per stage, because embedding the query (a call to the model) often takes longer than the search itself. The following steps describe a measurement approach.
-
Time the stages
Measure query embedding, search and any re-ranking or RAG call separately.
-
Inspect plans
Check that the plan shows the vector index for approximate queries and seeks for filters.
-
Use percentiles
Report p50 and p95 latency under realistic concurrency, not single runs.
-
Track over time
Use Query Store to watch search queries' duration, CPU and reads as data grows.
Measuring search performance
Tuning levers
The main levers and their effects are summarized in the following table.
| Lever | Effect |
|---|---|
| Vector index (ANN) | Large latency reduction for big tables, slight recall loss |
| Fewer dimensions or float16 | Less storage and I/O, faster comparisons; check recall |
| B-tree indexes on filter columns | Faster iterative filtering and pre-filtering |
| Smaller candidate lists before fusion | Less work in hybrid queries |
| Caching query embeddings | Avoids repeated model calls for frequent questions |
| Better chunking or embedding text | Improves relevance more than any index setting |
Tuning levers
Is the index good enough?
After creating a vector index, product search latency drops from 900 ms to 40 ms. The product owner asks whether results are now worse. How should the developer answer?
Run the evaluation set's queries twice, with TOP (k) WITH APPROXIMATE through the index and with exact kNN, and compute recall@k of the approximate results against the exact ones; then compare recall@k against the labelled relevant items for both. This separates index loss from model quality. Checking a few queries by eye is not a measurement, and latency figures say nothing about relevance.
What does recall@10 against exact KNN measure?
Show answer
The fraction of the true 10 nearest neighbours that the approximate search returned.
Exam Tips
Remember for the exam
- ANN quality: recall@k against exact kNN for the same queries.
- Relevance: recall, precision, MRR or NDCG on a labelled evaluation set.
- Measure embedding, search and generation latency separately; use percentiles.
- Better embedding text and chunking often improve relevance most.