The interview problem
A retrieval service's new ranker has higher aggregate task success than the old ranker. Yet it performs worse for both simple and difficult queries. Explain how both statements can be true, calculate a fair population comparison, and specify what evidence would justify shipping.
Original fundamentals practice, not a reported company interview. Counts and operational scenarios are hypothetical. Primary technical source retrieved September 27, 2026.
1. Specify what the metric counts
Count one eligible query task once, with a fixed success definition and observation window. For this exercise, simple versus difficult is a task property recorded before ranker assignment. It is not a category inferred from whether the new ranker succeeded. Assume complete labels for the displayed tasks. Failed, timed-out and abandoned eligible tasks must not disappear from the denominator.
There are three separate questions: which historical traffic stream had greater observed success, which ranker performs better on a shared target mix, and what would happen if all eligible production traffic received the new ranker. A dashboard can answer the first while leaving the other two unresolved.
2. Work through a reversal
| Task class | Old successes / tasks | Old rate | New successes / tasks | New rate |
|---|---|---|---|---|
| Simple | 95 / 100 | 95% | 810 / 900 | 90% |
| Difficult | 540 / 900 | 60% | 50 / 100 | 50% |
| All tasks | 635 / 1,000 | 63.5% | 860 / 1,000 | 86% |
The new ranker loses 5 percentage points on simple tasks and 10 points on difficult tasks. Its historical aggregate nevertheless wins by 22.5 points. It received 90% simple tasks; the old ranker received only 10%. The two overall rates average different populations. No row of this table contradicts another.
Write the old rate as 0.10 × 0.95 + 0.90 × 0.60 = 0.635 and the new rate as 0.90 × 0.90 + 0.10 × 0.50 = 0.86. Averaging the two class percentages without regard to task counts would answer a different question from either observed aggregate.
3. Compare on one explicit target mix
Suppose the intended deployment population contains 40% simple and 60% difficult tasks. Standardized old success is 0.40 × 0.95 + 0.60 × 0.60 = 74%. Standardized new success is 0.40 × 0.90 + 0.60 × 0.50 = 66%. The new ranker loses 8 percentage points for that mix. On 10,000 target tasks, these plug-in rates predict 7,400 versus 6,600 successes, a difference of 800. These are scenario estimates, not guaranteed production outcomes.
More generally, if w is the shared simple-task fraction, new minus old success equals w(0.90 − 0.95) + (1 − w)(0.50 − 0.60) = −0.10 + 0.05w. For every w between zero and one, the difference is negative. With common nonnegative weights, a strict loss in every included group cannot become an aggregate win. The reversal depended on unequal weights.
The pooled sample happens to contain equal numbers of simple and difficult tasks. Using that 50/50 target gives 77.5% old and 70% new. It is a valid descriptive standardization, but the pooled mix is not automatically the future customer mix. Choose and version weights according to the decision being made.
4. Separate composition from within-class change
A useful accounting decomposition holds the old class rates fixed while moving from old traffic weights to new traffic weights. At the new 90/10 mix, the old ranker would have a standardized rate of 0.90 × 0.95 + 0.10 × 0.60 = 91.5%. Relative to the original 63.5%, the composition term is +28 points. Changing to the new class rates at that same mix contributes 86% − 91.5% = −5.5 points. Together, +28 − 5.5 = +22.5 points, exactly the observed aggregate change.
This is an arithmetic decomposition. Calling the 28 points “caused by traffic” requires further assumptions. If instead the rates change first at the old mix, the within-class term is −9.5 points and the remaining composition term is +32 points. Both sum to +22.5. Report the reference convention; do not present one decomposition as a unique causal allocation.
5. Decide whether adjustment answers the causal question
The arithmetic alone cannot tell us which comparison identifies an intervention's effect. Conditioning on a common cause can remove confounding; conditioning on an intermediate outcome can remove part of the effect of interest; conditioning on a common consequence can introduce selection bias. State the causal story before choosing adjustment variables.
In this retrieval scenario, suppose an existing router sends difficult tasks preferentially to the old ranker, and difficulty also affects success. Difficulty is then a plausible adjustment variable. But simple/difficult labels may be too coarse: language, customer tier or task novelty can still differ inside each class. Standardizing these two observed rates alone does not prove a causal effect.
Alternatively, suppose “difficult” means the user clicked a retry button after seeing the ranker's first answer. Ranker quality affects this classification. Adjusting for retries now compares selected post-assignment groups and does not estimate the total effect of assigning the ranker. Preserve the original eligible population for that total-effect question.
For a causal interpretation of the standardized estimate, justify consistency of the ranker intervention, sufficient control of confounding, positive probability of each ranker within target groups, absence of relevant interference between assigned units, and transportability of the relevant conditional outcomes to the target population. A group with no old-ranker examples cannot be repaired by a weighted average without unsupported extrapolation.
6. Build an evaluation that survives the dashboard
Use a concurrent randomized comparison when feasible, with a stable assignment unit and intention-to-treat denominators. Stratifying assignment by known pre-assignment difficulty can improve balance. User-level randomization may be appropriate when repeated tasks share context; uncertainty must then account for correlated tasks. Randomization balances composition in expectation, not necessarily exactly in every finite sample.
For offline evaluation, run both rankers on the same frozen representative tasks when the outcome can be judged meaningfully offline. Preserve pairing when estimating uncertainty. Offline judge success is not automatically the same outcome as real user task completion. Report both historical observed rates and a predeclared common-mix metric, along with counts, missing labels and important slices.
Do not ship on the 86% headline. In this example the fixed-mix estimate regresses, so investigate assignment and task mix, check evaluation validity, and obtain a credible comparison before rollout. A real decision also includes uncertainty, latency, cost and minimum acceptable performance for critical groups. For fixed target weights and independent tasks in disjoint ranker/class samples, a plug-in variance for the standardized difference is the sum across classes of w²[p_new(1 − p_new)/n_new + p_old(1 − p_old)/n_old]. Here it is 0.001088, giving standard error about 3.30 percentage points and an approximate 95% interval of −14.47 to −1.53 points around the −8-point difference. This illustrative normal interval treats the target weights as known; paired outcomes, user clustering or estimated weights require a different variance calculation. It quantifies sampling error under those assumptions, not confounding or transport bias. Slice fishing after looking at results can produce misleading explanations; use exploratory slices to formulate tests, not to rewrite a failed primary endpoint.
7. Failure modes and trade-offs
- Moving category definitions: the same query changes class across versions. Freeze or independently label the class definition and audit disagreement.
- Survivor-only denominators: one system times out more often and only completed responses receive labels. Count eligible assignments and expose unresolved outcomes.
- Stale target weights: standardization becomes detached from actual demand. Keep a stable benchmark for comparability and a separately versioned forecast-weighted metric for planning.
- Sparse groups: splitting into many strata produces unstable rates. Report uncertainty and collect data; merging groups trades precision for loss of detail.
- Unsupported causal language: a mathematically correct reweighting is called a treatment effect. Identify the assignment mechanism and remaining confounders explicitly.
8. Follow-ups and self-review
Follow-ups: Can a shared target mix make this new ranker win? No: −0.10 + 0.05w stays negative on [0,1]. What if it improves one group and harms another? The target weights can then determine the sign. Is a larger aggregate dataset enough to resolve the issue? No: greater precision does not fix a mismatched estimand. Does every reversal prove confounding? No: the causal interpretation depends on how variables were generated.
Score 0–2 each for correct numerator/denominator arithmetic, explaining unequal weights, selecting an explicit target population, distinguishing adjustment from causal identification, and proposing an evaluation with valid uncertainty and denominators. A strong answer can reproduce the reversal and explain which business question each number answers.
Sources and next steps
- Judea Pearl: Understanding Simpson’s Paradox — primary discussion dated April 18, 2011, distinguishing arithmetic reversals from their causal interpretation.
The retrieval counts, target populations, decomposition and operational evaluation are original exercises. Continue with causal experiments and selection bias.
Continue your preparation
Choose a connected learning path or browse more ML fundamentals questions. Read our editorial method and attribution policy.