Designing Metrics and A/B Tests for Harmful Feed Content
Statistics & ExperimentsModel answerLast updated
Define a severity-aware metric for harmful content exposure, then design a randomized experiment to test a feed intervention despite rare outcomes, costly labels, and adversaries.
You work on the data science team for a social platform with a content feed. The company wants to cut how much harmful user-generated content people see. The team is about to ship a change that demotes borderline harmful posts in feed ranking, and you have been asked to evaluate it.
Answer the following as you would in a technical screen:
- Clarify the problem. Which questions would you ask before designing anything?
- Measure harm. What primary metric would you use, and why? How would you estimate it when harmful content is rare and labeling is expensive? How would you account for different severity levels?
- Design the experiment. State the hypothesis, the randomization unit, the primary metric, the secondary metrics, and the guardrails. Explain what changes if the intervention is removal rather than demotion.
- Address statistical power. Harmful views might be around 0.1% of all views. How would you size the experiment, and how would you reduce labeling cost?
- Interpret the results. What risks (ethical, interference, adversarial, measurement) could undermine your conclusions?
A structured answer with concrete metrics, trade-offs, and rough numbers is expected.
Hints
Hint 1
Think about exposure rather than item counts: a violating post seen a million times matters more than one seen twice. Also ask why takedown counts are ambiguous as a metric.
Hint 2
Because harm is rare, uniform random labeling is wasteful. Consider oversampling impressions that a classifier scores as risky, then correcting with inverse-probability weights, and make sure the outcome labels come from humans rather than the model being tested.
Hint 3
Choose the randomization unit by asking where interference occurs. Demotion changes only one viewer's feed, while removal changes what everyone sees. Also consider which control arms are ethically unacceptable.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Framing
The structure I would follow is clarify, measure, experiment, interpret. The core difficulties are that "harm" is fuzzy, the outcome is rare and expensive to label, and the treatment can contaminate its own measurement.
1. Clarify
- Which harm? Mild insults, harassment, self-harm promotion, scams, and illegal material differ in severity and legal constraints.
- What is the intervention? A new classifier, a lower removal threshold, a ranking demotion, or added friction. I will assume a ranking demotion for borderline posts.
- What is the goal? Reduce exposure to harm without over-enforcing against benign content or hurting creators.
2. Measuring harm
Use prevalence, not takedowns. Takedown counts go up when enforcement improves and also when harm increases, so they are ambiguous, and they are produced by the system under test. The better metric is exposure-based:
Prevalence = views of violating content / total views
This weights a post by how many people actually saw it.
Estimating it.
- Sample impressions (not posts) and send them to blinded, trained human raters using a written policy rubric.
- Because violations are rare, stratify by a classifier score and oversample high-score strata. Reweight each labeled impression by the inverse of its sampling probability (Horvitz-Thompson) to stay unbiased. The classifier decides where to look, not what the label is.
- Report confidence intervals, track inter-rater agreement (for example Cohen's kappa), and seed gold-standard items to audit raters.
Severity. Define tiers with policy and legal input, for example mild insult (weight 1), targeted harassment (5), credible threats or self-harm promotion (25). Illegal content is handled outside experimentation.
Harm-weighted prevalence = sum over tiers of (weight x violating views in tier) / total views
Cautions: weights are judgment calls, so report every tier separately alongside the composite (a composite can hide a shift from many low-severity views to a few high-severity ones), and run sensitivity checks with alternative weights. Consider reach cuts such as exposure among minors or distinct users exposed.
Supporting metrics. Enforcement precision (appeal overturn rate, audits of actioned items), recall (caught violating views over all violating views), report and block rates (noisy proxies that depend on UI visibility), and time-to-action (views accrued before removal).
3. Experiment design
Hypothesis. Demoting borderline content reduces harm-weighted exposure per viewer by at least X%, without material engagement loss or more benign content being demoted.
Metrics.
- Primary: harm-weighted prevalence over treated viewers' impressions, from labeled samples.
- Secondary: per-tier prevalence, reports per 1k views, creator behavior changes.
- Guardrails: sessions and time spent, false-positive demotion rate on an audited sample, creator retention (especially for groups classifiers tend to mis-score), latency.
Randomization unit.
- Demotion: randomize by viewer. Content stays on the platform, so only each viewer's own feed changes and interference is limited.
- Removal: viewer-level randomization fails because a removed post disappears for everyone. Use creator-level or cluster randomization (communities, graph clusters), geo or switchback designs, or offline evaluation on labeled data followed by staged rollout.
- Network spillover: harmful content spreads via shares. Demotion in the treatment arm reduces resharing that reaches control users, so viewer-level estimates tend to understate the total effect.
Avoid circularity. If the treatment is a new classifier, never use its scores as the outcome. Labels must come from independent human review.
Ethics. Do not withhold enforcement on severe or illegal content from a control arm. Experiment only in the borderline region where the right action is uncertain, or compare two active policies. Control exposure should not exceed what production already allows.
4. Power
With baseline p = 0.1% and a target 10% relative reduction (delta = 0.0001), alpha = 0.05, power 80%:
n per arm ≈ 16 p(1-p) / delta^2 ≈ 16 x 0.001 / 10^-8 ≈ 1.6M labeled views per arm
(The 16 comes from 2(1.96 + 0.84)^2, roughly 15.7.) That is infeasible to label by hand, so reduce the cost:
- Stratified oversampling of high-score impressions, with reweighting.
- Model-assisted estimation. Use a calibrated, frozen classifier (not the one under test) across all impressions, and correct its bias with a smaller labeled sample (difference estimators, prediction-powered inference).
- CUPED with pre-period exposure as a covariate.
- Correct analysis unit. Analyze per viewer and use the delta method for the ratio metric. Impressions are clustered within users, so treating them as independent understates variance.
- Higher-base-rate proxies such as reports or near-threshold content as leading indicators, validated against labeled prevalence.
5. Interpretation and pitfalls
- Adversarial adaptation. Bad actors learn the demotion and evade it, so early gains decay. Keep a long-term holdout (1 to 5% of users) and re-measure periodically.
- Novelty and seasonality. Run long enough to cover weekly cycles and watch effects over time.
- Heterogeneity. Check effects by region, language, and creator group to catch uneven false positives.
- Metric gaming. Do not optimize on the composite alone; review per-tier results.
- Multiple comparisons. Pre-register the primary metric and correct for many secondary cuts.
Common mistakes
- Using takedown counts or report volume as the success metric.
- Counting posts rather than views.
- Evaluating a classifier with its own scores.
- Randomizing by user for a removal policy.
- Ignoring labeling cost and treating the sample size as free.
- Holding back enforcement on severe content to keep a clean control.
Summary
Define harm as severity-weighted exposure, estimate it with stratified human labeling and inverse-probability weights, randomize at the unit that limits interference, cut variance with model assistance and CUPED, and protect conclusions against ethics, spillover, and adversarial drift.