# nDCG improved but the business didn't move: first check the metric definition, then check the sample size

Date: 2026-11-20
Category: Technology
Tags: Ranking Evaluation, Metric Definitions, A/B Testing
Summary: When offline nDCG improves but online business metrics stay flat, it's usually not that the metric is useless, but that the discount curve, gain definition, and normalization denominator don't align with the business's own framework; it could also simply be insufficient sample size.

Ranking model launch review: offline nDCG@10 is up by a bit over two points, the A/B test has run a full two weeks, and the conversion-rate curve is wobbling around zero. In the meeting room there are usually two voices: one says this metric is just self-indulgence, the other says another two weeks of traffic will make it significant. The two conclusions imply completely opposite actions—one says change the metric, the other says add samples—but many teams touch the model before telling them apart.

First, separate the two questions: how many layers sit between nDCG and the business metric, and what the misalignment looks like at each layer. Once you've pulled them apart, you'll find that most cases of "the metric is lying" are really the metric being used in the wrong scenario, and a small portion are experiment designs that simply can't measure anything.

## The discount curve isn't your users'

The standard form of nDCG divides each result's gain by a discount factor that decays with position, then normalizes against the ideal ranking. The discount comes from log2(1+position); the coefficients for positions one through five are roughly 1.00, 0.63, 0.50, 0.43, 0.39, and position ten is 0.29.

What this shape means: a good result ranked tenth is still worth three-tenths of the first position. It was born in an era when users browsed entire pages or even paged through result lists, and it evaluates the ranking quality of long document lists. Put it in a single-column feed, a search first screen that shows only three items, or a conversational recommendation that gives one answer, and it is clearly too optimistic.

The reverse also holds. In business terms the CTR gap between position one and position three is often three to five times, but nDCG records it as only two times; while position three and position eight may both be zero in business terms, yet nDCG differs by nearly 0.19. The deviations in the two directions can cancel each other out or stack, depending on your scenario, so saying broadly that "nDCG overestimates" or "underestimates" is meaningless.

One actionable approach: aggregate impressions and clicks for the same scenario over the past four weeks by position, plot CTR for positions one through ten, and overlay the log2 discount curve on the same chart. If the two curves differ greatly in shape, the order this metric produces is not the order you care about in business. Note that CTR itself carries position bias; comparing shapes is enough, but if you really want to use it as weights you need a position-randomization experiment to debias.

## The normalization denominator makes nDCG valid only within the same candidate set

The denominator of nDCG is the ideal ranking score over the same batch of candidates. The words "same batch" are the easiest to overlook.

If recall changes from a two-tower model to two-tower plus vectors, and the candidate pool gains hundreds of highly relevant but long-tail items, the ideal ranking score rises and nDCG may actually drop. This is completely normal engineering-wise, but a disaster in reporting: you made a positive change, the metric is negative, and then someone quietly rolls back the recall to make the report look good.

The second consequence is that it's not comparable across versions. Putting last week's nDCG and this week's on the same trend chart assumes the candidate set hasn't changed, the label set hasn't changed, and the discount function hasn't changed; break one and the chart is fake.

My practice is to let nDCG appear only in experiments with a fixed candidate set and fixed label set, specifically to evaluate the ranking layer, and keep it out of weekly reports and cross-iteration accumulation. If you want an absolute-scale metric that can go into a weekly report, you have to define it yourself. This isn't a defect of nDCG—normalization exists precisely to cancel out difficulty differences between queries so different queries can be averaged together. The problem is that many people use it as a business metric.

## The average hides where the gain comes from

nDCG is averaged per query or weighted by impressions, while the business looks at totals. When the distribution is uneven, these two ways of aggregating will inevitably diverge.

Head queries take most of the traffic, and their ranking has long been saturated—going up from 0.92 is extremely hard; long-tail queries may be at only 0.5, and any small change can raise them five points. If the evaluation set averages per query, progress on the long tail will pull the overall number up, but the long tail may contribute only single-digit percentages of conversions. The average also compresses "one type of query up three points, another down two points" into a single positive number.

