The Base-2 Logarithm That Forces Search Engines to Prioritize the First Page
Search algorithms rely on Normalized Discounted Cumulative Gain (NDCG) to measure quality, using a logarithmic decay function to model how quickly user attention drops off. By separating a document's absolute relevance from its position in the results, the metric ensures engines are penalized heavily for burying perfect answers beneath merely good ones.
By Naina Verma
- Information Retrieval Purists
- Argue that NDCG is the only mathematically sound way to evaluate graded relevance across diverse query sets.
- Commercial Search Vendors
- View NDCG primarily as a benchmark for marketing, focusing on top-level scores to demonstrate retrieval capabilities.
- User Experience Researchers
- Criticize the rigid base-2 logarithmic decay, arguing that modern interfaces break the top-to-bottom linear assumption.
Perspectives this story doesn't cover
- E-commerce merchants whose products are ranked
- End users whose behavior the metric attempts to model
Common questions
Why do search engines use a base-2 logarithm for the discount?
The base-2 logarithm creates a steep initial drop-off that closely models how quickly users abandon search results if they do not find what they need on the first page.
Can NDCG scores be compared across different datasets?
No. While NDCG normalizes scores across different queries within the same dataset, the absolute scores cannot be meaningfully compared across entirely different search environments.
Does NDCG penalize a system for showing bad results?
No. The metric only rewards the presence of highly relevant documents. A system that shows one perfect result followed by nine terrible ones will still score highly if the perfect result is at the top.
The short answer
- NDCG separates a document's absolute relevance from its rank position using a logarithmic discount function.
- The base-2 logarithm creates a steep penalty for burying highly relevant results, reflecting the rapid decay of user patience.
- By dividing the actual score by the ideal score, the metric normalizes performance on a 0.0 to 1.0 scale across different queries.
- The metric does not penalize search engines for returning irrelevant documents, only for failing to rank good ones highly.
Enterprise search vendors frequently market their latest retrieval-augmented generation systems by claiming the artificial intelligence understands user intent better than ever before. But the evidence they cite to prove this superiority—a metric called Normalized Discounted Cumulative Gain (NDCG)—does not measure semantic understanding at all. Instead, as the 2008 Wikipedia documentation on the metric outlines, it measures a much simpler, harsher reality: the mathematical decay of human patience.[1]
NDCG is the industry standard for evaluating ranking systems, used by everyone from e-commerce giants to academic researchers. It operates on a fundamental premise that a highly relevant document is useless if it appears on page three. To quantify this, the metric separates the absolute quality of a result—its graded relevance—from the position where the search engine actually placed it.
The mechanism relies on a specific mathematical operation: logarithmic discounting. According to the 2024 technical documentation from vector database vendor Zilliz, the formula divides the relevance score of a document by the base-2 logarithm of its rank position plus one. "The premise of DCG is that highly relevant documents appearing lower in a search result list should be penalized," the Zilliz documentation states.[3]
This penalty is not linear. A linear penalty would treat the drop from position one to position two the same as the drop from position nine to position ten. Instead, the base-2 logarithm creates a steep initial cliff that flattens out over time. A perfect result at position one retains 100 percent of its value. At position two, it drops to 63 percent. By position ten, the algorithm only credits the search engine with 28 percent of that document's actual worth.
To understand how this shapes search behavior, consider the numerator of the equation. As machine learning platform ApX Machine Learning explains in its recommendation system curriculum, relevance is not binary. A document is not simply relevant or irrelevant. It is graded on a scale, typically from zero to three or zero to four, where three represents a perfect match and zero represents a complete miss.[7]
In the most aggressive version of the formula, popularized by Microsoft researchers in the early 2000s and detailed in the 2025 MetricGate documentation, this graded relevance is exponentiated. The numerator becomes two to the power of the relevance grade, minus one. A grade of three yields a numerator of seven, while a grade of two yields a numerator of three. This exponential scaling heavily rewards search engines for retrieving the absolute best document, rather than a handful of mediocre ones.[4]
Calculating the Discounted Cumulative Gain (DCG) for a single query is only half the battle. The raw DCG score is highly dependent on the query itself. A search for a highly specific term might only have two relevant documents in the entire database, capping the maximum possible DCG. A broad search might have thousands of relevant matches.
Calculating the Discounted Cumulative Gain (DCG) for a single query is only half the battle.
This creates a normalization problem. If an engineer wants to know whether a new algorithm is better across an entire test suite of 10,000 queries, they cannot simply average the raw DCG scores. The broad queries with massive raw scores would completely drown out the specific queries, skewing the evaluation toward head terms and ignoring the long tail.
The solution, as outlined by Evidently AI in their ranking metrics guide, is the normalized part of NDCG. For every query, the system calculates the Ideal DCG (IDCG). This is the score the search engine would have achieved if it had ranked the available documents in perfect, descending order of relevance.[5]
The actual DCG is then divided by the IDCG, producing a final NDCG score between 0.0 and 1.0. A score of 1.0 means the search engine produced the mathematically perfect ranking for that specific query. A score of 0.0 means it retrieved nothing of value. Because every query is now on the same 0.0 to 1.0 scale, engineers can average them together to evaluate the overall system.
"NDCG is particularly useful because it handles multiple levels of relevance and normalizes the score, making it possible to compare performance across different queries," notes the Redis engineering blog in their guide to evaluating information retrieval. This cross-query comparability is what allows vendors to claim a 5 percent improvement in NDCG when pitching a new vector database.[6]
However, the metric has strict limitations that vendors often gloss over. NDCG does not penalize a system for returning bad documents, only for failing to return good ones high up in the ranking. If a search engine returns one perfect document at position one, and nine completely irrelevant documents in positions two through ten, its NDCG at position one is a perfect 1.0.
Furthermore, the metric assumes that the user examines results strictly in order, from top to bottom, without skipping. It assumes that the user's patience decays exactly according to a base-2 logarithm. If a user interface presents results in a grid, or if users frequently scroll past the first result to look at the second, the mathematical model diverges from human reality.
The choice of the base-2 logarithm itself is an industry convention rather than a psychological law. While it effectively models the steep drop-off in click-through rates observed on early web search engines, modern interfaces with infinite scroll or conversational artificial intelligence outputs may require different decay functions to accurately reflect user behavior.
Despite these blind spots, NDCG remains the gravitational center of the search industry. Every time a ranking model is trained, it is optimizing for this specific mathematical curve. The metric forces engineers to obsess over the top three positions, treating anything below the fold as a rounding error in the pursuit of relevance.
Jargon, explained
- Normalized Discounted Cumulative Gain (NDCG)
- A standard metric used to evaluate the quality of ranking systems by measuring the usefulness of documents based on their position in the results list.
- Graded Relevance
- A scoring system that assigns multiple levels of usefulness to a document (e.g., perfect, good, fair, bad) rather than a simple yes/no binary.
- Logarithmic Discounting
- A mathematical function that reduces the value of a document the further down the search results list it appears, modeling the drop in user attention.
- Ideal DCG (IDCG)
- The maximum possible score for a specific query, achieved only if the search engine ranks all available documents in perfect descending order of relevance.
Sources
[1]WikipediaInformation Retrieval PuristsDiscounted cumulative gain
Read on Wikipedia →
[2]Emergent MindNDCG-Based Objectives
Read on Emergent Mind →
[3]ZillizCommercial Search VendorsHow is Normalized Discounted Cumulative Gain (nDCG) calculated?
Read on Zilliz →
[4]MetricGateCommercial Search VendorsNormalized Discounted Cumulative Gain (NDCG) Calculator
Read on MetricGate →
[5]Evidently AIInformation Retrieval PuristsNormalized Discounted Cumulative Gain (NDCG) explained
Read on Evidently AI →
[6]RedisCommercial Search VendorsEvaluating information retrieval with NDCG@K & Redis
Read on Redis →
[7]ApX Machine LearningInformation Retrieval PuristsNormalized Discounted Cumulative Gain (NDCG)
Read on ApX Machine Learning →
[8]Factlen Editorial TeamUser Experience ResearchersSynthesis by Factlen editorial team
Read on Factlen Editorial Team →
Comments
More in Content Types
See all →Database Architecture
How OLTP Optimizes for Write Speed While OLAP Optimizes for Read Aggregation
5 sources
CPU Architecture
How Instruction Pipelining and Out-of-Order Execution Separate Latency from Throughput in a Modern CPU
6 sources
Collective Intelligence
How the Diversity Prediction Theorem Separates the Crowd's Error from the Average Individual's Error
8 sources
Nuclear Security
How the Expiration of the New START Treaty Rewrites the Rules of Global Nuclear Arms Control and Security
6 sources
Every angle. Every day.
Get Content Types stories with full source coverage and perspective breakdowns delivered to your inbox.




