Subscribe
AI
5 min read

What Is nDCG? The Ranking Scorecard

BEIR, MTEB and every RAG writeup report nDCG@10. The 2002 metric assumes a human scanning results top to bottom, and language models have broken that assumption.

What Is nDCG? The Ranking Scorecard

Every serious retrieval benchmark reports one number in its headline table. BEIR graded 18 zero-shot retrieval datasets with nDCG@10. MTEB, the embedding benchmark that sits behind most model cards, says flatly that for retrieval tasks "nDCG@10 serves as the main metric". If you have read a RAG evaluation writeup in the last five years, you have seen this score, and it probably got one sentence of explanation at best.

This is that explanation.

What precision and recall leave on the table

Precision@k and recall@k answer one question: did the relevant documents make it into the top k? They are blind to everything else about the list. A search system that puts your best answer at rank 1 and one that puts it at rank 9 get identical precision@10. Binary metrics are also deaf to degrees: a page that fully answers the query and a page that is marginally topical both count as exactly one relevant hit.

Kalervo Järvelin and Jaana Kekäläinen, working at the University of Tampere, built the replacement in two steps. A 2000 SIGIR paper introduced the discounted cumulated gain idea, and a 2002 ACM Transactions on Information Systems article formalized the family, comparing binary and non-binary weighting of relevance across TREC runs. NIST's trec_eval, the evaluation toolkit used by the Text Retrieval Conference, still implements nDCG "according to Jarvelin and Kekalainen (ACM ToIS v. 20, pp. 422-446, 2002)".

The formula, in three moves

Assume a human annotator has graded each retrieved document for relevance, say on a scale from 0 to 3, for a given query and a cutoff of k positions.

Move one: gain. Each document at rank i contributes its relevance score, its gain.

Move two: discount by position. Documents deeper in the list count for less. Järvelin and Kekäläinen divide the gain by log2 of the rank, so the contribution of a document at position i is rel_i / log2(i + 1). The sum of these discounted gains over the top k positions is DCG@k. The 2002 paper uses log2 of the document rank as the discount, and the effect is steep: position 1 counts at full weight, position 2 keeps about 63% of its score, position 3 about 50%, and position 10 under 30%. Across a top-10 list, roughly 36% of all possible credit sits in the first two positions.

Move three: normalize. A query with many highly relevant documents has a higher achievable DCG than a query with one mediocre answer, so raw DCG scores cannot be compared across queries. nDCG divides the DCG of the system's ranking by the DCG of the ideal ranking, which is what you would get if every judged document were sorted best-first. The quotient, normalized DCG, always lands between 0 and 1. An nDCG@10 of 0.75 means the system captured 75% of the score that perfect ordering of the same judged documents would earn.

A worked example. Say the judged top-5 list for a query has relevance grades 2, 3, 2, 1, 0, and the ideal ordering of those same documents is 3, 2, 2, 1, 0. The list's DCG@5 is 2/1 + 3/1.585 + 2/2 + 1/2.322 = 5.32. The ideal is 3/1 + 2/1.585 + 2/2 + 1/2.322 = 5.69. nDCG@5 is 5.32 / 5.69 = 0.94. The single misplacement, the best document sitting at rank 2 instead of rank 1, costs about 6.5 points of score. Sink it to rank 5 and the loss grows to roughly 14 points. That is the design goal: punish lists that bury the good stuff, with the penalty widening the deeper the useful document falls.

Two columns of document cards: one sorted best-first, the other with two cards swapped

Why it stuck

nDCG solved a practical problem for the TREC generation: results had become good enough that binary measures compressed thousands of systems into near-identical scores, and graded judgments were becoming standard. The metric rewards a system for ordering by how relevant things are, not just whether they clear a threshold, which matches how ranking models are actually trained. Two decades later the layout of a modern retrieval paper has not changed: BEIR reports nDCG@10 across all 18 of its datasets, and MTEB does the same for its retrieval tasks, which is why embedding model cards from OpenAI, Google, Alibaba and open-source shops are directly comparable at a glance.

Where it is fragile

Three caveats belong in every reader's head.

The judgments are the metric. nDCG is only as good as the annotation file, and documents never judged simply count as zero gain. The BEIR authors run a case study on TREC-COVID where manually re-annotating the judgments moves nDCG@10 for the systems under test, a reminder that leaderboard gaps can be labeling gaps.

Small differences are small. Because nDCG averages a ratio over queries, a 0.01 improvement can be noise, a judgment artifact, or a real gain, and the metric itself cannot tell you which.

The consumer may not be a human. This is the live research question. The log discount encodes an assumption from 2002: a person scans results top to bottom and attention decays with depth. A RAG system does not scan. The LLM receives every retrieved passage at once, inside one context window. And LLMs are demonstrably not position-neutral readers: the Lost in the Middle study found performance is often highest when relevant information sits at the beginning or end of the input and degrades significantly when models must use information buried in the middle of long contexts, even for models marketed as long-context.

A 2025 paper, "Redefining Retrieval Evaluation in the Era of LLMs", attacks the mismatch directly. Its authors argue that classical metrics fail on two axes at once: the human-vs-machine position discount, and the fact that relevance for a generator is not relevance for a human. A related-but-useless passage is not neutral in a RAG pipeline; it occupies context and can actively degrade the generated answer, which no nDCG formulation penalizes. Their proposed fix, UDCG, uses utility-based annotations and an LLM-oriented positional discount, and reports correlation with end-to-end answer accuracy up to 36% higher than traditional metrics across five datasets and six LLMs.

A fading cascade of document shapes under a descending teal arc

What to take to your own evals

If you run a RAG pipeline, the practical reading is: keep nDCG@k as your retriever's internal scoreboard, because it is the one number every public baseline also reports, but set k to what you actually stuff into the prompt (nDCG@5 for a five-chunk pipeline, not the default @10), and do not stop there. Pair it with recall@k so you know whether failures come from the retriever or the generator, re-judge a sample of your own queries rather than trusting borrowed qrels, and treat single-point moves as unproven. The research trendline is clear: the metric that spent 24 years assuming a human scanner is being rebuilt for a machine reader, and until those replacements standardize, nDCG is the number you quote while quietly checking whether the answer downstream actually got better.

Sources

AILLMeducational