Recall vs Latency Configuration
What you'll learn: How to tune vector index parameters to balance search accuracy against query speed for your specific application needs.
The Core Trade-off
When configuring a vector database index, you face a fundamental tension: more accurate results take longer to find. This is the recall-latency trade-off.
Recall measures how many of the true nearest neighbors your search actually finds. A recall of 0.95 means you're finding 95% of the most similar vectors you'd get with a perfect (but slow) brute-force search.
Latency is how quickly you get results back — typically measured in milliseconds.
Understanding the Balance
Think of it like adjusting a microscope: you can scan quickly at low magnification (fast, but you might miss details) or slowly at high magnification (thorough, but time-consuming).
Most ANN indexes expose parameters that control this trade-off:
- HNSW's
ef_search: Higher values = more candidate vectors examined = better recall, slower queries - IVF's
nprobe: More cells searched = higher recall, higher latency - PQ's code size: Larger codes = more accurate distances, more computation time
Tuning for Your Application
Different applications have different needs:
High-recall scenarios (e.g., medical diagnosis, legal search):
- Set aggressive parameters (high
ef_search, manynprobecells) - Accept 50-100ms+ latency for 98%+ recall
Low-latency scenarios (e.g., real-time recommendations, autocomplete):
- Use lighter parameters for <10ms queries
- Accept 85-90% recall if results are still good enough
Key Takeaway: Recall and latency are opposing forces in vector search — tune index parameters based on whether your application values accuracy or speed more, and always measure both metrics when optimizing.