Normalized Discounted Cumulative Gain (NDCG) is an evaluation metric that measures the ranking quality of search results by giving higher weight to relevant documents appearing at the top of the list, normalized for ideal ranking. It extends the simpler Cumulative Gain (CG) metric by introducing a position-based discount factor, acknowledging that a highly relevant document at rank 1 is far more valuable than one at rank 10. The 'normalized' component divides the achieved Discounted Cumulative Gain (DCG) by the Ideal DCG (IDCG)—the DCG of a perfect ranking—producing a score between 0 and 1 that allows for meaningful comparison across different queries and result sets.
Glossary
Normalized Discounted Cumulative Gain (NDCG)

What is Normalized Discounted Cumulative Gain (NDCG)?
Normalized Discounted Cumulative Gain (NDCG) is an evaluation metric that measures the ranking quality of search results by giving higher weight to relevant documents appearing at the top of the list, normalized for ideal ranking.
The metric relies on graded relevance judgments, where each document is assigned a relevance score (e.g., 0 for irrelevant, 3 for perfectly relevant), rather than a simple binary relevant/not-relevant label. The discount is typically applied logarithmically, reducing the contribution of documents as the rank position increases. NDCG is a cornerstone metric in information retrieval, widely used to evaluate the performance of learning-to-rank models, recommendation systems, and semantic search pipelines where the order of returned results is critical to user satisfaction and task success.
Core Characteristics of NDCG
Normalized Discounted Cumulative Gain (NDCG) is the industry-standard metric for evaluating ranking quality in information retrieval systems. It measures how well a system orders results by prioritizing relevant documents at the top positions while penalizing relevant items buried deep in the list.
Position-Discounted Gain
NDCG applies a logarithmic discount function to reduce the contribution of relevant documents as their rank position increases. A highly relevant document at position 1 contributes its full gain, while the same document at position 10 contributes roughly 1/log₂(11) ≈ 30% of its value. This mirrors real user behavior—searchers rarely browse beyond the first page of results. The discount is calculated as 1 / log₂(rank + 1), creating a steep decay curve that heavily rewards top-ranked precision.
Graded Relevance Judgments
Unlike binary metrics that treat relevance as a simple yes/no, NDCG supports multi-level relevance scales. Documents can be scored on a graded scale such as:
- 0: Not relevant
- 1: Marginally relevant
- 2: Relevant
- 3: Highly relevant
- 4: Perfectly relevant This granularity allows the metric to distinguish between a system that returns 'good enough' results versus one that surfaces the definitive, authoritative answer for a query.
Ideal DCG Normalization
The 'Normalized' component divides the system's DCG by the Ideal DCG (IDCG)—the score achieved by a perfect ranking where all documents are sorted in descending order of relevance. This normalization produces a value between 0.0 and 1.0, making NDCG comparable across queries with different numbers of relevant documents. A score of 1.0 indicates the system returned results in the optimal order. Without normalization, comparing DCG across queries of varying difficulty would be meaningless.
Cutoff-Based Evaluation
NDCG is typically reported at specific rank cutoffs, written as NDCG@k where k represents the number of top results evaluated. Common values include:
- NDCG@5: Measures the quality of results visible without scrolling on mobile
- NDCG@10: Evaluates the first page of results
- NDCG@100: Assesses deep ranking quality for recall-oriented tasks This cutoff specificity allows engineers to optimize for different use cases—a voice assistant might prioritize NDCG@1, while a legal discovery system cares about NDCG@100.
Cumulative Gain Foundation
The metric builds on Cumulative Gain (CG), which is simply the sum of relevance scores across all retrieved documents. Discounted Cumulative Gain (DCG) extends this by applying the position discount, calculated as: DCG = Σ (2^relevance - 1) / log₂(rank + 1). The exponential gain function 2^relevance - 1 ensures that highly relevant documents contribute disproportionately more value—a document with relevance 4 contributes 15 times the gain of a document with relevance 1, emphasizing the premium on surfacing the best content first.
Handling Missing Judgments
In large-scale evaluation, human annotators cannot judge every document for every query. NDCG implementations must handle unjudged documents carefully. Common strategies include:
- Treating unjudged as irrelevant (0): Conservative approach that may unfairly penalize systems
- Ignoring unjudged documents: Removes them from the calculation entirely
- Inferred relevance: Using click-through data or model predictions as proxy judgments The choice of strategy significantly impacts reported scores and must be documented in any rigorous evaluation framework.
NDCG vs. Other Ranking Metrics
A comparative analysis of Normalized Discounted Cumulative Gain against other common information retrieval evaluation metrics, highlighting their distinct mechanisms, sensitivity to position, and handling of graded relevance.
| Feature | NDCG | Precision@k | MAP | MRR |
|---|---|---|---|---|
Handles Graded Relevance | ||||
Position-Aware Discounting | ||||
Normalized Across Queries | ||||
Primary Use Case | Multi-level relevance judgments | Binary relevance in top-k | Ranked retrieval with binary labels | First relevant result position |
Sensitivity to Top Positions | High (logarithmic discount) | None (uniform weight in set) | Moderate (average precision) | Very High (reciprocal rank) |
Ideal Ranking Baseline | ||||
Typical Range | 0.0 to 1.0 | 0.0 to 1.0 | 0.0 to 1.0 | 0.0 to 1.0 |
Frequently Asked Questions
Clear, technical answers to the most common questions about Normalized Discounted Cumulative Gain (NDCG), the standard metric for evaluating ranking quality in information retrieval and recommendation systems.
Normalized Discounted Cumulative Gain (NDCG) is an evaluation metric that measures the quality of a ranked list of results by comparing the actual order against an ideal ordering. It works by assigning a relevance score to each document, applying a logarithmic discount to penalize relevant documents appearing lower in the list, and then normalizing the result against the Ideal DCG (IDCG)—the score achieved by a perfect ranking. The formula is NDCG@k = DCG@k / IDCG@k, where k represents the cutoff position. This normalization ensures scores fall between 0.0 and 1.0, making NDCG comparable across different queries with varying numbers of relevant results. Unlike precision-based metrics, NDCG captures graded relevance (e.g., "perfect," "good," "fair") rather than binary judgments, making it the preferred metric for modern search engines and recommendation systems where relevance exists on a spectrum.
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
Explore the core metrics and concepts that complement NDCG in evaluating ranking quality and search relevance.
Mean Reciprocal Rank (MRR)
A metric that measures the effectiveness of a ranking system by identifying the position of the first relevant result. It is calculated as the average of the reciprocal ranks across a set of queries.
- Formula: MRR = 1/|Q| * Σ (1/rank_i)
- Focus: Perfect for use cases where the user only needs one relevant document, such as a direct answer or a 'known-item' search.
- Limitation: It ignores all relevant documents appearing after the first one, making it unsuitable for evaluating recall-oriented tasks.
Mean Average Precision (MAP)
A binary relevance metric that calculates the average precision at each position where a relevant document is found, then averages this across all queries. It provides a single-figure measure of quality across recall levels.
- Precision Focus: Heavily penalizes systems that retrieve irrelevant documents high in the ranking.
- Binary Assumption: Assumes relevance is strictly binary (relevant or not), unlike NDCG which handles graded relevance.
- Usage: Commonly used in academic benchmarks where judgments are binary.
Discounted Cumulative Gain (DCG)
The un-normalized precursor to NDCG. It sums the graded relevance scores of documents in a result list, applying a logarithmic discount to penalize relevant documents appearing lower in the ranking.
- Discount Logic: The value of a relevant document at position 10 is much lower than at position 1.
- Raw Score: DCG is an absolute score that cannot be easily compared across queries with varying numbers of relevant documents, which is why normalization (NDCG) is essential.
- Formula: DCG_p = Σ (rel_i / log2(i+1))
Ideal Discounted Cumulative Gain (IDCG)
The theoretical maximum DCG achievable for a given query. It is calculated by sorting all known relevant documents in descending order of their graded relevance scores, producing the perfect ranking.
- Normalization Factor: NDCG is derived by dividing the actual DCG by the IDCG.
- Upper Bound: An NDCG of 1.0 indicates the system achieved the perfect ranking order.
- Dependency: The quality of IDCG is entirely dependent on the completeness of your relevance judgments.
Graded Relevance Judgments
The foundational data input for NDCG that assigns a multi-level score to a document-query pair, moving beyond simple binary relevance.
- Scale Example: 0 (Irrelevant), 1 (Marginally Relevant), 2 (Relevant), 3 (Highly Relevant), 4 (Perfectly Authoritative).
- Gain Function: NDCG often uses an exponential gain (e.g., 2^rel - 1) to make highly relevant documents disproportionately more valuable.
- Human Annotation: These judgments are typically created by human raters following strict guidelines.
Precision@K
A simple metric measuring the proportion of relevant documents within the top-K results. It is purely precision-focused and does not consider the order of documents within that set.
- Position Agnostic: A relevant document at rank 1 counts the same as one at rank K.
- Contrast with NDCG: Unlike NDCG, Precision@K does not reward systems for placing the most relevant documents first.
- Use Case: Useful for front-page analysis where the user scans all top results equally.

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