The criterion isn't complicated: split the offline gain by traffic stratum and see how much impression and conversion the queries that improved contribute online. If 80% of the gain comes from the tail that accounts for only 10% of impressions, then offline up and online flat is the expected result, not a broken metric.

## Additivity within a query hides session-level waste

nDCG has another assumption: the gain of each result is independently additive. Rank three nearly identical products, and as long as each is relevant, you get a perfect score.

What the user sees in the session is repetition. The second one has very low information gain, and the third is basically wasted exposure. This is extremely common in scenarios with highly homogeneous supply such as products, short videos, and news; the model easily learns a strategy of "stacking similar high-scoring items" because it really does max out nDCG. What the business side sees is clicks concentrated on the first item, zero clicks on the next few, and shorter browsing sessions.

So if you optimize nDCG without guardrails, the model will definitely drift in this direction. At minimum, watch three numbers: same-screen category repetition rate, share of a single supplier, and the exposure proportion of exploration traffic. Without thresholds on these three, the better the ranking metric looks, the worse the business diversity gets.

## The editor's 3 is not the user's 3

Where the gain comes from is the layer most easily glossed over. Most teams use human relevance grades from a guideline, 0 to 4. This has three concrete problems.

The middle grades are the least stable. The "partially relevant" grade often has only low-to-moderate agreement between annotators, and the exponential gain in nDCG amplifies it: a 2 corresponds to a gain of 3, a 3 corresponds to a gain of 7, so one misjudged label can more than double the score difference.

Missing context. The annotator sees one query plus one result, and cannot see the user's price sensitivity, history, or inventory status. The same product has different relevance for different users, but the label has only one value.

Unlabeled is always treated as zero. Newly listed or newly stocked items aren't in the label set, so their gain is recorded as 0, and nDCG systematically penalizes them. The more the system is optimized, the more conservative it becomes; new products get no exposure, and the freshness and supply diversity the business wants naturally don't move. This isn't a model problem, it's an evaluation-set coverage problem.

There's a more insidious one: labels come from click logs. The old ranking put a result up front, it got clicks, and the label considers it relevant; the new model learns to reproduce the old ranking, and position bias gets baked into the training objective. To be unbiased you need randomized exposure or position-swapped data.

## Aligning the units: turn gain into money, turn discount into a measured curve

If the ranking layer is to be accountable for business metrics, the metric itself must carry business units. Three steps, but each one needs someone to sign off.

Step one, estimate the discount from logs. The exposure probability for positions one through ten should ideally come from a randomized experiment, or failing that, be estimated from position-swapped pairwise data.

Step two, change the gain from relevance grades to expected value: the expected transaction amount, expected dwell time, or expected ad revenue of this item in this scenario. Compute it separately by category, price band, and user segment; don't smear a single global average over everything.

Step three, drop normalization and use absolute values directly, such as expected transaction amount per thousand impressions. Absolute values are affected by the candidate set and traffic structure, but the benefit is that they can be reconciled against the business ledger and are comparable across versions.

```yaml
metric: value_dcg_at_10
unit: 元 / 千次曝光
gain: 该 item 在该场景下的期望成交额，按类目、价格带、用户分层分别估计
discount: 线上实测的曝光概率曲线，位置 1 到 10
denominator: 无，用绝对值不归一化
slice: 按 query 流量分层、按新老品分层
guardrail: 头部 query 的 top3 命中率不下降，同屏类目重复率不上升
owner: 搜索产品，增益定义变更需产品签字
```

Once a metric like this goes up, there's also a reconciliation step: convert the increment into money and check whether it moves in the same direction and is of a similar magnitude as the change in GMV in the A/B test. If value-DCG rises three points, which converts to several hundred thousand per month, while A/B GMV doesn't budge, then either the conversion coefficient is wrong or the share of traffic actually affected by the change is too small.

A word on responsibility boundaries: how to define gain is a product decision. Ranking engineers can only optimize under a given gain; they can't make business decisions about what counts as valuable. If this isn't written into the doc, every time a metric doesn't line up it degenerates into the model team and the business team trying to persuade each other instead of investigating the metric definition together.

