Lesson 5 of 5 Vector Search

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.

Match the pairs

Relevance metrics

Exam skills 3.2.10

Match each relevance metric with what it measures.

Log in to try this activity Interactive activities are free with an account.

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.

  1. Time the stages

    Measure query embedding, search and any re-ranking or RAG call separately.

  2. Inspect plans

    Check that the plan shows the vector index for approximate queries and seeks for filters.

  3. Use percentiles

    Report p50 and p95 latency under realistic concurrency, not single runs.

  4. Track over time

    Use Query Store to watch search queries' duration, CPU and reads as data grows.

Select all that apply

Measuring search performance

Exam skills 3.2.10

Identify the good practices for measuring search performance.

Log in to try this activity Interactive activities are free with an account.

Tuning levers

The main levers and their effects are summarized in the following table.

LeverEffect
Vector index (ANN)Large latency reduction for big tables, slight recall loss
Fewer dimensions or float16Less storage and I/O, faster comparisons; check recall
B-tree indexes on filter columnsFaster iterative filtering and pre-filtering
Smaller candidate lists before fusionLess work in hybrid queries
Caching query embeddingsAvoids repeated model calls for frequent questions
Better chunking or embedding textImproves relevance more than any index setting
Match the pairs

Tuning levers

Exam skills 3.2.10

Match each problem with the tuning lever that addresses it.

Log in to try this activity Interactive activities are free with an account.
Worked example

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.

Check yourself

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.