Mean Reciprocal Rank (MRR) is a statistical measure used to evaluate the quality of a ranked list of answers, calculated as the average of the reciprocal ranks of the first correct answer for a set of queries. In Knowledge Graph Completion (KGC), a model generates a ranked list of candidate entities for a missing fact (e.g., (Paris, capitalOf, ?)); the reciprocal rank for a single query is 1 / rank where rank is the position of the first correct entity. MRR averages these scores across all test queries, providing a single performance figure where a higher score (closer to 1.0) indicates the correct answer appears consistently near the top of the list.
Glossary
Mean Reciprocal Rank (MRR)

What is Mean Reciprocal Rank (MRR)?
Mean Reciprocal Rank (MRR) is a core metric for evaluating the performance of Knowledge Graph Completion (KGC) models, specifically measuring the rank of the first correct answer.
MRR is particularly valuable for link prediction tasks where the primary goal is to surface the single most relevant fact, as it heavily penalizes models that bury the correct answer deep in the rankings. It is often reported alongside metrics like Hits@K, which measures recall at a fixed cutoff. While intuitive, MRR's focus on only the first correct answer makes it less informative for tasks requiring a comprehensive set of valid completions. It remains a standard benchmark for comparing knowledge graph embedding models like TransE and ComplEx in academic literature and practical KGC system evaluations.
Key Characteristics of MRR
Mean Reciprocal Rank (MRR) is a core metric for evaluating the performance of ranking systems, particularly in Knowledge Graph Completion (KGC) and information retrieval. It focuses on the position of the first correct answer.
Definition & Core Formula
The Mean Reciprocal Rank (MRR) is calculated as the average of the reciprocal ranks across a set of queries Q. The reciprocal rank for a single query is the multiplicative inverse of the rank position of the first relevant/correct answer.
Formula: MRR = (1/|Q|) * Σ_{i=1}^{|Q|} (1 / rank_i)
rank_iis the rank position of the first correct answer for the i-th query.- If no correct answer is found in the ranked list, the reciprocal rank for that query is 0.
- The result is a single score between 0 and 1, where 1 represents a perfect system where the first result is always correct.
Interpretation & Scoring
MRR provides a straightforward, interpretable score that heavily penalizes systems where the correct answer is not at the top of the list.
- Score of 1.0: The first-ranked result is correct for every query (perfect ranking).
- Score of 0.5: On average, the first correct answer appears at rank 2 (1/2 = 0.5).
- Score of 0.2: On average, the first correct answer appears at rank 5.
- Score of 0.0: No correct answers were retrieved for any query.
It is more sensitive to the top of the ranking than metrics like mean average precision (MAP), making it ideal for tasks where user attention is focused on the first few results.
Application in Knowledge Graph Completion
In KGC tasks like link prediction, MRR is used to evaluate the ranking of candidate entities. For each test triple (h, r, ?) or (?, r, t), the model scores all possible entities. MRR is calculated over all test queries.
Example Process:
- Query:
(Paris, capitalOf, ?) - Model ranks all possible tail entities:
[Berlin, London, France, Lyon, ...] - Correct answer
Franceis at rank 3. - Reciprocal Rank for this query = 1/3 ≈ 0.333.
This is repeated for all test queries, and the average is the final MRR. It directly measures how quickly the system finds the single correct fact.
Comparison with Hits@K
MRR is often reported alongside Hits@K (e.g., Hits@1, Hits@10). They provide complementary views:
- Hits@K: A binary, recall-oriented metric. Measures the proportion of queries where the correct answer is in the top K. Simpler but less granular.
- MRR: A finer-grained, precision-oriented metric. Distinguishes between a correct answer at rank 1 vs. rank 10, which Hits@10 does not.
Key Difference: A system can have a high Hits@10 but a low MRR if correct answers are consistently present but rarely at the top rank. MRR is a stricter measure of ranking quality for the primary result.
Advantages
- Simplicity: Easy to calculate, understand, and explain to stakeholders.
- Top-Headed Sensitivity: Appropriately emphasizes the critical importance of the first relevant result in user-facing systems.
- Single Metric: Provides one aggregate number for overall system performance comparison.
- Standardization: A widely accepted benchmark in academic literature and industry for ranking tasks, ensuring comparability between different models and papers.
Limitations & Considerations
- Single-Relevance Focus: Only considers the first correct answer. Ignores the value of additional relevant items lower in the list (unlike MAP).
- Binary Relevance: Treats an item as either correct or not. Does not account for graded relevance (e.g., partially correct answers).
- Query Set Sensitivity: The score can be skewed if the test set contains many easy or very hard queries. It should be calculated on a representative, curated benchmark.
- Ties Handling: Requires a deterministic strategy for handling tied scores (e.g., taking the worst/average rank), which can affect the final score.
MRR is best used in conjunction with other metrics like Hits@K and MAP for a comprehensive evaluation.
MRR vs. Hits@K: A Comparison
A direct comparison of two primary metrics used to evaluate Knowledge Graph Completion (KGC) models, highlighting their distinct focuses on ranking quality and binary success at a cutoff.
| Feature | Mean Reciprocal Rank (MRR) | Hits@K (e.g., Hits@1, Hits@10) |
|---|---|---|
Core Definition | The average of the reciprocal ranks of the first correct answer for each query. | The proportion of queries where the correct answer appears within the top K ranked results. |
Primary Focus | Ranking quality and the position of the first correct answer. | Binary success/failure at a specific rank cutoff (K). |
Output Range | Continuous value between 0 and 1. | Binary proportion between 0 and 1. |
Sensitivity to Rank | Highly sensitive; a correct answer at rank 2 scores 0.5, at rank 10 scores 0.1. | Insensitive beyond the cutoff K; ranks 1 and K are treated identically if both are ≤ K. |
Interpretation | Higher values indicate the correct answer is consistently ranked near the top. | Higher values indicate the model is frequently placing the correct answer within the top K. |
Typical Use Case | Overall benchmarking of model ranking performance; standard for academic papers. | Practical threshold-based evaluation (e.g., is the correct answer in the top 10 recommendations?). |
Granularity | Fine-grained; distinguishes between all ranking positions. | Coarse-grained; only distinguishes between 'in top K' and 'not in top K'. |
Relation to Other Metric | Can be seen as a continuous, averaged version of Hits@1. | Hits@1 is a strict subset of MRR calculation. |
Practical Examples of MRR in KGC
Mean Reciprocal Rank (MRR) is a critical metric for evaluating Knowledge Graph Completion (KGC) models. It measures the average quality of a model's ranked list of predictions for each missing fact. A higher MRR indicates the correct answer appears consistently near the top of the predictions.
Link Prediction on FB15k-237
A standard benchmark for evaluating KGC models is the FB15k-237 dataset, derived from Freebase. For a test query like (Barack_Obama, profession, ?), a model generates a ranked list of possible tail entities (e.g., Lawyer, Politician, Author, Professor).
- If the correct answer
Politicianis ranked 1st, its reciprocal rank is 1/1 = 1.0. - If it's ranked 3rd, the reciprocal rank is 1/3 ≈ 0.333.
- The MRR is the average of these reciprocal ranks across all thousands of test queries in the dataset. State-of-the-art models like ComplEx or RotatE achieve MRR scores around 0.35-0.40 on this benchmark, meaning the correct answer is typically found within the top 2-3 predictions on average.
Evaluating a Drug-Disease Prediction Model
In a biomedical knowledge graph, a critical KGC task is predicting unknown treats relationships between drugs and diseases. For a query (Aspirin, treats, ?), a model might rank potential diseases: Headache (rank 1), Myocardial Infarction (rank 2), Rheumatoid Arthritis (rank 3).
- If the ground truth includes
HeadacheandMyocardial Infarction, MRR uses the rank of the first correct answer (rank 1), giving a reciprocal rank of 1.0. - A high MRR in this context is operationally vital. It means a researcher using the model to hypothesize new drug uses will find strong, validated candidates immediately, accelerating discovery. An MRR of 0.8 suggests the top-ranked prediction is usually correct.
Comparison with Hits@K
MRR is often reported alongside Hits@K (e.g., Hits@1, Hits@10). While Hits@K gives a binary success rate at a cutoff, MRR provides a finer-grained measure of ranking quality.
- Scenario: Two models, A and B, are evaluated on 3 queries.
- Model A ranks correct answers at positions: 1, 10, 10. Hits@10 = 100%, MRR = (1/1 + 1/10 + 1/10)/3 ≈ 0.4.
- Model B ranks correct answers at positions: 2, 2, 2. Hits@10 = 100%, MRR = (1/2 + 1/2 + 1/2)/3 = 0.5.
- Both have perfect Hits@10, but Model B has a superior MRR (0.5 > 0.4) because it consistently places correct answers higher in the list. This makes MRR the preferred metric for production systems where user attention is limited to the top few results.
Impact of Negative Sampling on MRR
KGC models like TransE or DistMult are trained using negative sampling. The quality and difficulty of these generated false triples directly impact the model's discriminative power and, consequently, its MRR.
- Simple Random Negatives: Corrupting a triple
(Paris, capitalOf, France)by randomly replacingFrancewithGermany. This is often too easy for the model to distinguish, leading to deceptively high MRR during training that may not generalize. - Adversarial or Hard Negatives: Using techniques like Bernoulli sampling or generative adversarial networks to create plausible false triples like
(Paris, capitalOf, Italy). Training with these forces the model to learn finer semantic distinctions, typically resulting in a lower but more robust and meaningful MRR on held-out test data.
MRR for Multi-Hop Queries
For complex multi-hop reasoning queries, MRR evaluates the model's ability to find a chain of facts. Consider the query: "Which university did the founder of Tesla attend?" This requires finding (Elon_Musk, founded, Tesla) and then (Elon_Musk, educatedAt, ?).
- A path-based model ranks possible answers:
University_of_Pennsylvania,Stanford,Queen's_University. - If the correct answer
University_of_Pennsylvaniais ranked 2nd, the reciprocal rank is 0.5. - The MRR across many such multi-hop queries measures the system's practical utility for complex question-answering. A low MRR here indicates the model struggles with compositional logic, even if it performs well on single-hop link prediction.
Interpreting MRR in a Production System
When deploying a KGC model for enterprise search or recommendation, the MRR score translates directly to user experience and operational efficiency.
- MRR = 0.25: On average, the first correct answer appears at rank 4 (1/0.25). Users or downstream systems may need to scan several results.
- MRR = 0.5: Average first correct rank is 2. This is often a minimum target for usable systems.
- MRR = 0.9: Average first correct rank is ~1.1, meaning the correct answer is almost always first. This is typical for high-stakes applications like medical diagnostics or fraud prediction.
- Monitoring MRR drift in production is crucial. A dropping MRR can indicate model degradation due to changing data distributions or new entity types not seen during training.
Frequently Asked Questions
Mean Reciprocal Rank (MRR) is a fundamental metric for evaluating the performance of ranking systems, particularly in information retrieval and knowledge graph completion tasks. These questions address its calculation, interpretation, and practical application.
Mean Reciprocal Rank (MRR) is a statistical metric used to evaluate the quality of a ranking system by averaging the reciprocal of the rank at which the first correct answer appears for a set of queries.
In the context of Knowledge Graph Completion (KGC), MRR is used to assess models performing link prediction. For each test query (e.g., predicting the tail entity for (Paris, capitalOf, ?)), the model generates a ranked list of candidate entities. MRR calculates the reciprocal of the rank of the first correct entity in that list (e.g., if 'France' is ranked 3rd, the reciprocal rank is 1/3). The final MRR score is the average of these reciprocal ranks across all test queries.
A higher MRR (closer to 1.0) indicates the model consistently places the correct answer near the top of its rankings, which is critical for user-facing systems like search engines or Knowledge Graph Question Answering (KGQA).
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
Mean Reciprocal Rank (MRR) is one of several core metrics used to evaluate the performance of Knowledge Graph Completion models. These metrics quantify how well a model ranks the correct answer among its predictions.
Hits@K
Hits@K is a standard evaluation metric for link prediction that measures the proportion of test queries where the correct entity appears within the top K ranked predictions. It provides a coarse-grained measure of a model's recall at a fixed cutoff.
- Common Values: Hits@1, Hits@3, and Hits@10 are most frequently reported.
- Interpretation: A Hits@10 score of 0.85 means for 85% of test queries, the correct answer was in the model's top 10 predictions.
- Limitation: It treats all ranks within the top K equally; ranking the correct answer 1st vs. 10th yields the same score.
Mean Rank (MR)
Mean Rank (MR) calculates the average rank position of the first correct entity across all test queries. A lower score indicates better performance, as the model ranks correct answers higher.
- Calculation: Sum the rank of the first correct answer for each query, then divide by the total number of queries.
- Sensitivity: It is highly sensitive to outliers; a single very poor rank can skew the average significantly.
- Context: Often reported alongside MRR and Hits@K to provide a more complete picture of ranking quality, though MRR is generally considered more informative.
Area Under the Curve (AUC)
Area Under the Curve (AUC), specifically the ROC-AUC, is a threshold-independent metric used in triple classification tasks. It evaluates a model's ability to discriminate between true and false triples across all possible classification thresholds.
- Mechanism: Plots the True Positive Rate against the False Positive Rate as the decision threshold varies. The area under this curve represents performance.
- Interpretation: An AUC of 1.0 denotes perfect discrimination, while 0.5 indicates performance no better than random guessing.
- Use Case: Preferred for evaluation scenarios where a definitive true/false classification is needed, rather than a ranked list.
Normalized Discounted Cumulative Gain (NDCG)
Normalized Discounted Cumulative Gain (NDCG) is a ranking metric that accounts for the graded relevance of multiple correct answers. While less common in standard KGC, it is crucial for tasks where a query may have several valid answers with different levels of correctness or importance.
- Core Principle: It assigns higher scores when relevant items are ranked higher, with a logarithmic discount factor reducing the gain for items lower in the list.
- Application in KGC: Useful for evaluating multi-answer queries or scenarios in Knowledge Graph Question Answering (KGQA) where a list of candidate entities must be ranked.
- Normalization: The score is normalized against an ideal ranking (IDCG), producing a value between 0.0 and 1.0.
Link Prediction
Link prediction is the core machine learning task that MRR evaluates. It involves predicting a missing relationship (a link) between two entities in a knowledge graph.
- Formal Task: Given a query
(head_entity, relation, ?)or(?, relation, tail_entity), the model scores all possible entities for the missing position and ranks them. - Evaluation Pipeline: MRR, Hits@K, and Mean Rank are computed over the ranked lists produced for many such link prediction queries.
- Foundation: This task is the primary objective of Knowledge Graph Embedding (KGE) models like TransE, ComplEx, and RotatE.
Knowledge Graph Completion (KGC)
Knowledge Graph Completion (KGC) is the overarching field of techniques aimed at inferring missing facts within a knowledge graph. MRR is a key metric for benchmarking the performance of KGC algorithms.
- Objective: To enhance the graph's coverage and utility by predicting missing triples (links) or entity attributes.
- Methodologies: Includes embedding-based inference (e.g., TransE), neural theorem proving, and rule mining.
- Broader Context: KGC enables applications like enhanced search, recommendation systems, and providing factual grounding for Retrieval-Augmented Generation (RAG) architectures.

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