## Maybe it's just not enough samples—let's do the math first

Not every "business didn't move" is a metric problem. A large category is insufficient power.

With a baseline conversion rate of 3%, to detect a 0.5% relative lift—i.e., from 3% to 3.015%—at two-tailed 5% and 80% power, each group needs roughly 16 × 0.03 × 0.97 divided by 0.00015 squared, which works out to around 20 million UVs, or 40 million for two groups. For a product with a few hundred thousand DAU, that's several months.

nDCG is on a completely different cost scale: computed per query, a few thousand to a few tens of thousands of labeled queries are enough to distinguish a 0.5-point difference. So "offline moves first, online moves later" is structural—it doesn't mean the metric is distorted.

The criterion is to compute the minimum detectable effect first. If it's larger than the business lift you expect, the experiment design itself can't produce a conclusion. There are three options: run the experiment only on high-value populations or high-impact scenarios to raise the effect size; change the experiment unit from UV to session or query, trading some independence for variance; or accept deciding on a proxy metric, but write down the risks and rollback conditions clearly.

The last one is the most common in practice. Deciding on a proxy metric isn't the problem—the problem is that nobody writes down "roll back when the proxy metric rises to X and the business metric falls to Y."

## Reverse experiment: first prove the business metric is sensitive to this system

A low-cost action that's often skipped: deliberately break the ranking. Randomly shuffle the top ten, or fix the first position to a low-value item, run it on 1% to 5% of traffic, and see whether the business metric moves.

If the conversion rate doesn't move after shuffling, then either the tracking is broken or the ranking at this position genuinely has no effect on the business—for example, users don't look at this module at all. In neither case should you keep optimizing nDCG.

The boundary needs to be clear: it can prove sensitivity exists, not that the sensitivity is sufficient. Shuffling can detect a big drop, but not a 0.2% micro-lift. But at least it rules out the "observation is broken" category, and that category accounts for a non-trivial share of incidents. I lean toward putting the reverse experiment into the launch checklist—run it once before every major ranking change; a few hundred to a few thousand sessions is enough to see the direction.

## Three layers of metrics, each covering a segment

| Layer | Typical metrics | Variance | Purpose |
| --- | --- | --- | --- |
| Ranking quality | nDCG, MRR | Low | Model iteration, fast screening of options |
| User behavior | top3 CTR, pagination rate, query reformulation rate | Medium | Verify the change is perceived by users |
| Business outcome | Conversion rate, GMV per thousand impressions, refund rate | High | Final decision |

The three layers misalign in different ways, so the troubleshooting order differs too. If nDCG rises but the behavior layer doesn't move, the change probably lands where users don't look, or the gain function itself is wrong. If the behavior layer rises but the business layer doesn't move, the problem is in the gain definition: the ranking steers users to items that don't convert. If the business layer also doesn't move, go back to sample size and the reverse experiment first.

```mermaid
flowchart TD
    A[nDCG 涨业务没动] --> B{候选集或标注集变了吗}
    B -->|变了| B1[重算离线基线]
    B -->|没变| C{增量主要来自哪层流量}
    C -->|长尾为主| C1[接受离线线上脱节]
    C -->|头部为主| D{业务指标 MDE 够小吗}
    D -->|不够| D1[加样本或换实验单位]
    D -->|够| E[跑反向实验]
    E --> E1{业务指标大跌吗}
    E1 -->|不动| E2[先修观测和埋点]
    E1 -->|大跌| E3[指标口径错位 重定义增益]
```

Next time an offline metric rises but the business doesn't move, ask three questions in order: did the candidate set and the labeled set change; which layer of traffic does the increment come from; do the business metric's MDE and the expected effect size line up. If all three pass and it still doesn't move, then suspect the metric itself. Don't reverse this order, because the most expensive mistake is changing the metric first, rolling back a ranking change that was actually correct, and then spending six months rebuilding the same thing.
