Inferensys

Glossary

Recall@K

Recall@K is an evaluation metric that measures the fraction of all relevant documents successfully retrieved within the top K results returned by a search or retrieval system.
Stylish WeWork-like workspace with hot desks and document wall, professional searching through enterprise knowledge base on a mounted ultrawide display, warm industrial pendants overhead.
EVALUATION METRIC

What is Recall@K?

Recall@K is a fundamental evaluation metric in information retrieval that quantifies the completeness of a search or recommendation system by measuring the proportion of all relevant items that appear within the top K retrieved results.

Recall@K measures the fraction of total relevant documents successfully captured in the first K positions of a ranked result list. For a query with R total relevant items in the corpus, if r of those appear in the top K results, Recall@K equals r / R. This metric is critical for answer engine architecture because it directly assesses whether a retrieval pipeline is missing essential information that a language model needs for factual grounding, regardless of ranking order within the top K.

Unlike precision, which penalizes irrelevant results, Recall@K focuses exclusively on completeness, making it the primary safeguard against hallucination in RAG systems. A high Recall@K ensures the generative model has access to all necessary source documents. However, optimizing for recall often requires trading off latency and precision, as exhaustive search strategies like increasing K or using brute-force k-NN over approximate nearest neighbor (ANN) indexes can degrade P99 latency and violate Service Level Objectives (SLOs).

METRIC FUNDAMENTALS

Key Characteristics of Recall@K

Recall@K is a foundational evaluation metric for retrieval systems that quantifies completeness—measuring how many of the total relevant items were successfully captured within the top K results returned to a user or downstream agent.

01

Core Definition and Formula

Recall@K measures the proportion of relevant items retrieved in the top K results relative to the total number of relevant items that exist in the corpus.

  • Formula: Recall@K = (Number of Relevant Items in Top K) / (Total Relevant Items in Corpus)
  • Range: Always between 0.0 and 1.0, where 1.0 indicates perfect completeness.
  • Contrast with Precision@K: While Precision@K measures the purity of the top K results, Recall@K measures their coverage.
  • Example: If 10 relevant documents exist for a query and a system returns 7 of them in the top 20 results, Recall@20 = 0.7.
02

The K Parameter Trade-off

The choice of K fundamentally changes what the metric evaluates and must align with the user experience being designed.

  • Small K (e.g., K=5): Evaluates the quality of the first screen or snippet. Critical for answer engines where only the top few chunks are fed to a generator.
  • Large K (e.g., K=100): Evaluates the system's ability to find all relevant items, often used during evaluation-driven development to tune ANN index parameters.
  • Trade-off: A larger K makes it easier to achieve high recall but increases latency and the computational cost of downstream re-ranking.
03

Relationship with ANN Search

Approximate Nearest Neighbor (ANN) algorithms like HNSW or DiskANN introduce a direct recall-performance trade-off.

  • ANN Recall: In vector search, "recall" often refers to the proportion of true nearest neighbors found by the approximate algorithm compared to an exact brute-force search.
  • Tuning: Increasing the ef_search parameter in HNSW improves ANN recall but increases query latency.
  • Impact: Low ANN recall directly caps the maximum achievable Recall@K for the overall retrieval pipeline, as relevant vectors are lost before any re-ranking occurs.
04

Limitations and Blind Spots

Recall@K has critical limitations that must be understood to avoid misleading evaluation results.

  • Total Relevant Count Problem: The denominator requires knowing the absolute number of relevant items in the corpus, which is often unknown in large-scale production systems.
  • Binary Relevance Assumption: The metric treats all relevant items as equally important, ignoring graded relevance where one document might be far more authoritative than another.
  • Ignores Ranking Order: A system that places all relevant items at positions 90-100 receives the same Recall@100 score as one that places them at positions 1-10, masking poor ranking quality.
05

Role in Hybrid Retrieval Pipelines

Recall@K is the primary metric for evaluating the retrieval stage of a pipeline, before re-ranking and generation.

  • High-Recall Retrieval: Modern Retrieval-Augmented Generation (RAG) systems often combine dense vector search and sparse BM25 using Reciprocal Rank Fusion (RRF) to maximize recall before a final cross-encoder re-ranker.
  • Cascading Architecture: The retrieval stage optimizes for high recall (e.g., K=100), while the re-ranking stage optimizes for high precision at a smaller K (e.g., K=5).
  • Evaluation: Recall@K is measured at the retrieval output, while metrics like Faithfulness or Answer Correctness evaluate the final generated output.
06

Practical Calculation Example

Consider a user query: "How do I configure a circuit breaker for a vector database connection?"

  • Ground Truth: 8 relevant documents exist in the index covering circuit breaker patterns, connection pooling, and backpressure.
  • System Output (Top 10): Returns 6 of the 8 relevant documents, plus 4 irrelevant ones.
  • Result: Recall@10 = 6 / 8 = 0.75
  • Interpretation: The system found 75% of the available relevant information. The missing 2 documents might be due to poor chunking or an embedding model that failed to capture the semantic relationship between "circuit breaker" and "fault tolerance."
RETRIEVAL EVALUATION COMPARISON

Recall@K vs. Related Retrieval Metrics

A comparison of Recall@K against other core information retrieval metrics used to evaluate the quality and completeness of search results.

MetricRecall@KPrecision@KMean Reciprocal Rank (MRR)Normalized Discounted Cumulative Gain (NDCG)

Primary Focus

Completeness of retrieval

Purity of top results

Rank of first relevant item

Overall ranking quality with graded relevance

Core Question Answered

What fraction of all relevant items did I find?

What fraction of the top K results are relevant?

How high is the first relevant result ranked?

How good is the ranking, weighted by position?

Sensitivity to K

Increases monotonically with K

Decreases as K grows if irrelevant items outnumber relevant ones

Insensitive to K beyond the first relevant hit

Sensitive to K; discounts contributions at lower ranks

Handles Graded Relevance

Penalizes Irrelevant Items in Top K

Ideal Use Case

Legal e-discovery, literature review, high-recall search

Web search first page, featured snippets

Question answering, FAQ retrieval

Recommendation systems, search with multi-level relevance labels

Value for K=10, 1 relevant doc in corpus of 100, retrieved at rank 5

1.0 (100%)

0.1 (10%)

0.2 (1/5)

0.43 (IDCG-normalized)

RECALL@K EXPLAINED

Frequently Asked Questions

Clear, technically precise answers to the most common questions about the Recall@K evaluation metric, its calculation, and its role in optimizing retrieval-augmented generation and search systems.

Recall@K is an evaluation metric that measures the proportion of all relevant items within a dataset that are successfully retrieved in the top K results. It quantifies the completeness of a retrieval system. The calculation is straightforward: Recall@K = (Number of relevant items in top K results) / (Total number of relevant items in the entire dataset). For example, if a knowledge base contains 10 truly relevant documents for a query and a search system returns 6 of them within the top 20 results, the Recall@20 is 0.6 or 60%. This metric is critical in Retrieval-Augmented Generation (RAG) architectures, where failing to retrieve a relevant document means the language model can never see it, guaranteeing a poor or hallucinated answer regardless of the model's reasoning capabilities.

Prasad Kumkar

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.