Experiment Plan for Rolling Out a Comment-Spam Filter
Statistics & ExperimentsModel answerLast updated
Design and analyze a cluster-randomized, stepped-wedge experiment for a bot-comment suppression system, including power, adaptation risks, a quasi-experimental fallback and stop/go rules.
A social platform has built a system that detects suspected bot accounts and then either hides their comments or rate-limits them. You are asked to measure whether it actually helps, and to produce an experiment design and analysis plan that ends in explicit stop/go criteria.
Cover the following:
- Randomization and interference. Compare randomizing individual accounts with randomizing clusters of users from the interaction graph, in terms of spillover. Propose a stepped-wedge ramp.
- Metrics. Choose primary success metrics (think: human-visible comments per human daily active user, retention of human creators, report rates) and guardrails (new-user activation, moderation backlog, latency).
- Eligibility and variance reduction. Decide how to treat accounts that were already flagged and regions with unusually heavy bot activity. Describe the pre-exposure window and how CUPED fits in.
- Power. Baseline human-visible comments per human DAU is 5.5. You expect total comments to fall about 2% (bots removed) while human-visible comments rise about 1%. Outline the sample-size and duration calculation for a 14-day test, accounting for correlation between days and between users in a cluster.
- Novelty and adaptation. Explain how you would handle novelty decay, bots migrating to untreated areas, and adversaries learning to evade the filter.
- Fallback. If a randomized test is not possible, describe a difference-in-differences or synthetic-control approach, including high-frequency pre-trend checks.
- Diagnostics. If false positives start rising, what holdouts and stratified cuts would you use to find out why?
Finish with a concise analysis plan and the stop/go rules you would commit to before looking at any data.
Hints
Hint 1
Start by pinning down what is randomized: the viewer, the creator or surface, or the bot account. Each isolates a different effect, and bots can move from treated areas to untreated ones, so think about which unit keeps that movement inside one arm.
Hint 2
For power, work at the user level (average each user's 14 days into one number) so you do not pretend that correlated days are independent. Then apply, in order: the base two-sample formula, the CUPED variance factor 1 - rho^2, and a cluster design effect 1 + (m - 1) * ICC.
Hint 3
Total comments is expected to fall and human-visible comments to rise, so they are different metrics with different roles. Decide which is the decision metric and which is a mechanism check, and write numeric guardrail margins and a ship rule before the experiment starts.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
What a strong answer shows
The treatment changes the shared environment: bots, viewers and creators all interact, and the adversary reacts. A good plan therefore (a) defines the treatment exactly, (b) picks a unit that keeps spillover inside one arm, (c) separates mechanism metrics from decision metrics, and (d) fixes the decision rules in advance.
0. Define the treatment
"Suppress bot comments" can be randomized three ways:
| Randomize | What changes | Good for | Weakness |
|---|---|---|---|
| Viewer | The viewer no longer sees flagged comments | Consumer experience | Bots keep posting, so creators see no change |
| Creator / surface | Flagged comments are hidden on that creator's content | Creator retention, report rates | Bots can move to control creators |
| Bot account | Flagged account is limited everywhere | Bot behavior, harm to wrongly flagged humans | Affects every viewer, so not a clean contrast |
The ship decision concerns the whole system, so the main experiment randomizes creator/surface groups, formed as graph clusters. Viewer-level and bot-level arms are diagnostics only.
1. Randomization and interference
Account-level assignment fails because commenters overlap between treated and control creators. Bots chased off treated posts reappear on control posts, so control gets worse, treated looks better, and the effect is inflated. Hidden comments also change the threads that control users read.
Cluster instead:
- Build a creator-commenter graph from the last 28 days and partition it with Louvain or Leiden.
- Aim for about 200 active humans per cluster with over 80% of interactions staying inside.
- Randomize clusters, stratified by size, geography and pre-period bot share.
- Report the cross-cluster edge share, which bounds residual interference.
Stepped-wedge ramp. Clusters switch on in random order: 5% in week 0, 15% in week 1, 30% in week 2, 50% in week 3, with a 10% long-term holdout that never switches. Each step gives a fresh treated vs not-yet-treated comparison, limits the blast radius of a bad classifier, and exposes time-varying effects. Analyze with cluster and period fixed effects and cluster-robust standard errors.
2. Metrics
- Primary: human-visible comments per human DAU. "Human" must come from a label independent of the classifier under test (verified, long-tenured, or audited accounts).
- Secondary: human creator 7- and 28-day retention, posts per creator, spam/scam reports per 1,000 impressions (should fall).
- Mechanism checks: total comments (should drop about 2%) and impressions of flagged comments (should drop sharply).
- Guardrails (non-inferiority): new-user D1/D7 activation no worse than -0.5% relative; appeal rate and estimated FP rate under a fixed ceiling (e.g. under 1% of actioned accounts); moderation backlog and time-to-review no worse than +10%; comment p99 latency no worse than +20 ms; revenue and ad impressions flat.
3. Eligibility and variance reduction
- Already-flagged accounts: freeze the list at start. Remove them from the human denominator but keep the content they produce in the measurement, otherwise you condition on something affected by treatment.
- Accounts created or flagged mid-test: analyze by assigned cluster, not by later status.
- High-risk geos: stratify rather than exclude, since exclusion biases results toward easy markets. Treat them as a pre-registered subgroup and keep them out of the first ramp step if risk is high.
- CUPED: use a 28-day pre-period, with each user's pre-period comments per active day as the covariate. With rho around 0.7, variance shrinks by 1 - rho^2 = 0.51. Add cluster-level pre-period means too.
4. Power for a 14-day test
Collapse each user's 14 days into one mean. With day-to-day correlation of about 0.3, 14 days carry roughly 14 / (1 + 13 x 0.3) = 2.9 independent days, so treating them as 14 rows would overstate precision.
Assumptions: mean 5.5; target effect +1% = 0.055; skewed metric with per-user SD of the 14-day mean about 12 (winsorize at p99.9); alpha 0.05 two-sided; power 80% so (z_0.975 + z_0.8)^2 = 7.84.
n per arm = 2 x 7.84 x 144 / 0.055^2 = about 746k users.
| Adjustment | Factor | Users per arm |
|---|---|---|
| Base | none | 746k |
| CUPED | 0.51 | about 380k |
| Cluster design effect, 1 + 199 x 0.02 | about 5 | about 1.9M (about 9.5k clusters) |
The -2% total-comments effect is twice as large on a less noisy metric, so it needs about a quarter of the sample and confirms the mechanism rather than driving the decision.
If eligible DAU cannot supply 1.9M per arm, extend to 21-28 days or pair clusters on pre-period covariates, which often cuts the design effect by 30-50%. Run an A/A first on the same clusters to check realized ICC and a roughly 5% false-positive rate. Only post-ramp periods at stable allocation count toward the primary test; 14 days covers two weekly cycles.
5. Novelty, migration, adversaries
- Novelty decay: estimate effect by weeks since switch-on (the wedge makes this possible) and ship on the steady-state effect from week 2 onward, not the overall average.
- Bot migration: track bot comment volume in control clusters against their own pre-trend and against the long-term holdout. A rise signals spillover, so report effect bounds with and without that inflation.
- Adversarial learning: measure recall weekly on fresh labeled samples, freeze the model version within an arm, treat model updates as new treatments, and keep the holdout at least 8 weeks to see the post-adaptation equilibrium.
6. Fallback if randomization is impossible
Use this for a global launch, legal limits, or a graph too dense to cluster.
- Staggered difference-in-differences across geos or surfaces, using a heterogeneity-robust estimator (Callaway-Sant'Anna) rather than naive two-way fixed effects.
- Synthetic control for a single launched unit: build a weighted donor pool matching pre-period outcomes.
- Pre-trend checks at high frequency: daily or hourly event-study plots, placebo launch dates, and placebo units. Leads of the event study should be flat and the pre-period fit tight, otherwise do not trust the estimate.
- Exclude donors exposed to bot migration, and state clearly that the result is weaker than the experiment.
7. If false positives rise
- Keep an on-experiment holdout of flagged accounts that are not actioned (a small random sample, with ethical review and tight caps) to measure true precision and harm.
- Audit a stratified labeled sample of actioned accounts.
- Cut results by new vs veteran users and creators vs consumers. New users and small creators are the most likely victims of FPs and the most important for growth.
- Compare appeals and reinstatements by cohort, and by model version and threshold.
Stop/go rules (pre-registered)
- Stop immediately: FP rate over ceiling, new-user activation breach beyond -0.5% (with confidence), or latency or backlog guardrail broken for two consecutive days.
- Go: primary metric lift with the lower confidence bound above zero at steady state, report rate down, all guardrails within margins, and migration-adjusted bounds still positive.
- Hold and iterate: positive total effect but a negative subgroup (e.g. new users) or evidence that gains vanish as bots adapt.
Common mistakes
Randomizing accounts despite shared threads; using the classifier's own labels to define "human"; excluding flagged accounts after treatment; ignoring day-level correlation; skipping cluster design effects; and shipping on the early novelty-inflated average.