Rolling Out a Homepage Ranker Upgrade in a Delivery Marketplace
Statistics & ExperimentsModel answerLast updated
Plan a safe, statistically sound experiment and rollout for a new homepage store ranker in a two-sided delivery marketplace, covering metrics, interference, infrastructure, power and launch rules.
A delivery app orders the stores on its homepage with a ranking model, currently V1.1. A candidate replacement, V2.0, uses extra features (possibly some real-time ones) and may need treatment users to load a different feature bundle than control users.
Stores are only eligible if they are open now and within delivery range of the user, so the candidate pool changes with time and location. Homepage retrieval has a tight latency budget, and traffic is large but finite.
Because the ranking influences which merchants get orders, how busy couriers are and how long deliveries take, one user's arm can affect another user's outcome. A plain click-based A/B test is not enough.
Design one coherent experimentation and rollout plan that covers:
- Metrics: the primary success metric and the guardrails, and why.
- Randomization unit: user, session, geo, or switchback; your default and when you would change it.
- Serving infrastructure: how control and treatment fetch different model versions and feature sets safely and reproducibly.
- Logging: what must be recorded so the analysis is correct and reproducible.
- Validity threats: sample ratio mismatch, delayed conversions, feature missingness, novelty effects, selection bias, spillover.
- Power and variance: MDE for a binary metric, the effect of clustering, CUPED and stratification, with a worked number.
- Ramp, rollback and launch: the staged sequence, explicit rollback triggers, and a multi-factor launch decision.
State any clarifying questions you would ask first (true-north metric, practically significant lift, expected interference, feature SLAs, baseline conversion and traffic, existing experimentation tooling) and the assumptions you make.
Hints
Hint 1
Pick a primary metric that reflects business value per exposure (for example orders or contribution margin per homepage session) and treat latency, ETA, cancellations and merchant concentration as guardrails that can veto a launch.
Hint 2
Ask whether V2.0 merely reorders the same eligible stores or changes which stores receive demand. The answer decides between user-level randomization and zone or switchback designs, and clustering shrinks your effective sample size.
Hint 3
Make the assignment deterministic and log arm, model version and feature-config version on every request; add shadow mode and safe defaults with missingness flags before any live traffic.
Hint 4
Use the rough formula n per arm ≈ 16·p(1−p)/δ² for power, divide by the design effect when clustering, and use pre-period covariates (CUPED) to cut variance.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
Framing and assumptions
I would first confirm the north star (short-term orders, contribution margin, or retention), the smallest lift worth the added infra cost, how much V2.0 changes which stores get demand, current feature timeout/missingness rates, baseline conversion and traffic, and which bucketing/config/switchback tooling already exists. Below I assume a user-level default, with a baseline session-to-order conversion of 10%.
1. Metrics
Primary: orders (or contribution margin) per eligible homepage session. CTR is a poor primary metric because a ranker can raise clicks by surfacing flashy or unavailable-feeling stores without producing more fulfilled orders. It also ignores cost: a higher order count with long ETAs or heavy discounts is not a win. Contribution margin per session is best if it can be measured reliably, otherwise orders per session.
Guardrails (non-negotiable):
- Serving health: p95/p99 latency, timeout and error rate, fallback rate.
- Marketplace health: delivery ETA and lateness, cancellation and refund rate, courier utilization.
- Merchant health: exposure concentration (for example Gini or top-store share), share of orders going to small or new merchants.
- Experience: reorder rate and short-term retention.
Maximizing immediate orders can quietly overload popular stores, stretch ETAs and starve long-tail supply, so guardrails can veto a launch even when the primary metric is up.
Diagnostics (interpret, not decide): CTR, add-to-cart, basket size/AOV, new-store discovery, position-wise engagement.
2. Unit of randomization
- User-level (default): best power, stable experience per person. Valid when V2.0 mostly re-ranks the same eligible stores and spillover is small.
- Session-level: more units but contaminates the user's experience across variants, so learning and carryover blur the effect. Avoid it.
- Geo/zone clustering: contains interference, but there are few independent units and markets are heterogeneous.
- Geo-time switchback: alternate arms over time windows within a zone; good for marketplace effects, needs enough windows, washout between them and care with day-of-week and event effects.
Decision rule: start with user-level. Switch to zone-clustered or switchback if shadow analysis or a pilot shows V2.0 shifts store-level demand enough to move ETAs, courier supply or merchant capacity. Under user-level interference, treated users drain shared supply from control users, so the estimated lift is biased (usually overstated). Also monitor marketplace-level outcomes per zone as a cross-check.
3. Serving infrastructure
- Deterministic bucketing: stable hash of (experiment ID, user ID) or (zone, time window); no per-request flapping.
- Experiment config service: maps arm to model version plus feature bundle (control: V1.1 / bundle A; treatment: V2.0 / bundle B). Nothing hard-coded in the app.
- Versioned feature registry: schema, type, freshness SLA, default value, owner and deprecation flags.
- Backward-compatible serving: on timeout or missing value, use a safe default and set a missingness indicator; never fail the request. Fall back to V1.1 if V2.0 breaches its budget.
- Shadow mode: score V2.0 in parallel without showing it, comparing latency, score distribution, missingness and calibration to V1.1.
4. Logging
- Assignment: experiment ID, arm, unit ID (user/session/zone-window), timestamp and timezone, model version, feature-config version.
- Request level: candidate set before ranking, ranked list shown, per-candidate scores where feasible, feature missingness and freshness flags, per-component latency.
- Marketplace diagnostics: eligible pool size, fallback-triggered flag, stale-feature usage, store-level exposure.
- Outcomes: click, add-to-cart, order, basket size, cancellation, ETA, each with an attribution window.
Logging the pre-rank candidate set is what lets you separate model quality from eligibility changes.
5. Validity threats
- SRM: compare observed split with the planned one (chi-square test). A mismatch points to assignment or logging bugs, treatment-induced crashes or geo routing. Do not trust any lift until it is explained.
- Delayed conversions: fix an attribution window (for example same session plus 24h) and wait for it before reading results; early reads favor click-heavy variants.
- Feature missingness: slice results by missing versus complete features so infra flakiness is not mistaken for model quality, and fix the pipeline before judging V2.0.
- Novelty effects: plot the effect by days since exposure; decay suggests a transient bump. Run long enough to cover weekly cycles.
- Selection bias: analyze by assigned arm (intent-to-treat), not by who received V2.0 scores; log eligible-pool composition so shifts in available stores are not read as lift.
- Spillover: use zone clustering or switchback if suspected, and track store-level and zone-level outcomes.
6. Power, MDE and variance reduction
For a binary metric, n per arm ≈ 16·p(1−p)/δ² (about 80% power, α = 0.05). With p = 0.10 and δ = 0.005 (a 5% relative lift):
n ≈ 16 × 0.09 / 0.000025 ≈ 57,600 sessions per arm (counting users instead of sessions requires accounting for repeated sessions).
Clustering: the design effect is 1 + (m−1)·ICC, so effective n = n / (1 + (m−1)·ICC). With m = 1,000 sessions per cluster and ICC = 0.01, the design effect is about 11, so you need roughly 11 times the sample or duration. This is why geo tests are costly.
CUPED: Y_adj = Y − θ(X − X̄), where θ = Cov(X, Y)/Var(X) and X is a pre-period covariate (prior 7-day orders, sessions, spend). Variance falls by a factor of (1 − ρ²); with ρ = 0.5 that is a 25% reduction, so a smaller MDE or a shorter test.
Stratification: by new versus returning users, dense versus sparse markets, supply conditions and platform. Randomize within strata or post-stratify; if the traffic mix differs across arms, an aggregate result can reverse within segments (Simpson's paradox).
7. Ramp, rollback and launch
Ramp:
- Offline replay with point-in-time features (NDCG, log loss, calibration); avoid leakage.
- Shadow mode for latency, missingness and score sanity.
- Canary ramp 1% → 5% → 25% → 50%, holding at each step to check guardrails.
- Full experiment across complete weekly cycles.
Automatic rollback triggers: p99 latency or timeout regression, ETA or cancellation degradation beyond a threshold, elevated missingness, SRM or logging corruption, severe merchant-exposure skew.
Launch decision (all must hold):
- Primary metric significant and above the practically significant threshold.
- Guardrails intact (not just non-significant).
- Effect consistent across key slices and over time (no novelty decay).
- Gain justifies infra cost, latency and operational fragility.
- Marketplace-level or holdout check shows no hidden spillover harm.
After launch, keep a small long-term holdout to measure retention and supply effects.
Common mistakes
- Using CTR as the decision metric.
- Ignoring interference and reporting an inflated lift.
- Reading results before delayed conversions land.
- Treating missing features as a model problem.
- Skipping shadow mode.
- Launching on "p < 0.05" alone.