Design an Online Experiment for a Ranking Model Upgrade
Machine LearningModel answerLast updated
Plan and analyze an A/B test for a new learning-to-rank model replacing a heuristic ranker in a content feed, handling interference, novelty effects, and metric trade-offs.
Scenario
You work on the recommendations team at a large content platform. The feed currently ranks items with a hand-tuned heuristic scorer. Your team has trained a new learning-to-rank (LTR) model and wants to ship it to 100% of traffic. Before doing so, you must run a rigorous online experiment.
The platform serves 50 million daily active users (DAU). Each user sees a ranked feed of ~20 items per session. The primary business goal is long-term user retention, but the team tracks several short-term proxy metrics: click-through rate (CTR), session length, next-day return rate, and a "satisfaction" signal derived from explicit thumbs-up/down feedback (sparse, ~2% of sessions).
You are expected to:
- Frame the experiment — state hypotheses, choose the randomization unit, and justify it.
- Select and prioritize metrics — distinguish guardrail, primary, and secondary metrics and explain why.
- Size the experiment — walk through the power calculation with reasonable assumptions.
- Identify and mitigate threats — novelty effect, position bias, cannibalization, network effects, long-term vs. short-term divergence.
- Analyze and make a decision — describe the statistical approach, how you handle multiple comparisons, and your ship/no-ship criteria.
- Discuss trade-offs — what a naive approach gets wrong, and what you would do differently if retention and engagement diverge.
Hints
Hint 1
Start by asking: what can the ranking model affect that the heuristic cannot, and does your metric capture that? This determines which metric is truly primary vs. a proxy.
Hint 2
For the randomization unit, think about what happens if you randomize at the request level instead of the user level — would a single user see both rankers in the same session?
Hint 3
The novelty effect and the long-term retention goal pull in opposite directions on experiment duration — make sure you can articulate the tension and how you resolve it.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
1. Framing the Experiment
Null hypothesis (H₀): The LTR model produces no change in next-day return rate relative to the heuristic ranker.
Alternative hypothesis (H₁): The LTR model increases next-day return rate (one-sided, because we expect improvement and a decrease would be a no-ship regardless).
Randomization unit: user-level (user ID), not request- or session-level.
Ranking decisions within a single session are correlated — if you randomize at the request level, the same user could see both rankers back-to-back, contaminating their behavior and inflating variance. User-level randomization also lets you measure session-spanning metrics like next-day return rate cleanly.
Split: 50/50 control (heuristic) vs. treatment (LTR). If risk tolerance is low, start at 10/90 (treatment/control) and ramp.
2. Metric Hierarchy
| Tier | Metric | Why |
|---|---|---|
| Guardrail | p95 feed load latency, app crash rate, explicit negative feedback rate | Must not degrade; automatic rollback trigger |
| Primary | Next-day return rate (D1 retention) | Closest proxy for long-term retention; harder to game |
| Secondary | Session length (minutes), CTR on ranked items | Faster signals; directional confirmation |
| Informational | Thumbs-up rate, diversity of consumed content | Sparse or not yet validated as causal for retention |
Why not CTR as primary? CTR is easy to inflate by surfacing clickbait. A ranking model optimized for CTR can hurt long-term retention — a well-documented failure mode. Next-day return rate is slower but better aligned with business value.
3. Experiment Sizing
Assumptions:
- Baseline D1 retention: 40%
- Minimum detectable effect (MDE): +0.5 percentage points (absolute) — a 1.25% relative lift, conservative for a major model change
- Significance level: α = 0.05 (one-sided)
- Power: 1 − β = 0.80
For a two-proportion z-test, the required sample size per arm is:
n = (z_α + z_β)² × [p(1−p) + p'(1−p')] / (p' − p)²
With p = 0.40, p' = 0.405, z_α = 1.645 (one-sided), z_β = 0.842:
numerator ≈ (2.487)² × 2 × 0.40 × 0.60 ≈ 6.19 × 0.48 ≈ 2.97
denominator = (0.005)² = 0.000025
n ≈ 2.97 / 0.000025 ≈ 118,800 users per arm
At 50M DAU with a 50/50 split → ~25M users per arm. We reach 118,800 in under one hour. This means the experiment is statistically powered very quickly, but:
- Minimum duration should be 2–4 weeks to capture day-of-week effects, novelty decay, and a meaningful retention signal (D1 return measured daily, but trends need time to stabilize).
- Do not stop early just because p < 0.05 appears — this inflates false positives (peeking problem). Use a pre-registered analysis date or a sequential testing correction (e.g., alpha spending with O'Brien-Fleming boundaries).
4. Threats and Mitigations
Novelty effect: Users may engage more with the new ranker simply because it feels different. Mitigation: plot the treatment effect over time; if CTR spikes in week 1 but returns to baseline by week 3, the true effect is closer to the steady-state value. Do not make a ship decision before novelty decays.
Position bias / ranking feedback loop: If the LTR model was trained on clicks from data generated by the heuristic ranker, it inherits position bias. Items shown high in the old feed got more clicks, so the training signal is biased. Mitigation: validate that the LTR model was trained with inverse-propensity-score weighting or a de-biased loss; otherwise, offline gains may not transfer online.
Survivorship / cannibalization: If the LTR model surfaces the same popular items to everyone, diversity may collapse. Monitor the Gini coefficient or intra-list diversity as an informational metric.
Network / social spillover: On a platform where users interact (comments, shares), treating users independently assumes SUTVA (stable unit treatment value assumption). If spillover is plausible, consider cluster-based randomization (e.g., by geographic region or social graph component). This reduces effective sample size, so re-run the power calculation.
Long-term vs. short-term divergence: D1 retention may rise while D7 or D30 retention could diverge. Plan a holdout: keep ~1–2% of users in a long-term holdback and measure 30-day retention 6 weeks after full launch to validate the proxy metric relationship.
5. Analysis and Decision
Multiple comparisons: With several secondary metrics tested simultaneously, apply Benjamini-Hochberg FDR correction rather than Bonferroni (less conservative). The primary metric (D1 retention) is pre-registered and tested at α = 0.05 uncorrected; secondary metrics are tested at FDR = 0.10.
Decision criteria (all must hold to ship):
- D1 retention: statistically significant positive lift (p < 0.05, one-sided) with a practically meaningful effect size (≥ 0.3 pp absolute).
- Guardrail metrics: no statistically significant degradation in latency, crash rate, or negative feedback.
- No strong evidence of novelty-driven inflation (effect stable in week 3 vs. week 1).
If retention and engagement diverge (e.g., session length increases but D1 retention is flat): do not ship. This pattern often means the model is surfacing engaging but non-retentive content (rabbit-hole effect). Re-examine the training objective and consider multi-objective optimization incorporating a retention signal.
6. Common Mistakes to Avoid
- Using CTR as the primary metric without validating its correlation with retention — leads to optimizing for short-term engagement at the cost of user satisfaction.
- Stopping the experiment early when significance is first reached — violates the fixed-horizon test assumption and inflates Type I error.
- Ignoring position bias in offline evaluation — a model that looks great in offline NDCG may underperform online because it was trained on biased logged data.
- Forgetting the guardrail on latency — ranking model inference adds p99 latency; a 200ms increase in feed load time can itself reduce retention, confounding results.
- No long-term holdback — shipping and then discovering 30-day retention degraded months later with no clean control group is a painful and avoidable mistake.