Inferensys

Glossary

Recall@K

Recall@K is an evaluation metric measuring the proportion of relevant documents successfully retrieved within the top-K results, prioritizing the completeness of the retrieval set.
Developer working on RAG retrieval system, document chunks visible on screen, technical workspace with code editor.
RETRIEVAL COMPLETENESS METRIC

What is Recall@K?

Recall@K is an evaluation metric that measures the proportion of relevant documents successfully retrieved within the top-K results, prioritizing the completeness of the retrieval set over the precision of its ranking.

Recall@K quantifies retrieval completeness by calculating the fraction of all relevant documents in a corpus that appear in the top-K returned results. Unlike precision-oriented metrics, it penalizes the system only when relevant items are missed entirely, making it the primary metric for tasks where exhaustive retrieval is critical, such as legal e-discovery or comprehensive literature reviews.

The metric is computed as |Relevant Items ∩ Retrieved@K| / |Total Relevant Items|. A score of 1.0 indicates all relevant documents were captured within the K window. In Retrieval-Augmented Generation (RAG) pipelines, Recall@K is often prioritized over precision to ensure the language model has access to all necessary factual grounding, trusting a subsequent re-ranker or cross-encoder to filter out noise.

EVALUATION METRIC

Key Characteristics of Recall@K

Recall@K is a fundamental metric for evaluating retrieval systems, measuring the proportion of relevant documents successfully captured within the top-K results. It prioritizes completeness over precision, making it critical for tasks where missing a relevant document is costly.

01

Core Definition and Formula

Recall@K quantifies how many of the total relevant documents for a query appear in the top-K retrieved results.

  • Formula: Recall@K = (Number of relevant documents in top-K) / (Total number of relevant documents)
  • Range: 0 to 1, where 1 indicates all relevant documents were retrieved.
  • Focus: This metric ignores the ranking order within the top-K and ignores irrelevant documents, focusing solely on coverage.
  • Example: If a query has 5 relevant documents in the corpus and the system retrieves 3 of them in the top-10 results, Recall@10 is 3/5 = 0.6.
02

Contrast with Precision@K

Recall@K and Precision@K are complementary metrics that trade off against each other.

  • Recall@K answers: "Of all the relevant items, how many did we find?" It penalizes missed results.
  • Precision@K answers: "Of the items we retrieved, how many are relevant?" It penalizes irrelevant results.
  • Trade-off: A system can achieve perfect Recall@K by simply returning all documents (K = corpus size), but this destroys precision. Effective systems balance both.
03

Role in RAG Architectures

In Retrieval-Augmented Generation (RAG), Recall@K is often the primary retrieval metric because the downstream LLM can filter out noise, but it cannot answer correctly if the required fact was never retrieved.

  • Generative Filtering: A strong LLM can ignore irrelevant chunks in its context window, acting as a precision filter.
  • Factual Ceiling: The quality of the final generated answer is strictly bounded by the recall of the retrieval step. If the fact isn't in the top-K, the LLM will likely hallucinate.
  • Tuning: Teams often optimize for high Recall@K (e.g., K=20) and rely on a re-ranker to boost precision before generation.
04

Limitations and Blind Spots

While essential, Recall@K has critical limitations that must be understood.

  • Binary Relevance Assumption: It treats all documents as either fully relevant or irrelevant, ignoring graded relevance (e.g., a partially relevant document counts the same as a perfectly relevant one).
  • Total Relevant Count Problem: Calculating the denominator requires knowing the absolute number of relevant documents in the entire corpus, which is often unknown in large-scale, real-world datasets.
  • K-Dependency: The metric is highly sensitive to the choice of K. Recall@5 and Recall@100 tell very different stories about system performance.
05

Practical Calculation with Mean Recall@K

In practice, Recall@K is averaged across a test set of queries to provide a robust evaluation.

  • Mean Recall@K: The arithmetic mean of the Recall@K score for each query in the evaluation set.
  • Binary Vectors: For each query, a binary relevance vector is created for the top-K results (1 for relevant, 0 for irrelevant).
  • Implementation: Libraries like ranx or pytrec_eval provide optimized functions to calculate Mean Recall@K against standard benchmarks like MS MARCO or BEIR.
06

Relationship with Hit Rate

Recall@K is closely related to Hit Rate (or Success@K) , but they measure different things.

  • Hit Rate: Measures the percentage of queries for which at least one relevant document is found in the top-K. It's a binary per-query metric.
  • Recall@K: Measures the proportion of all relevant documents found. A system can have a 100% Hit Rate but a low Recall@K if it only ever finds one of many relevant documents.
  • Use Case: Hit Rate is useful for factoid QA (one answer needed), while Recall@K is better for summarization or multi-faceted research tasks.
RETRIEVAL METRIC COMPARISON

Recall@K vs. Precision@K vs. MRR

A comparison of three core information retrieval metrics used to evaluate the quality of ranked result lists in embedding model selection and search relevance engineering.

MetricRecall@KPrecision@KMRR

Primary Focus

Completeness of retrieval

Purity of top results

Rank position of first hit

Core Question

Did we find all relevant items?

How many top-K items are relevant?

How quickly did we find the first relevant item?

Sensitivity to K

Increases monotonically with K

Decreases as K grows with irrelevant results

Stabilizes once first relevant item is found

Best Use Case

Legal discovery, patent search, exhaustive literature review

Featured snippets, recommendation widgets, top-5 search results

Question answering, FAQ retrieval, known-item search

Penalizes Irrelevant Results

Penalizes Rank Position

Ideal Score

1.0

1.0

1.0

Typical Threshold

Recall@100 or Recall@1000

Precision@5 or Precision@10

MRR@10

METRICS DEEP DIVE

Frequently Asked Questions

Explore the critical nuances of the Recall@K evaluation metric, a cornerstone for measuring the completeness of retrieval-augmented generation and semantic search systems.

Recall@K is an evaluation metric that measures the proportion of total relevant documents successfully retrieved within the top-K search results. It prioritizes the completeness of the retrieval set, answering the question: 'Of all the relevant items that exist in the corpus, how many did the system actually find?'

The calculation is straightforward:

code
Recall@K = (Number of relevant documents in top-K results) / (Total number of relevant documents in the corpus)

For example, if a corpus contains 10 relevant documents for a query and the system returns 7 of them in the top-20 results, the Recall@20 is 0.7. Unlike precision, recall does not penalize the system for returning irrelevant results, making it a critical metric for use cases like legal discovery or medical literature review where missing a single relevant document is unacceptable.

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.