Inferensys

Glossary

NDCG (Normalized Discounted Cumulative Gain)

A standard listwise evaluation metric for re-ranking that measures the quality of a ranked list by discounting relevance gains logarithmically by position and normalizing against the ideal ranking, heavily weighting top-ranked precision.
AI evaluator reviewing output quality on laptop, comparison metrics visible, casual evaluation session.
EVALUATION METRIC

What is NDCG (Normalized Discounted Cumulative Gain)?

NDCG is a standard listwise evaluation metric for information retrieval and re-ranking systems that measures the quality of a ranked list by discounting relevance gains logarithmically by position and normalizing against the ideal ranking.

Normalized Discounted Cumulative Gain (NDCG) is a ranking quality metric that evaluates a system's ability to place highly relevant documents at the top of a results list. It computes the Discounted Cumulative Gain (DCG) by summing the graded relevance of each document, logarithmically discounted by its rank position to penalize relevant items appearing lower in the list. This raw DCG score is then normalized by dividing it by the Ideal DCG (IDCG)—the DCG of a perfect ranking—yielding a value between 0.0 and 1.0.

NDCG is the dominant metric for cross-encoder re-ranking and learning to rank (LTR) systems because it supports multi-level graded relevance judgments (e.g., irrelevant=0, relevant=1, highly relevant=2) rather than binary labels. Unlike Mean Reciprocal Rank (MRR), which only considers the first relevant document, NDCG accounts for the entire ranked list, making it sensitive to both top-heavy precision and overall recall quality. It is the optimization target for algorithms like LambdaMART, which use the gradient of NDCG to train ranking models.

EVALUATION METRIC

Key Characteristics of NDCG

Normalized Discounted Cumulative Gain (NDCG) is the primary listwise metric for evaluating ranking quality in information retrieval. It measures how well a system orders documents by penalizing relevant items that appear lower in the list, then normalizes against the ideal ranking to produce a score between 0 and 1.

01

Position-Based Discounting

NDCG applies a logarithmic discount to relevance gains based on rank position. A highly relevant document at position 1 contributes its full gain, while the same document at position 10 contributes only a fraction. The discount function is typically 1 / log2(rank + 1), meaning the drop-off is steepest at the top ranks. This reflects user behavior: searchers rarely scroll beyond the first few results, so top-heavy precision is weighted more heavily than recall at depth.

02

Graded Relevance Judgments

Unlike binary metrics (relevant/not relevant), NDCG supports multi-level relevance scales. Documents can be labeled with scores like:

  • 0: Irrelevant
  • 1: Marginally relevant
  • 2: Relevant
  • 3: Highly relevant
  • 4: Perfectly relevant

This granularity allows NDCG to distinguish between a system that places a 'perfect' document at rank 1 versus one that places a merely 'relevant' document there. The cumulative gain is the sum of these graded scores across the ranked list before discounting.

03

Ideal DCG Normalization

The 'N' in NDCG stands for normalization. After computing the Discounted Cumulative Gain (DCG) of the system's ranked list, NDCG divides it by the Ideal DCG (IDCG) — the DCG of the perfect ranking where all documents are sorted in descending order of relevance. This normalization produces a score between 0.0 and 1.0, making NDCG comparable across queries with different numbers of relevant documents. A score of 1.0 means the system produced the optimal ordering.

04

Cutoff-Based Evaluation (NDCG@k)

NDCG is typically reported at a specific cutoff depth, written as NDCG@k (e.g., NDCG@10). This evaluates only the top k results, aligning with the reality that users rarely examine results beyond the first page. Common cutoffs include:

  • NDCG@1: Measures if the top result is relevant
  • NDCG@5: Evaluates the first half of a typical SERP
  • NDCG@10: Standard full-page evaluation

Different k values reveal different system behaviors: a system might excel at NDCG@1 but degrade at NDCG@20.

05

Exponential Gain Variants

Standard NDCG uses linear gain (relevance score = gain). However, many implementations use an exponential gain function: 2^relevance - 1. This dramatically amplifies the difference between relevance levels. For example:

  • Relevance 3 → gain of 7
  • Relevance 4 → gain of 15

This variant, sometimes called NDCG with exponential gain, strongly penalizes systems that fail to place highly relevant documents at the very top, making it the preferred formulation in modern search evaluation benchmarks like MS MARCO.

06

Listwise vs. Pointwise Metrics

NDCG is a listwise metric — it evaluates the entire ordering as a single unit rather than individual query-document pairs. This contrasts with:

  • Pointwise metrics like precision@k, which treat each position independently
  • Pairwise metrics like Mean Reciprocal Rank (MRR), which only consider the first relevant document

NDCG's listwise nature makes it the preferred optimization target for Learning to Rank (LTR) algorithms like LambdaMART, which use NDCG's lambda gradients to directly optimize ranking order during training.

NDCG METRIC CLARIFIED

Frequently Asked Questions

Precise answers to the most common technical questions about Normalized Discounted Cumulative Gain, the standard listwise metric for evaluating re-ranking and search quality.

Normalized Discounted Cumulative Gain (NDCG) is a listwise evaluation metric that measures the quality of a ranked list by comparing it against an ideal ordering. It works by first computing the Discounted Cumulative Gain (DCG), which sums the graded relevance scores of documents in a result list, applying a logarithmic discount to penalize relevant documents appearing lower in the ranking. This DCG value is then normalized by dividing it by the Ideal DCG (IDCG)—the DCG of the perfectly ordered list—yielding a score between 0.0 and 1.0. The normalization ensures comparability across queries with varying numbers of relevant documents. NDCG heavily weights top-ranked precision, making it the standard metric for evaluating Cross-Encoder re-ranking and Learning to Rank (LTR) systems where early positions are critical.

EVALUATION METRICS COMPARISON

NDCG vs. Other Ranking Metrics

How NDCG compares to other standard information retrieval metrics for evaluating ranked lists, highlighting key differences in handling graded relevance, position weighting, and normalization.

FeatureNDCGMRRPrecision@KMAP

Handles graded relevance

Position-aware discounting

Normalized against ideal ranking

Considers all relevant documents

Sensitive to top-ranked precision

Binary relevance only

Common use case

Re-ranking quality with multi-level labels

First correct answer position

Top-K retrieval precision

Ranked retrieval with binary labels

Typical range

0.0 to 1.0

0.0 to 1.0

0.0 to 1.0

0.0 to 1.0

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.