Design an Experiment for Interest-Based Friend Recommendations
Statistics & ExperimentsModel answerLast updated
Design a randomized experiment to measure whether recommending connections based on predicted interest improves discovery and retention.
Context
A social platform is reconsidering how it surfaces new connections to users. The current system suggests accounts primarily through mutual connections and network proximity. The product team proposes an alternative approach: surface recommendations through proactive messages sent to users' devices, where the accounts shown are selected by a machine learning model predicting interest rather than just social ties.
Before launching this feature, leadership wants evidence that it genuinely improves how users discover valuable connections over time, without harming trust or engagement.
Your Task
Design an experiment to evaluate this proposed change. Your design should address:
-
Success Metrics: What primary outcome would you measure to determine whether the new approach works? What secondary or safety metrics would you track to catch unintended consequences?
-
Randomization Strategy: How would you assign users to treatment and control? What challenges arise when testing features in a social network, and how does your design account for them?
-
Handling Non-Compliance: Not all users have messages enabled, and engagement levels vary widely. How do you estimate the effect when treatment delivery is incomplete?
-
Interpreting Results: Suppose your primary metric shows a 0.5% improvement in the treatment group. At a scale of billions of users, this will almost certainly be statistically significant. How would you decide whether it's worth launching?
Constraints
- The platform has approximately 2 billion daily active users.
- Delivery of outbound messages depends on device state, app version, and user permissions.
- Users interact within a social graph, so one user's treatment may affect another's experience.
- You must identify at least two sources of bias that could invalidate your results if ignored.
Hints
Hint 1
Think about what happens when a treated user connects with someone in the control group—does this violate the independence assumption?
Hint 2
Statistical significance is nearly automatic at this scale. Focus on whether the effect size matters for the business.
Hint 3
Consider the difference between 'assigned to treatment' and 'actually received treatment'—which population should drive your conclusions?
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Model Answer: Designing the Experiment
This problem tests whether you can translate a product question into a rigorous experiment design. Strong answers demonstrate metric discipline, awareness of network interference, proper handling of incomplete compliance, and the ability to distinguish statistical noise from business value at scale.
1. Success Metrics
Primary Metric: Durable Connections Formed (28-Day Window)
Count the number of new connections each assigned user forms that meet all of these criteria:
- Originated from the recommendation surface (either the message itself or the in-app module it links to)
- Persisted beyond 7 days (no unfollow, block, or "hide this account" action)
- Led to at least one meaningful interaction within 28 days (profile visit, content engagement, or direct message)
This composite metric filters out accidental or regretted connections. A simple click-through rate or raw connection count can be gamed by aggressive messaging or misleading previews. Requiring persistence and follow-up interaction ensures the recommendations provide real value.
Why 28 days? Long enough to observe retention behavior, short enough to get results before the product landscape shifts.
Secondary Metrics
- Total new connections from all sources: Detects whether the feature merely shifts behavior from organic discovery (search, explore pages) to the new surface without adding net value.
- Day-28 retention and sessions per user: The ultimate business outcome. A feature that boosts connections but reduces overall platform usage has failed.
Guardrail Metrics (with Pre-Registered Thresholds)
Each must remain within a non-inferiority bound to proceed with launch:
- Message permission opt-out rate and settings changes: The clearest signal of user trust erosion.
- App uninstall rate: Extreme negative signal.
- Message dismissal or "report spam" rate: Captures perceived intrusiveness.
- Unfriends, blocks, and reports on recommended accounts: Protects the people being recommended, not just the recipients. Bad recommendations harm both sides of the marketplace.
- Overall daily active users and time spent: Ensures the feature doesn't cannibalize higher-value surfaces.
2. Randomization Strategy
The Core Problem: Network Interference
User-level randomization is inappropriate here. When a treated user connects with a control user, the control user's experience changes—they gain a new follower, see new content in their feed, and may receive different recommendations themselves. This violates SUTVA (the stable unit treatment value assumption) and typically dilutes the measured effect, since treated users indirectly "leak" treatment to control users through the graph.
Solution: Cluster Randomization
-
Partition the social graph into clusters using a community detection algorithm (e.g., Louvain, spectral clustering, or balanced label propagation). The goal is to maximize within-cluster edge density and balance cluster sizes.
-
Stratify clusters by size, geographic region, and median user activity level to ensure treatment and control groups are comparable.
-
Randomly assign entire clusters to treatment or control. Now most interactions happen within clusters, reducing cross-contamination.
-
Run a parallel individual-level randomization arm (small sample) to directly quantify interference. The difference between cluster-level and user-level effect estimates reveals how much the network structure matters.
Additional Considerations
Cannibalization Risks
-
Message budget caps: Most platforms limit daily outbound messages per user to avoid fatigue. A new message type may displace another (e.g., comment notifications). Apply the same cap in both arms and track engagement across all message categories.
-
Surface substitution: Users might have formed the same connections through search or other surfaces anyway. This is why total connections is a key secondary metric.
-
Two-sided imbalance: Popular accounts predicted to interest many users could get overwhelmed with connection requests, while niche creators lose visibility. Monitor the distribution of incoming requests across recipient accounts.
Delivery Lag and Client State
Messages aren't delivered instantly. Delivery depends on device online status, OS push token validity, app version, and user permissions. Log both server-side "eligible for message" and client-side "message delivered" events for all users. Run the experiment for at least 4 weeks to cover weekly cycles and account for delivery delays.
3. Handling Non-Compliance (Disabled Messages, Low Activity)
Not everyone receives treatment, even when assigned to it. Handling this correctly is crucial.
Intent-to-Treat (ITT): The Primary Estimate
Analyze every user according to their assigned group, regardless of whether they actually received or opened a message. This is the unbiased estimate of what would happen if you shipped the feature, because in production you can't control who has messages enabled or who opens the app.
Gaining Precision: Triggered Analysis
Restrict the analysis to users who were eligible for treatment at assignment time (e.g., had message permissions enabled). Importantly, eligibility must be measured before randomization. Conditioning on "received a message" after assignment introduces bias, because treatment itself can cause opt-outs.
For the control group, use counterfactual logging: record when the new system would have sent a message, so both groups have a comparable "triggered" population. This increases statistical power without sacrificing validity.
Estimating the Effect on the Treated (CACE)
Use the assignment as an instrumental variable for actual receipt. The complier average causal effect (CACE) is:
CACE = ITT / (P(received | treatment) − P(received | control))
This estimates the effect among users who actually receive the treatment.
Reducing Variance
- Stratify by pre-period activity: Break users into terciles by baseline engagement (sessions, connections formed in prior 28 days) and report effects within each stratum.
- Apply CUPED (Controlled-experiment Using Pre-Experiment Data): Use pre-period outcomes as covariates to reduce variance in the estimate.
4. Statistical vs. Practical Significance
At 2 billion users, almost any effect will be statistically significant. A p-value under 0.05 is nearly meaningless. Here's how to decide if a 0.5% lift matters:
Adjust for Clustering
With cluster randomization, the effective sample size is roughly the number of clusters, not users. The design effect is:
DEFF = 1 + (m − 1) × ICC
where m is average cluster size and ICC is the intra-cluster correlation. For example, 100,000 clusters of 20,000 users each with ICC = 0.01 gives DEFF ≈ 200. Standard errors are much larger than naive user-level calculations suggest. A 0.5% lift might have a confidence interval like [−0.2%, 1.2%], which includes zero.
Pre-Register a Minimum Practical Effect
Before seeing data, define the smallest effect worth the costs (engineering resources, message budget, inference compute, potential guardrail degradation). If the baseline is 0.3 connections per user per month, a 0.5% lift adds 0.0015 connections per user, or 3 million additional connections per month across 2 billion users. Convert this to downstream retention or revenue impact and compare against costs.
Robustness Checks
- Time dynamics: Is the lift driven by a novelty spike in week 1 that fades by week 4?
- Segment heterogeneity: Is the effect concentrated in one country, device type, or activity level?
- Multiple testing: Does the result survive Bonferroni correction across the full set of metrics?
- Guardrails: Are all safety metrics within their non-inferiority bounds?
Decision Rule
Ship only if:
- The lower bound of the confidence interval exceeds the minimum practical effect, and
- All guardrail metrics remain within acceptable bounds, and
- The effect is stable over time and across key segments.
Two Key Confounding Variables
Randomization balances these in expectation, but they can still bias subgroup analyses or comparisons that condition on post-treatment behavior:
-
Message Permissions by Platform: iOS requires explicit opt-in for push notifications, while Android historically defaulted to enabled. Delivery rates and user composition differ by OS. Any analysis that conditions on "received message" will conflate treatment effects with platform differences unless you control for OS or analyze within-OS strata.
-
Baseline Engagement and Tenure: Power users both receive more messages (because they open the app more often) and form more connections regardless of treatment. If you naively compare users who opened a message to those who didn't, you're comparing different populations. Pre-period activity must be included as a covariate or stratum.
Additional confounders: time zones (messages delivered at night perform worse), app version (older clients may render content differently), and concurrent experiments running in the same feature space.
Summary
A strong experimental design here requires:
- A metric that captures durable value, not just clicks
- Cluster randomization to avoid network interference
- Intent-to-treat as the primary estimand, with triggered and CACE analyses for precision
- A decision framework that weighs practical significance against costs, not just p-values
At scale, the challenge isn't achieving statistical significance—it's ensuring the effect is real, robust, and worth the tradeoffs.