Normalized Discounted Cumulative Gain (NDCG) is a listwise evaluation metric for ranking systems that measures the quality of an ordered list based on the graded relevance of each item and a logarithmic discount for lower positions. It is the standard metric for tasks where relevance is not binary, such as information retrieval and recommendation systems. The core principle is that highly relevant items contribute more to the score, but their contribution diminishes logarithmically the further down the ranked list they appear, reflecting real user behavior.
Glossary
Normalized Discounted Cumulative Gain (NDCG)

What is Normalized Discounted Cumulative Gain (NDCG)?
A standard metric for evaluating ranking systems that accounts for the graded relevance of items and their positions in the ranked list, giving higher weight to relevant items placed near the top.
The calculation involves first computing the Discounted Cumulative Gain (DCG), which sums the relevance scores of items while applying a position-based discount. This raw DCG is then normalized by the Ideal DCG (IDCG), the maximum possible DCG achievable with a perfect ranking. The resulting NDCG score ranges from 0.0 to 1.0, where 1.0 represents an ideal ranking. This normalization allows for fair comparison across different queries and datasets with varying numbers of relevant items.
Key Characteristics of NDCG
Normalized Discounted Cumulative Gain (NDCG) is the standard metric for evaluating ranking systems where relevance is graded, not binary. It accounts for both the degree of relevance and the position of each item in the ranked list.
Graded Relevance
Unlike metrics such as Mean Average Precision (MAP) that treat relevance as binary (relevant/not relevant), NDCG operates on graded relevance scores. Each item in the ranked list is assigned a relevance label (e.g., 0=irrelevant, 1=somewhat relevant, 2=highly relevant, 3=perfectly relevant). This allows NDCG to measure the quality of a ranking more finely by rewarding systems that place highly relevant items at the top, not just any relevant item.
Positional Discounting
NDCG incorporates a logarithmic discount factor that reduces the gain (relevance score) of an item based on its rank position. The core formula is: gain / log2(rank + 1). This reflects the user experience principle that items lower in a list are less likely to be seen or clicked. A highly relevant document at position 1 contributes its full gain, while the same document at position 10 contributes only a fraction. This forces the metric to prioritize precision at the top of the list.
Cumulative Gain & Ideal Ordering
Discounted Cumulative Gain (DCG) is the sum of the discounted gains up to a given rank p. However, DCG values are not comparable across different queries, as some queries have more relevant items than others. NDCG solves this by normalizing the DCG by the Ideal DCG (IDCG). The IDCG is the maximum possible DCG achievable when all items are sorted in perfect descending order of relevance. NDCG@k = DCG@k / IDCG@k. This yields a score between 0.0 and 1.0, where 1.0 represents a perfect ranking.
Primary Use Case: Reranking Evaluation
NDCG is the de facto standard for evaluating reranking models in multi-stage retrieval pipelines (e.g., cross-encoder rerankers). It is the primary metric reported on benchmarks like MS MARCO and BEIR. When a fast retriever (e.g., BM25, bi-encoder) fetches an initial candidate set, the reranker's job is to reorder it. NDCG@10 or NDCG@100 precisely measures how well the reranker places the most relevant passages at the top of this refined list, directly impacting the quality of downstream tasks like Retrieval-Augmented Generation (RAG).
Comparison to MRR and MAP
NDCG differs fundamentally from other ranking metrics:
- Mean Reciprocal Rank (MRR): Only considers the rank of the first relevant item. It is useful for tasks like question answering where a single correct answer exists, but fails for queries with multiple relevant documents.
- Mean Average Precision (MAP): Averages precision at each rank where a relevant item is found, but treats relevance as binary. It cannot distinguish between placing a 'perfect' document vs. a 'good' document at the top. NDCG's strength is its sensitivity to graded relevance and entire list ordering.
Practical Calculation & Interpretation
To calculate NDCG for a system:
- For each query, produce a ranked list and assign graded relevance scores to each item (from human judgments or a test set).
- Calculate DCG@k: Sum
(relevance_score_i) / log2(rank_i + 1)for i = 1 to k. - Calculate IDCG@k: Sort items by true relevance descending, and compute DCG on this ideal list.
- Compute NDCG@k = DCG@k / IDCG@k.
- Average NDCG scores across all queries in the evaluation set. A score of 0.7+ is typically considered strong, but this is highly domain-dependent. The metric is most informative when comparing the relative performance of different ranking models (e.g., bi-encoder vs. cross-encoder) on the same test set.
NDCG vs. Other Ranking Metrics
A technical comparison of Normalized Discounted Cumulative Gain (NDCG) against other standard metrics for evaluating ranking and reranking systems, focusing on their properties, use cases, and limitations.
| Metric | Normalized Discounted Cumulative Gain (NDCG) | Mean Reciprocal Rank (MRR) | Precision@K | Mean Average Precision (MAP) |
|---|---|---|---|---|
Core Definition | Measures ranking quality using graded relevance scores, applying a logarithmic position discount. | Averages the reciprocal rank of the first relevant item for each query. | Measures the proportion of relevant items in the top K retrieved positions. | Averages the precision values at each rank where a relevant document is retrieved, across all queries. |
Handles Graded Relevance | ||||
Accounts for Rank Position | ||||
Evaluation Scope | Listwise (full ranked list) | Rank of first hit | Fixed cutoff (K) | Listwise (interpolated) |
Typical Use Case | Evaluating rerankers & Learning-to-Rank (LTR) systems where relevance is not binary. | Question Answering, fact retrieval where only one correct answer exists. | Web search, ensuring top results are relevant. | Classic information retrieval benchmarking, especially with binary relevance. |
Primary Weakness | Requires defining an ideal DCG (IDCG) for normalization, which can be ambiguous. | Ignores any relevant items beyond the first one. | Does not consider the order of items within the top K. | Assumes binary relevance; poorly handles graded relevance scales. |
Common Value Range | 0.0 to 1.0 | 0.0 to 1.0 | 0.0 to 1.0 | 0.0 to 1.0 |
Computational Sensitivity | High sensitivity to top-ranked items due to discount factor. | Extreme sensitivity to the rank of a single item. | Sensitive only to presence/absence within cutoff K. | Sensitive to the entire ranking of all relevant items. |
Where is NDCG Used?
Normalized Discounted Cumulative Gain (NDCG) is the industry-standard metric for evaluating ranking systems where relevance is graded, not binary. It is critical for quantifying improvements in search, recommendation, and retrieval pipelines.
Information Retrieval & Search Engines
NDCG is the primary metric for evaluating the effectiveness of web search, enterprise search, and document retrieval systems. It measures how well a search engine orders results by their graded relevance (e.g., highly relevant, somewhat relevant, not relevant).
- Core Benchmark: Used to rank systems on academic benchmarks like MS MARCO and BEIR.
- A/B Testing: Compares new retrieval algorithms (e.g., dense vs. sparse retrieval, cross-encoder rerankers) against baselines in production.
- Query Understanding: Evaluates the impact of query expansion, spelling correction, and semantic parsing on result quality.
Recommender Systems
In platforms like Netflix, Amazon, and Spotify, NDCG evaluates the quality of ranked recommendation lists. It assesses whether highly engaging items (movies, products, songs) are placed at the top of a user's feed.
- Personalization: Measures the performance of collaborative filtering and content-based filtering models.
- Multi-Objective Ranking: Evaluates lists that balance relevance with diversity, novelty, or business constraints.
- Session-Based Recommendations: Used in scenarios where the goal is to rank items for a single user session or interaction.
Learning to Rank (LTR) Model Development
NDCG is the central optimization target and evaluation metric for Learning to Rank models. These machine learning models are trained specifically to produce optimal rankings.
- Loss Functions: LambdaRank and ListNet directly optimize for NDCG during training.
- Model Comparison: Used to compare pointwise, pairwise, and listwise LTR approaches.
- Hyperparameter Tuning: Guides the tuning of model architectures and training parameters to maximize ranking quality.
RAG & Cross-Encoder Reranking Evaluation
In Retrieval-Augmented Generation (RAG) pipelines, NDCG evaluates the retrieval stage's ability to surface the most relevant context passages for a large language model. It is critical for assessing reranking models.
- Reranker Performance: Quantifies the improvement a cross-encoder reranker provides over a first-stage retriever (e.g., BM25 or a bi-encoder).
- Pipeline Optimization: Helps determine the optimal reranking depth (k) by trading off NDCG gain against increased latency.
- Hallucination Reduction: Higher NDCG scores correlate with more factual generator outputs by ensuring top-ranked context is highly relevant.
E-Commerce & Product Search
E-commerce platforms use NDCG to evaluate product search result pages, where relevance is graded based on user behavior signals like clicks, purchases, and dwell time.
- Merchandising: Tests the impact of promotional placements or sponsored products on overall list utility.
- Attribute Filtering: Evaluates how well faceted search (filtering by size, brand, price) maintains ranking quality.
- Visual Search: Measures the performance of image-based retrieval systems in returning semantically similar products.
Academic Research & Benchmarking
NDCG is the standard reporting metric in information retrieval, machine learning, and natural language processing research publications. It provides a consistent, interpretable measure for comparing novel algorithms.
- Paper Baselines: New retrieval architectures (e.g., ColBERT, SPLADE) are validated by reporting NDCG@5, NDCG@10 on standard datasets.
- Zero-Shot Generalization: Benchmarks like BEIR use NDCG to evaluate how well models perform on unseen tasks and domains.
- Reproducibility: Serves as a key result for replicating and verifying published research findings.
Frequently Asked Questions
Essential questions and answers about Normalized Discounted Cumulative Gain (NDCG), the standard metric for evaluating ranking systems in information retrieval and RAG pipelines.
Normalized Discounted Cumulative Gain (NDCG) is a standard evaluation metric for ranking systems that measures the quality of a ranked list by accounting for both the graded relevance of each item and its position in the list, with higher weight given to relevant items placed near the top.
It works by first calculating Discounted Cumulative Gain (DCG), which sums the relevance scores of all items in the list, applying a logarithmic discount factor that reduces the contribution of items lower in the ranking. The formula is: DCG@k = Σ (relevance_i / log2(i + 1)) for positions i=1 to k. NDCG then normalizes this score by dividing by the Ideal DCG (IDCG), which is the maximum possible DCG achievable with a perfect ranking of the same items. This yields a score between 0 and 1, where 1 represents a perfect ranking.
NDCG is the industry standard because it directly aligns with user experience: users care most about finding highly relevant results on the first page. It is the primary metric used in academic benchmarks like MS MARCO and BEIR for evaluating retrievers and rerankers.
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
NDCG is a core metric for evaluating ranking quality. These related concepts define the ecosystem of ranking models, training methods, and complementary evaluation benchmarks.
Learning to Rank (LTR)
A machine learning framework specifically designed to train models that optimally order a list of items, such as documents in response to a query. It moves beyond simple scoring to directly optimize the final ranked list.
- Approaches: Includes pointwise (predicting a relevance score per item), pairwise (learning which of two items is more relevant), and listwise (directly optimizing the ordering of the full list) methods.
- Application: LTR models, often trained using ranking loss functions like triplet loss or LambdaRank, are the engines that produce the rankings NDCG is designed to evaluate.
Mean Reciprocal Rank (MRR)
An evaluation metric that measures the average of the reciprocal ranks of the first relevant item across a set of queries. It is simpler than NDCG but highly focused on the top of the ranked list.
- Calculation: For each query, MRR is
1 / rank_of_first_relevant_item. The final score is the average across all queries. - Use Case: MRR is most useful in tasks where the user's primary goal is to find a single correct answer (e.g., question answering, fact retrieval). It is less informative than NDCG for tasks with graded relevance or multiple useful results.
Pairwise & Listwise Ranking
Two fundamental learning paradigms within Learning to Rank (LTR) that define how models are trained to produce better rankings.
- Pairwise Ranking: The model learns by comparing two items at a time, determining which is more relevant to a query. Common loss functions include margin ranking loss and triplet loss. It implicitly learns a relative ordering.
- Listwise Ranking: The model is trained to directly optimize the ordering of an entire list of items for a query. Methods like ListNet and LambdaRank consider the interdependencies between all candidates, often leading to superior performance as measured by listwise metrics like NDCG.
BEIR Benchmark
A heterogeneous benchmark (Benchmarking IR) designed to evaluate the zero-shot retrieval and ranking performance of models across diverse, unseen tasks and domains. It tests a model's ability to generalize.
- Composition: BEIR aggregates 18 publicly available datasets spanning tasks like fact-checking (FEVER), question answering (NQ), bio-medical retrieval (TREC-COVID), and argument retrieval (ArguAna).
- Significance for NDCG: BEIR uses NDCG@10 as one of its primary evaluation metrics. A model's NDCG score on BEIR is a strong indicator of its robustness and generalization capability outside of its training data, which is critical for real-world enterprise RAG systems.
Ranking Loss
A category of loss functions used to train machine learning models, like neural rerankers, where the objective is to produce a correct ordering of items rather than just a classification or regression score.
- Types:
- Pairwise Loss: e.g., Margin Ranking Loss, Triplet Loss. Penalizes the model when the order of a pair of items (relevant vs. non-relevant) is incorrect.
- Listwise Loss: e.g., LambdaLoss, ListNet's loss. Directly defines a probability distribution over permutations or uses an approximated gradient based on an IR metric like NDCG.
- Connection to NDCG: Advanced listwise losses, such as LambdaRank, use the NDCG gain from swapping two items to weight the gradient, directly optimizing for the NDCG metric during training.
Multi-Stage Retrieval
The prevailing pipeline architecture in modern search and RAG systems, where retrieval occurs in sequential, increasingly precise stages. NDCG is critical for evaluating each stage's output.
- Stage 1: Recall (Retrieval): A fast, high-recall method (e.g., BM25 or a dense bi-encoder) fetches a large candidate set (e.g., 100-1000 documents) from a massive corpus.
- Stage 2: Precision (Reranking): A slower, more accurate model (e.g., a cross-encoder or late interaction model) reorders the candidate set. This stage is computationally intensive but operates on a much smaller set.
- Evaluation: NDCG is measured at the output of both stages. A high NDCG@100 after Stage 1 indicates good recall, while a high NDCG@10 after Stage 2 indicates excellent precision in the final results presented to the user or LLM.

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