Feed Personalization Algorithm A/B Testing Framework
Statistics & ExperimentsModel answerLast updated
Design an end-to-end A/B test framework to evaluate a new feed recommendation algorithm, addressing metrics, network spillover, novelty decay, and statistical validation.
You are an experiment strategist for a major content sharing platform with approximately 100 million daily active users (DAU). The ML personalization team has developed a new deep recommendation model for the primary content stream aimed at increasing overall user engagement.
However, content updates can alter user interaction patterns, affect ad delivery, and introduce spillover across connected users. You are asked to formulate an end-to-end experimental strategy to evaluate whether this recommendation engine should be rolled out globally.
Requirements
- Metric Framework: Define primary evaluation metrics, secondary engagement signals, and essential guardrail metrics. Address how to evaluate complex non-i.i.d. ratio metrics statistically.
- Experimental Design & Interference: Select the unit of randomization. Formulate a strategy to mitigate and measure network spillover effects (interference across users) and marketplace cannibalization. Include sample size and power estimations.
- Temporal Effects & Long-Term Value: Outline a methodology to isolate short-term novelty or friction effects from true steady-state engagement. Explain how to bridge short-term experimental results with long-term user retention.
- Validation & Decision Rules: Define a pre-analysis verification process (e.g., integrity checks) and concrete decision criteria for the final global rollout recommendation.
Hints
Hint 1
Consider how interactions between users (e.g., shares, comments) violate the stable unit treatment value assumption (SUTVA).
Hint 2
Think about variance reduction techniques like CUPED to maintain sensitivity without needing massive sample allocations.
Hint 3
For non-i.i.d. ratio metrics where the randomization unit differs from the evaluation unit, recall how the delta method or bootstrapping can be applied for standard error estimation.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
1. Metric Framework
To properly evaluate a new personalization model, we must establish a clear hierarchy of metrics: Primary, Secondary, Guardrail, and Diagnostic metrics.
Primary Metrics
- Active Time Spent per User per Day: Calculated over a steady-state evaluation window. Time spent directly reflects user value, provided quality standards are met.
- 7-Day Active Days (L7): The number of days out of 7 a user visits the platform. Serves as a medium-term retention signal.
Secondary Metrics
- Interaction Rate: Meaningful social interactions (comments, shares, messages) per user.
- Session Frequency: Total sessions per user per day.
- Ad Revenue per DAU (ARPDAU): Total ad revenue generated divided by active users, ensuring the model does not disproportionately suppress sponsored items.
Guardrails (Non-Inferiority Testing)
Guardrails must pass pre-specified non-inferiority thresholds before launch consideration:
- User Integrity & Feedback: Negative feedback rate (hides, reports, block actions) per 1k impressions. Non-inferiority bound: $+2%$ relative increase max.
- Creator Ecosystem Fairness: Gini coefficient of impression distribution among creators and reach of long-tail creators. We want to avoid radical distribution concentration.
- System Performance: P99 feed generation latency, app crash rate, and ranking service timeout rates.
- Monetization Floor: ARPDAU non-inferiority margin bound set to $-0.5%$.
Statistical Handling of Ratio Metrics
Many engagement indicators are ratios where the denominator is not fixed per user (e.g., Click-Through Rate = Clicks / Impressions). Because impressions cluster within users, observations are non-i.i.d., leading to underestimation of standard errors if treated as simple independent samples.
To handle this variance correctly:
- Delta Method: We apply a Taylor expansion to compute the variance of the ratio of two random variables $\bar{X}$ and $\bar{Y}$: $$\text{Var}\left(\frac{\bar{X}}{\bar{Y}}\right) \approx \frac{1}{\mu_Y^2} \text{Var}(\bar{X}) - \frac{2\mu_X}{\mu_Y^3} \text{Cov}(\bar{X}, \bar{Y}) + \frac{\mu_X^2}{\mu_Y^4} \text{Var}(\bar{Y})$$
- User-Level Aggregation: Alternatively, aggregate data to the user level first by defining each user's metric as $R_i = \sum \text{Clicks}_i / \sum \text{Impressions}_i$ (or using user-weighted ratios), turning the dataset back into i.i.d. observations at the randomization unit level.
2. Experimental Design & Network Interference
Unit of Randomization & SUTVA Violations
The standard approach is user-level hashing (e.g., md5(user_id + seed) % 100). However, content platforms violate the Stable Unit Treatment Value Assumption (SUTVA) through two primary mechanisms:
- Direct Network Interference: Treatment users receive improved feed recommendations, engaging and resharing more content. Control users who follow these treatment users consequently see altered feeds, causing spillover contamination.
- Marketplace & Creator Competition: Treatment and Control users compete for the same inventory in the ad auction and draw from the same creator content pool.
Direct SUTVA violations typically cause control group contamination, usually dampening the observed treatment effect toward zero.
+-------------------------------------------------------------------+
| Network Interference |
+-------------------------------------------------------------------+
| |
| [ Treatment User ] --- Reshares Content ---> [ Control User ] |
| | | |
| +-------------------> <---------------------+ |
| | |
| Contaminated Control |
| (SUTVA Assumption Fails) |
| |
+-------------------------------------------------------------------+
Mitigation Strategies
- Graph-Cluster Randomization:
- Partition the platform's social graph into densely connected sub-graphs (clusters) using algorithms like Louvain or Balanced Label Propagation.
- Randomize entire clusters into Treatment or Control.
- Analysis: Must use cluster-robust standard errors or random-effects models, adjusting for the design effect: $DE = 1 + (m - 1)\rho$, where $m$ is average cluster size and $\rho$ is intra-cluster correlation.
- Dual-Arm Isolation (Ego-Cluster / Network Measurement):
- Run a 3-arm experiment: Pure Control (User-level), Treatment (User-level), and Cluster-level Treatment.
- Comparing the user-level treatment against cluster-level treatment quantifies the direction and magnitude of spillover bias.
Power Estimation & Sample Allocation
Assume:
- Baseline metric: Time spent = 30 mins/day, Standard Deviation $\sigma = 45$ mins ($\text{CV} = \sigma / \mu = 1.5$).
- Parameters: $\alpha = 0.05$ (two-sided), Power ($1 - \beta$) = 0.80. Standard normal critical value sum $(z_{1-\alpha/2} + z_{1-\beta})^2 \approx 7.85$.
For a sample size of $N$ users per variant: $$\text{MDE} = \sqrt{\frac{2 \cdot 7.85 \cdot \sigma^2}{N \cdot \mu^2}} = \frac{3.96 \cdot \text{CV}}{\sqrt{N}}$$
Using standard user randomization with 5,000,000 users per arm (5% DAU per variant): $$\text{MDE} = \frac{3.96 \cdot 1.5}{\sqrt{5,000,000}} \approx 0.00265 \quad (\mathbf{0.27%\text{ relative lift}})$$
Variance Reduction via CUPED: Applying Controlled-experiments Using Pre-Experiment Data (CUPED) using 14 days of pre-experiment time spent as a covariate $\bar{X}{pre}$: $$\hat{Y}{CUPED} = Y - \theta (X_{pre} - \mathbb{E}[X_{pre}]), \quad \text{where } \theta = \frac{\text{Cov}(Y, X_{pre})}{\text{Var}(X_{pre})}$$ If $R^2 \approx 0.5$ between pre- and post-period metrics, total variance drops by $50%$ ($\sigma_{CUPED}^2 = \sigma^2(1 - R^2)$). This reduces the MDE to $\sim 0.19%$ relative, allowing us to detect smaller shifts without expanding variant sizes.
3. Temporal Effects & Long-Term Isolation
Novelty vs. Primacy Effects
- Novelty Effect: A temporary spike in engagement driven by user curiosity over UI/algorithmic shifts, decaying over time.
- Primacy Effect: A temporary drop in engagement due to user resistance to unfamiliar recommendation changes, recovering over time.
Metric Lift
^
| /\ <- Novelty Spike
| / \___________ <- True Steady-State Effect
| /
+------------------------> Time (Weeks)
| \ ___________ <- True Steady-State Effect
| \ /
| \/ <- Primacy Dip
Detection & Modeling
- Time-Series Lift Analysis: Plot daily treatment minus control delta $\Delta(t) = \bar{Y}_T(t) - \bar{Y}_C(t)$.
- Parametric Decay Curve Fitting: Model the daily lift using an exponential decay model: $$\Delta(t) = \Delta_{\infty} + \beta e^{-\gamma t}$$ Where $\Delta_{\infty}$ represents the projected asymptotic steady-state effect.
- Exposure-Cohort Profiling: Segment users by exposure tenure (e.g., Day 1 of exposure vs. Day 20 of exposure) independent of calendar date.
- New User Control: Evaluate a sub-cohort of users who registered after the experiment launch. Since new users have no baseline anchor, their response is free of novelty or primacy bias.
Connecting Short-Term Results to Long-Term Retention
Because 28-day or 90-day retention takes months to observe in standard experiments, we deploy two strategies:
- Surrogate Index: Build a machine learning model $\hat{R}_{90} = g(M_1, M_2, \dots, M_k)$ predicting 90-day retention from short-term surrogate metrics (e.g., L7 engagement, comment depth, diversity of consumed categories in Week 1).
- Long-Term Holdout Group: Reserve a small subset of users ($0.5%$) in the legacy system for $3\text{--}6$ months post-launch to validate that short-term projections accurately translate into long-term retention gains.
4. Pre-Analysis Validation & Decision Rules
Data Integrity & Validation Pipeline
Before evaluating top-line experimental metrics, the following checks must run automatically:
- Sample Ratio Mismatch (SRM) Test: Perform a goodness-of-fit Chi-Square test ($\chi^2$) comparing observed user counts per variant against expected allocation ratios ($50/50$). A $p\text{-value} < 0.001$ indicates allocation bias or logging drops, rendering the trial invalid.
- AA/Pre-Period Covariate Balance: Verify that treatment and control groups show zero statistically significant differences during the pre-experiment baseline period.
- Invariant Metric Integrity: Ensure metrics unaffected by the recommendation model (e.g., push notification dispatch volume, app start events prior to feed render) remain equal across arms.
Global Rollout Decision Matrix
+-------------------------------+
| Guardrails & Checks Passed? |
+---------------+---------------+
|
+--------+--------+
| |
Yes No
| |
+------v------+ +------v------+
| Primary | | REJECT / |
| Metric Lift | | BLOCK LAUNCH|
+------+------+ +-------------+
|
+-----------------------+-----------------------+
| |
Stat Sig (>0) Not Stat Sig / (<0)
| |
+------v------+ +------v------+
| Revenue | | REJECT / |
| Constraint? | | ITERATE MODEL|
+------+------+ +-------------+
|
+----+----+
| |
Pass Fail
| |
+---v---+ +---v---+
| LAUNCH| | TRADE-|
| GLOBAL| | OFF |
+-------+ +-------+
| Primary Metric (Time Spent) | Secondary (ARPDAU) | Guardrails (Integrity/Latency) | Action |
|---|---|---|---|
| Statistically Positive ($p < 0.05$) | Non-Negative or within $-0.5%$ bound | All Passed | Full Global Launch |
| Statistically Positive ($p < 0.05$) | Negative ($> -0.5%$ drop) | All Passed | Executive Decision Required (Trade-off valuation) |
| Statistically Positive ($p < 0.05$) | Any | Failed | Block Launch (Investigate and fix performance/safety bugs) |
| Neutral / Statistically Insignificant | Positive | All Passed | Iterate Model (Does not meet core engagement objective) |
| Statistically Negative ($p < 0.05$) | Any | Any | Reject / Rollback |