Testing a New Home-Feed Ranker: Experiment Design and Causal Methods
Statistics & ExperimentsModel answerLast updated
Design an experiment for a new content-ranking model aimed at raising time spent: hypotheses, metrics, sample size, health checks, a mid-test dip, and a non-randomized geographic rollout.
Scenario
A consumer social app has built a new ranking model for its home feed. The team's goal is to increase the average number of minutes users spend actively using the app each day. You are asked to plan and interpret the evaluation.
Questions
a) Hypotheses and metrics. Write the null and alternative hypotheses for the experiment. Choose a primary metric and a set of guardrail metrics, and explain what the randomization unit should be.
b) Effect size and sample size. Decide how to set the minimum detectable effect (MDE). Then compute the number of users needed per arm for 95% power with a two-sided significance level of 0.05. State and justify any assumptions you make about the baseline and variance.
c) Monitoring a live test. Once the test is running, a dashboard plots average active minutes per day for each arm. What would you check to be confident the experiment is healthy? If you see a sudden dip in the middle of the test, how would you interpret it and what would you do?
d) No randomization. Suppose the new ranker can only be rolled out by geography (for example, some countries get it first) and users cannot be randomly assigned. How would you estimate its causal effect, and what assumptions and checks would you rely on?
Answer as you would in a live discussion: be structured, give concrete numbers where useful, and call out trade-offs.
Hints
Hint 1
Match the randomization unit to the analysis unit, and pick the MDE from the smallest lift the business would actually care about, not from what is statistically convenient.
Hint 2
For sample size, the per-arm formula is n = 2(z_{1-α/2} + z_{1-β})² σ² / δ². Engagement time is right-skewed, so think about a realistic σ, and about variance-reduction tools such as using pre-experiment behavior.
Hint 3
For the dip, first ask whether it appears in both arms or only one, then segment by platform, region and app version. For the geographic rollout, think about comparing changes over time between treated and untreated regions, and how you would defend the parallel-trends assumption.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Overview
A strong answer covers four things: a testable hypothesis with sensible metrics, a defensible power calculation, a habit of checking data quality before reading results, and a fallback plan when randomization is impossible.
a) Hypotheses and metrics
Randomization unit: the user, keyed on a stable user ID so assignment persists across devices and sessions. Randomizing by session or pageview would expose the same person to both rankers and contaminate the comparison.
Hypotheses. Let μ_T and μ_C be mean daily active minutes per user in treatment and control.
- H₀: μ_T − μ_C = 0
- H₁: μ_T − μ_C ≠ 0
Use a two-sided test. A ranking change can reduce engagement, and we want to detect harm as well as improvement.
Primary metric: average daily active minutes per user over the test window. Compute it per user first and then average across users, so the analysis unit matches the randomization unit. Cap extreme values (for example at the 99.9th percentile) so bots and a few heavy users do not dominate the variance.
Secondary metrics: sessions per user, engagement actions per impression, and day-7 retention.
Guardrails (must not worsen beyond a pre-agreed threshold):
- User health: retention or DAU, hides, reports, "show less" actions. These catch a ranker that boosts time spent but degrades quality.
- Ecosystem: creator impressions and content diversity, plus ad revenue per user.
- System: p95 feed latency, crash and error rates.
Pre-register the metrics and the ship/no-ship rule before launch to avoid metric fishing.
b) MDE and sample size
Set the MDE from practical significance. Ask what lift would justify the compute and maintenance cost of the new ranker. Suppose the answer is 2%.
Assumptions:
- Baseline mean: 30 min/day
- Standard deviation: σ ≈ 40 min (right-skewed engagement)
- Absolute MDE: δ = 0.02 × 30 = 0.6 min
Formula (equal allocation):
$$ n_{\text{per arm}} = \frac{2,(z_{1-\alpha/2} + z_{1-\beta})^2,\sigma^2}{\delta^2} $$
With z = 1.96 for α/2 = 0.025 and z = 1.645 for 95% power, the sum is 3.605 and its square about 13.0:
n ≈ 2 × 13.0 × 1600 / 0.36 ≈ 115,500 users per arm (about 231,000 total).
Practical points:
- Duration: run whole weeks to cover day-of-week effects, and at least two weeks so novelty and primacy effects settle. For a large app, the minimum duration, not traffic, is usually the binding constraint.
- Variance reduction (CUPED): adjust using each user's pre-period minutes. With a pre/post correlation of about 0.7, variance falls by roughly 1 − ρ² ≈ 51%, nearly halving the required sample or allowing a smaller MDE.
- Ratio metrics such as minutes per session need the delta method, since the denominator is random.
- Multiple primary metrics: correct α (Bonferroni or Benjamini–Hochberg).
- Interference: users see each other's content and creators react to distribution, so treatment can leak into control. If this matters, consider cluster-based randomization.
c) Experiment health and a mid-test dip
Checks before trusting any lift:
- Sample ratio mismatch (SRM). Run a chi-square test of observed versus intended allocation. A p-value below about 0.001 means something is wrong with assignment, filtering or logging, and the results should not be trusted.
- Pre-period balance. Plot both arms for 1–2 weeks before launch, or run an A/A test. Lines should overlap; a gap suggests failed randomization or carry-over from an earlier experiment.
- No data loss. Compare event volumes, missing rates and logging delays by arm and by platform. If treatment crashes more, its unhappiest users disappear from the data and bias the result upward.
- Exposure correctness. Verify treated users actually got the new ranker and control users did not.
- Effect over time. Plot the daily treatment-minus-control difference with confidence intervals, not just the raw lines, to spot novelty decay.
Interpreting a sudden dip. First ask which arms are affected.
- Both arms dip, gap stable: probably external (holiday, outage, news event, logging change). Randomization keeps the comparison valid. Annotate it and run a sensitivity analysis excluding those days.
- Only treatment dips: suspect a model or feature-pipeline failure (such as stale embeddings), a latency regression, a crash on one platform or app version, broken logging in the treatment path, a clash with another experiment, or genuine novelty wear-off. Segment by platform, country, app version and new versus tenured users, then check latency and error guardrails and deployment logs for that date.
- Only control dips: suspect a bug or conflicting launch in control, which would inflate the apparent lift.
Do not stop or declare a result because of a single-day movement. Repeated peeking inflates false positives; if early stopping is required, use sequential methods such as alpha-spending or mSPRT. A confirmed data-quality bug, however, justifies pausing, fixing and restarting.
d) Causal inference with a geographic rollout
Regions differ in baseline engagement, seasonality and demographics, so a simple treated-versus-untreated comparison is confounded.
Difference-in-differences (DiD):
$$ \hat{\tau} = (\bar{Y}{T,\text{post}} - \bar{Y}{T,\text{pre}}) - (\bar{Y}{C,\text{post}} - \bar{Y}{C,\text{pre}}) $$
As a regression with geography and time fixed effects:
$$ Y_{gt} = \alpha_g + \lambda_t + \tau \cdot \text{Treated}_g \times \text{Post}t + \varepsilon{gt} $$
Key assumption: parallel trends. Absent the change, treated and control geographies would have moved together. Support it with:
- An event-study plot showing flat pre-period coefficients.
- Placebo tests, for example assigning a fake launch date in the pre-period and confirming no effect.
- Choosing comparison geographies that resemble the treated ones in size, platform mix and seasonality.
Alternatives and robustness:
- Synthetic control: build a weighted blend of untreated geographies that tracks the treated geography's pre-period path. This works well with only a few treated regions.
- Staggered rollout: use modern estimators (such as Callaway–Sant'Anna) rather than plain two-way fixed effects, which can be biased under heterogeneous effects.
- Inference: with few geographies, cluster standard errors at the geography level or use permutation or randomization inference.
- Spillovers: users near borders or traveling can contaminate control, so consider excluding border areas.
- Concurrent events: local holidays, marketing pushes or regulation changes in a treated region can masquerade as effects.
Better design if possible: randomize which geographies get the treatment (a geo-experiment with matched pairs), which restores much of the credibility of an A/B test.
Common mistakes
- Choosing the MDE to fit the available traffic rather than business value.
- Randomizing by session while analyzing by user.
- Ignoring SRM and reading the lift anyway.
- Peeking daily and stopping at the first significant result.
- Reporting only the primary metric and ignoring guardrails.
- Applying DiD without ever testing parallel trends.