Normalized Discounted Cumulative Gain (NDCG) is a family of metrics that evaluates a ranked list by comparing the actual order of results against an ideal ordering where all relevant documents appear first. Unlike precision-based metrics, NDCG accounts for multi-graded relevance judgments—assigning higher gain scores to highly relevant documents than to marginally relevant ones—and applies a logarithmic discount to penalize relevant items that appear lower in the ranking.
Glossary
Normalized Discounted Cumulative Gain (NDCG)

What is Normalized Discounted Cumulative Gain (NDCG)?
Normalized Discounted Cumulative Gain (NDCG) is a rank-aware evaluation metric that measures retrieval quality by discounting the gain of a relevant document logarithmically based on its position, normalized against an ideal ranking.
The metric is computed by first calculating the Discounted Cumulative Gain (DCG) at rank position p, then dividing by the Ideal DCG (IDCG)—the DCG of the perfect ranking—to produce a normalized score between 0 and 1. This normalization enables meaningful comparisons across queries with varying numbers of relevant documents, making NDCG the standard evaluation measure for Learning to Rank systems, hybrid search fusion pipelines, and any retrieval architecture where rank position directly impacts user satisfaction.
Key Characteristics of NDCG
Normalized Discounted Cumulative Gain (NDCG) is the gold standard for evaluating ranking quality in search and recommendation systems. It measures not just whether relevant items were retrieved, but whether they were placed at the top of the list where users are most likely to engage with them.
Position-Discounted Gain
NDCG applies a logarithmic discount to the relevance gain of each document based on its rank position. A highly relevant document at position 1 contributes full value, while the same document at position 10 contributes substantially less. This mirrors real user behavior—searchers rarely scroll past the first page.
- Discount formula: gain / log₂(rank + 1)
- Position 1: discount factor of 1.0 (no penalty)
- Position 5: discount factor of ~0.39
- Position 10: discount factor of ~0.29
- Models the positional attention decay observed in eye-tracking studies
Ideal DCG Normalization
The 'N' in NDCG stands for normalization against an ideal ranking. The system's actual DCG score is divided by the Ideal DCG (IDCG)—the score achieved by a perfect ranking where all documents are sorted in descending order of relevance. This produces a value between 0.0 and 1.0, making scores comparable across queries with different numbers of relevant documents.
- NDCG = DCG / IDCG
- A score of 1.0 indicates a perfect ranking
- Normalization enables cross-query averaging
- Prevents queries with many relevant documents from dominating aggregate metrics
Graded Relevance Judgments
Unlike binary metrics (relevant/not relevant), NDCG supports multi-level relevance grades. Documents can be labeled on a scale—such as 0 (irrelevant), 1 (tangentially relevant), 2 (relevant), 3 (highly relevant), or 4 (perfectly relevant). This granularity rewards systems that prioritize the most authoritative or comprehensive results.
- Binary relevance: 0 or 1 (simplified NDCG)
- Graded relevance: 0–4 scale common in benchmark datasets
- Higher grades receive exponentially more gain weight
- Used extensively in MS MARCO and TREC evaluation campaigns
- Captures the nuance that some relevant documents are better than others
NDCG@K: Cutoff Evaluation
NDCG is almost always computed at a specific cutoff depth K, written as NDCG@K. Common values are NDCG@5, NDCG@10, and NDCG@20. This focuses evaluation on the top results that users actually see, rather than the entire ranked list. NDCG@10 is the most widely reported metric in academic information retrieval literature.
- NDCG@10: Evaluates the first page of results
- NDCG@5: Stricter metric for mobile or voice search interfaces
- NDCG@100: Used for recall-oriented evaluation
- Choosing K should align with your application's user interface constraints
Cumulative Gain Aggregation
The 'C' in DCG stands for cumulative—the metric sums the discounted gain across all positions up to rank K. This means a system is rewarded for every relevant document it retrieves, not just the first one. Unlike Mean Reciprocal Rank (MRR), which only cares about the first relevant result, NDCG captures the full quality of the ranked list.
- DCG@K = Σ(gainᵢ / log₂(i + 1)) for i = 1 to K
- Rewards systems that surface multiple relevant items
- Contrasts with MRR, which only evaluates the first hit
- Better suited for exploratory search where users examine multiple results
Exponential Gain Scaling
To strongly reward highly relevant documents, NDCG often applies exponential gain scaling: gain = 2^relevance - 1. A document with relevance grade 4 receives a gain of 15, while grade 1 receives only 1. This creates a strong incentive for ranking systems to place the most authoritative documents at the very top.
- Linear gain: gain = relevance (less common)
- Exponential gain: gain = 2^relevance - 1 (standard)
- Grade 0 → gain 0, Grade 1 → gain 1, Grade 3 → gain 7, Grade 4 → gain 15
- Places heavy penalty on mis-ranking highly relevant documents
- Aligns with business metrics where top positions drive most engagement
NDCG vs. Other Ranking Metrics
A comparison of Normalized Discounted Cumulative Gain against other common retrieval and ranking evaluation metrics, highlighting their sensitivity to rank position, graded relevance, and normalization properties.
| Feature | NDCG | MRR | Precision@K | MAP |
|---|---|---|---|---|
Rank Position Sensitivity | Logarithmic discount | Reciprocal discount | Binary (avg precision) | |
Graded Relevance Support | ||||
Normalized Score Range | [0, 1] | [0, 1] | [0, 1] | [0, 1] |
Multiple Relevant Docs | ||||
Ideal Ranking Baseline | ||||
Query Difficulty Agnostic | ||||
Primary Use Case | Graded relevance with position importance | First relevant document rank | Top-K set quality | Binary relevance with rank |
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.
Frequently Asked Questions
Clear answers to common questions about Normalized Discounted Cumulative Gain (NDCG), the rank-aware metric that evaluates retrieval and recommendation quality by penalizing relevant documents that appear lower in a result list.
Normalized Discounted Cumulative Gain (NDCG) is a rank-aware evaluation metric that measures the quality of a ranked list of results by comparing it against an ideal ordering. It works by assigning a gain (relevance score) to each document, applying a logarithmic discount based on its position to penalize relevant items appearing lower in the list, summing these discounted gains cumulatively, and then normalizing the result by dividing by the ideal DCG (IDCG) of a perfectly ranked list. This normalization produces a score between 0.0 and 1.0, where 1.0 represents a perfect ranking. Unlike precision-based metrics, NDCG explicitly rewards systems that place highly relevant documents at the top of the results.
Related Terms
NDCG is part of a family of metrics designed to evaluate the quality of ranked lists. Understanding these related concepts is essential for building a complete retrieval evaluation framework.
Mean Reciprocal Rank (MRR)
A rank-aware metric that focuses exclusively on the position of the first relevant document. It calculates the average of the reciprocal of the rank at which the first relevant item appears across a set of queries.
- Formula: MRR = (1/|Q|) * Σ (1/rank_i)
- Key Difference: Unlike NDCG, MRR ignores all relevant documents after the first one.
- Use Case: Best suited for navigational queries or question-answering systems where the user needs exactly one correct answer, such as a factoid lookup.
Precision@K (P@K)
A set-based metric that measures the fraction of the top K retrieved documents that are relevant, without considering their rank order within that set.
- Calculation: (Number of relevant documents in top K) / K
- Key Difference: P@K treats all positions in the top K equally, unlike NDCG which applies a logarithmic discount to lower positions.
- Use Case: Critical for evaluating the quality of the first page of search results where user attention is roughly uniform across the visible set.
Recall@K
A coverage metric that measures the fraction of all relevant documents in the corpus that are successfully retrieved within the top K results.
- Calculation: (Relevant docs in top K) / (Total relevant docs in corpus)
- Key Difference: NDCG evaluates ranking quality, while Recall@K evaluates retrieval completeness.
- Use Case: Essential for high-recall domains like e-discovery and medical literature review, where missing a relevant document is a critical failure.
Discounted Cumulative Gain (DCG)
The un-normalized precursor to NDCG that sums the graded relevance scores of documents in a result list, applying a logarithmic discount factor to penalize relevant documents appearing lower in the ranking.
- Formula: DCG_p = Σ (2^{rel_i} - 1) / log₂(i + 1)
- Key Difference: DCG is an absolute score that cannot be compared across queries with different numbers of relevant documents. NDCG solves this by dividing by the Ideal DCG (IDCG).
- Gain Function: The exponential gain (2^{rel} - 1) heavily rewards highly relevant documents over marginally relevant ones.
Learning to Rank (LTR)
A supervised machine learning framework where NDCG often serves as the primary optimization objective. LTR models learn to combine hundreds of relevance signals into a scoring function.
- LambdaMART: A gradient-boosted tree algorithm that directly optimizes NDCG by using gradients derived from the LambdaRank framework.
- Training Data: Requires query-document pairs with graded relevance judgments.
- Connection to NDCG: NDCG is the most common evaluation metric for LTR models because it captures both graded relevance and positional importance.
Ideal DCG (IDCG)
The theoretical maximum DCG achievable for a query, calculated by sorting all relevant documents in descending order of relevance grade and computing the DCG of this perfect ranking.
- Purpose: Serves as the normalization factor in NDCG, constraining the final score to the range [0, 1].
- Calculation: IDCG_p = Σ (2^{rel_i} - 1) / log₂(i + 1) for the ideal sorted order.
- Why It Matters: Without IDCG normalization, comparing DCG scores across queries with different numbers of highly relevant documents would be meaningless.

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