Ranking quality when relevance isn't just yes or no. Rewards great results at the top more than merely decent ones.
| Full name | Normalized Discounted Cumulative Gain |
| What it measures | How well a ranked list orders results by graded relevance, discounting results that appear further down the list |
| Formula | DCG = the sum of each result’s relevance score divided by the log of its rank position; NDCG = DCG divided by the ideal DCG for that query |
| Typical range | 0 to 1 |
| Used for | Search engines and recommender systems where relevance has degrees, not just a yes-or-no label |
| Best used for | Comparing ranking quality when some results are clearly better than others, not merely relevant or irrelevant |
| Pair with | mAP when a simpler binary-relevance check is also useful, and click-through data as a real-world sanity check |
Most ranking problems are not really binary. A search result can be exactly what someone wanted, somewhat useful, or completely irrelevant, three states, not two, and a metric that only recognises relevant-or-not throws away real information. NDCG, introduced by Järvelin and Kekäläinen in 2002, was built to score rankings against graded relevance labels, and it has become the standard metric for search engine evaluation precisely because real-world relevance is almost never black and white.
Each result in a ranked list has a relevance grade, commonly on a scale like 0 to 3 or 0 to 5, rather than a simple relevant-or-not label. Discounted Cumulative Gain (DCG) sums each result’s relevance score, discounted by the logarithm of its position in the list, so a highly relevant result at rank 1 contributes far more than the same result would at rank 10. To make scores comparable across different queries, which may have different numbers of relevant results available, DCG is normalised by the Ideal DCG, the DCG score of the best possible ordering of the same results, giving a final NDCG score between 0 and 1, where 1 means the system produced the perfect ranking.
Suppose a query returns five results with relevance grades 3, 2, 3, 0 and 1, in that order (on a 0-to-3 scale, where 3 is highly relevant and 0 is irrelevant). DCG sums each grade divided by the log of its rank: the result at rank 1 contributes its full relevance, rank 2 contributes slightly less relative to its grade, and so on down the list, with results further down discounted more heavily. The ideal ordering of the same five relevance grades would sort them from highest to lowest, 3, 3, 2, 1, 0, which produces the maximum possible DCG for this set of results. NDCG is simply the actual DCG divided by that ideal DCG, giving a score below 1 whenever the system’s ordering falls short of the best possible arrangement, here specifically because the highly relevant result graded 3 appears at rank 3 instead of rank 2, costing the system some of the ranking credit it could have had.
NDCG is the dominant metric in modern search engine evaluation, in large-scale recommender system benchmarks, and in the machine-learned ranking research that underlies both. It is the metric of choice whenever relevance judgments come from human raters assigning graded scores rather than simple relevant-or-not labels, which is how most commercial search quality teams actually annotate their evaluation sets.
NDCG rewards exactly the behaviour a good ranking system should have: put the best results first, and treat a merely acceptable result as worth less than an excellent one, even if both would count as “relevant” under a binary scheme. The logarithmic discount is a principled way to model the common finding that users rarely look past the first handful of results, so it naturally weights the top of the list far more heavily than positions far down it.
NDCG requires graded relevance judgments, which are more expensive to collect than simple yes-or-no labels, since human raters need a consistent, well-defined scale and training to apply it consistently. The choice of discount function and the exact relevance scale both affect the final number in ways that make scores computed under different conventions hard to compare directly across organisations or papers. And like every metric built from static relevance judgments, NDCG measures ranking quality against those judgments, not against what real users actually click, scroll past or find useful in practice, which is why production search and recommendation teams treat it as a strong proxy rather than the final word.
I use NDCG whenever relevance genuinely comes in degrees, which in practice is most real search and recommendation problems. For a simpler binary-relevance check, or to compare against older literature, I report mAP alongside it. And for any system actually shipping to users, I treat NDCG on held-out judgments as necessary but not sufficient, validating it against real engagement metrics from production traffic before trusting it as the final verdict.