NDCG
What Is Normalized Discounted Cumulative Gain (NDCG)?
NDCG is a ranking-quality metric that measures whether a search, recommendation, or retrieval system places the most relevant results near the top. It compares ordered results with the best possible order, producing a score usually from 0 to 1, where higher is better and 1 is ideal when relevance values are non-negative.
Teams use NDCG for site search, product recommendations, semantic retrieval, retrieval-augmented generation (RAG), and other AI ranking models. It gives more credit to highly useful results than a simple relevant-or-not-relevant measure.
How NDCG Works
NDCG rewards useful results near the top. Lower positions receive less credit through a logarithmic discount.
- Assign relevance labels, such as 3 for highly relevant, 1 for relevant, and 0 for irrelevant.
- Sort results in the model’s predicted order.
- Calculate discounted cumulative gain (DCG), reducing credit at lower ranks.
- Calculate ideal DCG (IDCG) by ordering the same results by relevance.
- Divide DCG by IDCG to produce NDCG.
What Does NDCG@K Mean?
The @K suffix sets a cutoff. NDCG@10 evaluates only the first 10 results, which is useful when users rarely look further. A highly relevant item ranked first earns more credit than one ranked tenth. Choose K based on the number of results people inspect.
NDCG vs. DCG, MRR, and MAP
Each metric answers a different ranking question.
| Metric | What it rewards | Graded relevance | Best use |
|---|---|---|---|
| NDCG | Useful items high in the list, normalized against ideal | Yes | Search, recommendations, RAG |
| DCG | Useful items high in the list | Yes | Single-list analysis |
| MRR | The first correct result | No | Single-answer lookup |
| MAP | Precision across relevant results | Usually no | Multiple relevant documents |
Benefits of NDCG for Ranking Systems
NDCG reflects how people interact with ordered results.
- It supports graded relevance labels.
- It gives more weight to prominent positions.
- Normalization makes query results comparable.
- It works across search, recommendations, semantic retrieval, and RAG retrieval layers.
Practical Limits of NDCG
A strong score is only as trustworthy as its evaluation design.
- Relevance labels can vary between evaluators.
- K and the gain function can change conclusions.
- Queries with zero ideal gain need defined handling.
- An offline score alone cannot prove production user satisfaction.
How to Use NDCG Responsibly in AI Search Testing
Use NDCG in a repeatable test process, not as a single release gate.
- Write relevance-labeling guidelines before judging results.
- Keep results grouped by original query.
- Report averages and query-level failures.
- Segment results by query type.
- Compare changes with a stable baseline.
- Pair the metric with human review and production feedback.
NDCG in Emergent Applications
Teams building AI search, recommendations, or document retrieval can set an NDCG target before shipping. In app design and development workflows, test representative queries and relevance labels alongside functional requirements. Emergent can help turn requirements into a working application, while its AI glossary provides context for related software concepts.
on Emergent today


