Recall@K is an evaluation metric for approximate nearest neighbor (ANN) search that measures the fraction of the true top-K nearest neighbors—found by an exhaustive, exact search—that are successfully retrieved within the approximate top-K results returned by the system. It quantifies the search accuracy of an ANN index, such as HNSW or IVF, by comparing its output against a ground-truth benchmark. A score of 1.0 indicates perfect recall, meaning all true nearest neighbors were found.
Glossary
Recall@K

What is Recall@K?
Recall@K is the definitive metric for evaluating the accuracy of an Approximate Nearest Neighbor (ANN) search system.
In practice, engineers tune ANN parameters—like the number of probe lists in an Inverted File (IVF) index or the efSearch parameter in HNSW—to balance Recall@K against search latency and throughput. This metric is central to the recall-precision trade-off, where higher recall often requires more computational work. It is distinct from precision metrics, as it focuses solely on the completeness of retrieval relative to the exact result set.
Key Characteristics of Recall@K
Recall@K is the primary metric for quantifying the accuracy of an Approximate Nearest Neighbor (ANN) search system. It measures the system's ability to retrieve the true nearest neighbors, as determined by an exact (brute-force) search.
Core Definition and Formula
Recall@K is defined as the fraction of the true top-K nearest neighbors that are successfully retrieved by the approximate search algorithm. It is calculated as:
Recall@K = (Number of true top-K neighbors found in approximate results) / K
- A value of 1.0 (or 100%) indicates perfect recall; all true nearest neighbors were found.
- A value of 0.0 indicates complete failure; none of the true neighbors were retrieved.
- In practice, ANN systems operate in the high-recall range (e.g., 0.95 to 0.99) to balance accuracy with the massive speed gains over exact search.
Relationship with Precision@K
While Recall@K measures completeness (did I find all the true neighbors?), Precision@K measures purity (are the neighbors I found actually correct?).
- High Recall, Lower Precision: The system returns most true neighbors but also includes many false positives.
- High Precision, Lower Recall: The returned neighbors are highly likely to be correct, but many true neighbors are missed.
For ANN search, recall is often prioritized because the primary failure mode is missing relevant items, not presenting a perfectly ordered list. The two metrics are intrinsically linked by the recall-precision trade-off.
The 'K' Parameter and Its Impact
The 'K' in Recall@K is a critical, user-defined parameter representing the number of nearest neighbors requested.
- Small K (e.g., K=1, 10): Measures the system's accuracy for tasks requiring a very short, highly relevant list (e.g., top-1 image retrieval). It is a stricter test.
- Large K (e.g., K=100, 1000): Measures the system's ability to broadly gather a large candidate set, which is common in the first stage of a retrieval-augmented generation (RAG) pipeline. Higher K values typically yield higher recall scores.
Evaluating at multiple K values (e.g., Recall@10, Recall@100) provides a complete profile of system performance.
Trade-off with Query Latency
Recall@K has a direct, inverse relationship with search latency. Achieving higher recall requires the ANN algorithm to explore more of the index, increasing computation time.
- Tuning for Speed: Reducing search scope (e.g., checking fewer graph connections in HNSW or probing fewer cells in IVF) lowers latency but hurts recall.
- Tuning for Accuracy: Increasing the search scope (e.g., larger
efSearchin HNSW, more probes in IVF) improves recall at the cost of higher latency.
System architects tune these parameters to hit a Service Level Objective (SLO) for latency while maintaining an acceptable recall target for their application.
Benchmarking and Ground Truth
Calculating Recall@K requires a ground truth dataset generated by an exact, brute-force k-NN search over the entire corpus. This is computationally expensive but is a one-time cost for benchmarking.
Standard Practice:
- For a representative set of query vectors, run an exact search to find the true top-K neighbors.
- Run the same queries against the ANN index.
- For each query, compute the overlap between the two result sets.
- Report the average Recall@K across all queries.
This process validates the effectiveness of different vector indexing algorithms (HNSW, IVF-PQ) and their parameters.
Application in RAG and Search Systems
In Retrieval-Augmented Generation (RAG), Recall@K directly impacts the quality of the final LLM output. Low recall means critical context is missing, leading to potential hallucinations or incomplete answers.
Operational Context:
- A vector database might be tuned for Recall@100 > 0.95 to ensure the retrieval stage gathers nearly all relevant chunks.
- The retrieved set is then re-ranked or passed directly to the LLM. High recall at this stage is more important than perfect precision, as the LLM can often ignore minor noise.
Thus, Recall@K is a foundational SLA for production semantic search and RAG pipelines.
Recall@K vs. Other ANN Evaluation Metrics
A comparison of Recall@K against other common metrics used to evaluate the performance and trade-offs of Approximate Nearest Neighbor (ANN) search systems.
| Metric | Recall@K | Precision@K | Mean Reciprocal Rank (MRR) | Query Latency |
|---|---|---|---|---|
Primary Purpose | Measures completeness of retrieval relative to ground truth. | Measures relevance of retrieved items. | Measures the rank of the first relevant result. | Measures system responsiveness. |
Definition | Fraction of true top-K neighbors found in approximate top-K results. | Fraction of retrieved top-K results that are relevant (in true top-K). | Reciprocal of the rank position of the first correct answer, averaged over queries. | Time elapsed from query submission to result delivery. |
Calculation | |Retrieved ∩ True| / |True| | |Retrieved ∩ True| / K | Average( 1 / rank_i ) for queries i | Measured in milliseconds (ms). |
Value Range | 0 to 1 (higher is better) | 0 to 1 (higher is better) | 0 to 1 (higher is better) |
|
Key Insight | Answers 'Did we find all the right items?' Favors recall-oriented applications (e.g., candidate retrieval). | Answers 'Are the items we found correct?' Favors precision-oriented applications (e.g., final ranking). | Penalizes systems where the correct answer is buried deep in the results. Sensitive to top-rank correctness. | A system-level performance metric, not a quality metric. Directly impacts user experience. |
Trade-off Partner | Directly trades off with Query Latency and Index Build Time. | Often trades off with Recall@K. | Correlates with high Precision@1 but considers rank depth. | Directly trades off with Recall@K and Index Memory Footprint. |
ANN Tuning Knob | Increased by expanding search scope (efSearch, nprobe). | Can be improved post-retrieval via re-ranking, but fundamentally limited by Recall@K. | Improved by ensuring the most relevant result is ranked first, which requires high Recall@1. | Decreased by reducing search scope, using lighter indexes, or more aggressive compression. |
Typical Target (Production) | 0.9 - 0.99 for high-recall scenarios. | Varies widely by application (0.1 - 0.8). |
| < 50 ms for real-time applications. |
Practical Applications and Examples
Recall@K is the critical metric for validating the effectiveness of an Approximate Nearest Neighbor (ANN) system. It quantifies the trade-off between search speed and result quality. These cards illustrate how it is used to tune, benchmark, and deploy vector search at scale.
Tuning ANN Search Parameters
Recall@K is the primary dial for tuning the speed-accuracy trade-off in production ANN systems. Engineers adjust parameters to hit a target recall threshold while minimizing latency.
- Increasing
efSearchin HNSW ornprobein IVF expands the search scope, directly increasing Recall@K at the cost of higher query latency. - The goal is to find the operating point where recall meets application requirements (e.g., 95% Recall@10) without exceeding latency Service Level Objectives (SLOs).
- This process is fundamental to configuring libraries like Faiss, ScaNN, and Weaviate for specific workloads.
Benchmarking Vector Database Performance
Recall@K is the cornerstone of any vector database benchmark. It provides an objective, comparable measure of retrieval quality across different systems and algorithms.
- Benchmarks report Recall@K curves (Recall vs. K) and latency-recall curves to visualize the performance landscape.
- A common benchmark setup: perform an exact k-NN search on a test dataset to establish ground truth, then run the same queries against the ANN index to calculate Recall@K.
- This allows CTOs to compare Pinecone, Qdrant, Milvus, and others on a standardized metric before procurement.
Evaluating Embedding Model Quality
Before a model is deployed for retrieval, its embeddings must be validated. Recall@K measures how well the embedding space preserves semantic relationships.
- A standard evaluation: take a labeled dataset (e.g., question-answer pairs), embed all items, and use the query's true match as the ground truth neighbor.
- A high Recall@1 for a retrieval-augmented generation (RAG) embedding model indicates it places the correct context document closest to the query, directly reducing hallucinations.
- Low recall signals the need for model fine-tuning or a different embedding architecture.
Quality Guardrail for RAG Systems
In Retrieval-Augmented Generation, low recall is a primary cause of model hallucination. Monitoring Recall@K acts as a critical quality guardrail.
- A production RAG pipeline can sample queries, run a parallel exact search, and compute a rolling Recall@K metric.
- A drop in recall triggers alerts, prompting investigation into embedding drift, index corruption, or parameter drift.
- This ensures the language model consistently receives the correct context, maintaining answer factuality and user trust.
Trade-off Analysis: Recall vs. Precision@K
While Recall@K measures completeness, Precision@K measures relevance of returned items. Analyzing them together reveals system behavior.
- High Recall@K, Low Precision@K: The system retrieves most relevant items but also many irrelevant ones. This may be acceptable for recall-oriented tasks like candidate gathering.
- Low Recall@K, High Precision@K: The system returns few but highly relevant items, missing many others. This suits precision-critical tasks.
- The optimal balance is application-dependent. Recommendation systems often prioritize recall, while legal e-discovery may prioritize high precision.
Real-World Example: E-commerce Search
Consider an e-commerce site with 100 million product embeddings. A user searches for "comfortable running shoes for flat feet."
- Ground Truth (Exact Search): The 10 most semantically similar products (K=10) are identified via slow, exhaustive comparison.
- ANN Search: The production vector index returns 10 approximate nearest neighbors in <50ms.
- Calculation: 8 of the ANN results match the ground truth list.
- Recall@10 = 8 / 10 = 0.8 (80%). This quantifies that the fast search retrieved 80% of the ideal results. The product team uses this metric to A/B test new embedding models or indexing algorithms.
Frequently Asked Questions
Recall@K is a critical evaluation metric for Approximate Nearest Neighbor (ANN) search systems. It quantifies the accuracy of an approximate index by measuring how many of the true nearest neighbors it successfully retrieves.
Recall@K is an evaluation metric for approximate nearest neighbor (ANN) search that measures the fraction of the true top-K nearest neighbors—found by an exhaustive, exact search—that are present in the approximate top-K results returned by the system. It is calculated as Recall@K = (Number of true top-K neighbors found in approximate results) / K. A score of 1.0 (or 100%) indicates the ANN system retrieved the perfect set of neighbors, while lower scores reflect missed results due to the approximations inherent in the index.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Recall@K is one of several key metrics used to evaluate the performance of an Approximate Nearest Neighbor (ANN) search system. These related terms define the broader landscape of accuracy, speed, and efficiency measurement.
Precision@K
Precision@K measures the accuracy of the top-K results returned by a search system. It is calculated as the fraction of returned items that are relevant (i.e., part of the true top-K neighbors).
- Formula: (Number of relevant items in returned top-K) / K.
- Interpretation: A high Precision@K indicates that the system's top results are highly accurate, but it does not penalize the system for missing relevant items that it failed to retrieve.
- Trade-off with Recall@K: Systems often tune parameters to balance high Precision@K (favoring accuracy of returned items) with high Recall@K (favoring completeness of retrieval).
Mean Average Precision (mAP)
Mean Average Precision (mAP) is a comprehensive metric for ranked retrieval results that combines precision and recall across all relevant items. It is the mean of the Average Precision (AP) scores for a set of queries.
- Calculation: For a single query, Average Precision is the average of Precision@K values computed at each position where a relevant item is found. mAP averages this across multiple queries.
- Use Case: Common in information retrieval and object detection, mAP is more stringent than Recall@K alone as it rewards systems that rank relevant items higher in the result list.
- Context: While Recall@K asks 'Did you find all the relevant items?', mAP asks 'Did you find all the relevant items, and how high did you rank them?'
Search Latency & Throughput
Search Latency (query time) and Throughput (queries per second) are the primary performance metrics traded off against recall and precision in ANN systems.
- Latency: The time delay, typically in milliseconds, from query submission to result delivery. Lower latency is critical for real-time applications like chat or recommendation.
- Throughput: The number of queries a system can process per second, often measured under concurrent load. High throughput is vital for batch processing or high-traffic APIs.
- The Engineering Trade-off: Increasing an index's search scope (e.g., visiting more graph nodes in HNSW) to improve Recall@K directly increases latency and reduces throughput. System tuning involves finding the optimal operating point on this trade-off curve for a given application SLA.
Index Build Time & Memory
Index Build Time and Index Memory Footprint are critical infrastructure costs associated with achieving a target Recall@K performance.
- Build Time: The computational time (seconds to hours) required to construct an ANN index (e.g., training k-means for IVF, constructing an HNSW graph). More complex indices that enable higher recall often have longer build times.
- Memory Footprint: The RAM required to store the index data structure. For example, a flat index has a small footprint but slow search; an HNSW graph is faster but uses more memory; Product Quantization compresses vectors to reduce footprint at a cost to accuracy.
- System Design Impact: The choice of ANN algorithm (HNSW, IVF-PQ, ScaNN) is a direct decision balancing these resource costs against the required Recall@K and latency.
Brute-Force (Exact k-NN) Search
Brute-force search (or exact k-NN) is the baseline method that computes the distance from a query vector to every vector in the database. It guarantees 100% Recall@K but has linear O(N) time complexity.
- Role as Ground Truth: The results from a brute-force search define the 'true' top-K neighbors against which the Recall@K of an approximate method is measured.
- Computational Cost: Prohibitive for large-scale databases, making it unsuitable for production but essential for offline evaluation.
- Hybrid Use: Sometimes used as a final re-ranking step within a small candidate set retrieved by a fast ANN index, improving final precision without a full linear scan.
Recall-Precision Trade-off Curve
The Recall-Precision Trade-off Curve is a fundamental diagnostic plot for ANN systems, visualizing the relationship between Recall@K and Precision@K as an internal search parameter is varied.
- Generation: For a fixed K, system parameters (like
efSearchin HNSW ornprobein IVF) are swept. For each setting, both Recall@K and Precision@K are calculated across a query set and plotted. - Interpretation: The curve shows the Pareto frontier of achievable performance. Moving along the curve to higher recall typically results in lower precision and higher latency.
- Engineering Use: This curve allows CTOs and engineers to select the operational point that best meets their application requirements, quantifying the cost of improved recall.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us