Detecting Bot Accounts and Measuring Generative Ad Tools
Statistics & ExperimentsModel answerLast updated
Design metrics and experiments to evaluate an automated account integrity classifier and a generative AI ad creation tool on a social platform.
Background
You work as a Data Scientist at a large social platform with two ongoing projects that need rigorous evaluation:
- Bot Account Classifier: An ML model assigns each account an "inauthenticity score." Any account scoring above 0.85 is automatically suspended. The team wants to know how well the system is actually working.
- Generative Ad Creative Tool: Advertisers can now use an AI tool to auto-generate images and copy for their ads. Leadership is worried that easier ad creation will flood the auction with low-quality or policy-violating content, degrading the user experience over time.
What You Are Asked to Do
Part 1 — Metrics
Propose a primary metric to measure how well the bot detection system performs. Explain why accuracy is a poor choice here. Then describe how you would estimate model performance on the large population of accounts that are never flagged and therefore never reviewed.
Part 2 — Experiment Design
You want to run a randomized controlled trial (RCT) to measure whether exposure to AI-generated ads hurts 30-day user retention. Describe your experimental design. Specifically, address how you would handle the fact that users are interconnected — one user's behavior can be influenced by ads their friends or network connections were exposed to.
Part 3 — Threshold Trade-offs
The model team proposes tightening the suspension threshold to improve precision (fewer wrongful suspensions). Walk through the downstream business consequences of this change. How would you formally quantify the cost of a false positive and the cost of a false negative, and how would those costs feed back into setting the threshold?
Hints
Hint 1
Fake accounts are typically 3–5% of all users. Think about what a trivial baseline classifier would score on accuracy, and what that tells you about accuracy as a metric. What would you actually want to maximize, and what constraint would you put on the other side?
Hint 2
The tool is adopted by advertisers, but your outcome lives on the user side. Randomizing advertisers doesn't isolate what users see — think carefully about what unit you actually want to randomize and what spillover paths exist.
Hint 3
To put a number on the threshold decision, try writing out a dollar cost for each error type separately, then derive the decision rule from those two numbers. A middle tier between 'suspend' and 'do nothing' can also reduce the effective cost of being wrong.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Part 1 — Metrics for Bot Account Detection
Why accuracy fails
Bot accounts make up roughly 3–5% of monthly active users. A classifier that suspends nobody achieves 95–97% accuracy while catching zero bots. Accuracy is dominated by the majority class and gives no signal on what actually matters.
Primary metric: Recall (the share of true bot accounts the system catches), subject to a precision guardrail of at least 95%. Recall tells you how much of the problem you are solving; the precision guardrail limits wrongful suspensions of real users. A stronger north-star metric is exposure-weighted fake prevalence — the fraction of ad impressions or user interactions that touch inauthentic accounts — because an active bot running scam ads is far more harmful than a dormant one.
Secondary operational signals: appeal overturn rate (a cheap but biased false-positive proxy) and per-segment calibration of the model score.
Estimating performance on unlabeled accounts
Human review only ever touches flagged accounts, so recall cannot be measured directly. Accounts below the 0.85 threshold are never labeled, and assuming they are all real inflates recall estimates.
Solution: a score-stratified random audit.
- Each measurement period, draw a random sample of accounts regardless of score, stratified into bands such as 0–0.3, 0.3–0.6, 0.6–0.85, and above 0.85. Oversample the bands near and above the threshold, where bots concentrate.
- Send the sample to human reviewers who label each account without seeing its model score.
- Reweight each stratum by its inverse sampling probability to produce unbiased estimates of prevalence, recall, and false-negative count across the full population, with confidence intervals.
Worked example. Say there are 100M accounts, 1M are flagged, and a review of flagged accounts shows 92% precision — about 920k true positives. An audit of the 99M unflagged accounts finds 1.5% are bots, giving roughly 1.485M false negatives. Recall is then 920k / (920k + 1.485M) ≈ 38%. A model can look highly precise and still miss most of the problem; only the audit reveals this.
Part 2 — RCT for Generative Ad Tool and Long-Term Retention
Why naive designs break down
Randomizing advertisers into treated (access to the tool) and control (no access) creates two problems. First, treated advertisers' AI-generated ads enter the shared auction and reach users in both arms — there is no clean separation of what users see. Second, advertisers in the control group lose impressions to treated advertisers, which contaminates revenue comparisons.
Randomizing users independently ignores social spillover: users interact with, share, and react to ads their friends were shown, so individual user assignment mixes treatment signals across the network.
Recommended layered design
User-side eligibility experiment (primary unit for retention). Randomly assign users to treatment, where AI-generated creatives are eligible to serve in their auction slot, or control, where those creatives are filtered out and the next-best ad fills the slot. This isolates the effect of seeing AI-generated ads on individual retention, independent of which advertisers created them.
Graph-cluster randomization (addresses social interference). Partition the user graph into communities using Louvain clustering or balanced ego-clusters. Assign treatment at the cluster level so that most of each user's social connections share the same arm. Compare individual-level and cluster-level treatment effect estimates. A meaningful gap between them is evidence of interference, which would bias a purely individual-level estimate.
Market-level or geo experiment (captures full marketplace equilibrium). Randomly enable the tool for all advertisers in a set of comparable markets — countries or designated market areas — and hold it off in matched markets. This captures equilibrium effects: how advertiser adoption changes auction dynamics, CPMs, and creative volume. Use synthetic control or matched-pair difference-in-differences to handle the small number of geographic units.
Duration and power. Clustering inflates variance by the design effect, approximately 1 + (m − 1) × ICC, where m is cluster size and ICC is intra-cluster correlation of the outcome. Offset this with CUPED using pre-experiment engagement as a covariate. Run the experiment for at least 4–8 weeks to avoid novelty bias. Maintain a long-term holdout beyond the primary analysis window.
Guardrail metrics: policy-violation rate in the auction, ad hide and report rates, moderator queue load, advertiser ROAS, and revenue.
Part 3 — Precision Trade-offs and Cost Model
Business consequences of raising precision
Tightening the threshold reduces suspensions, so recall falls and more bots remain active.
Gains from fewer false positives: legitimate users and advertisers are wrongly suspended less often, protecting revenue, small-business relationships, and platform trust. Appeals and manual review costs drop.
Losses from more false negatives: more invalid traffic — fake clicks and impressions — triggers advertiser refunds and suppresses bids. More bot-run scam ads increase user exposure to harmful content, driving churn. Regulatory exposure and brand risk grow.
Quantifying the two error types
Cost of a false positive (C_FP):
C_FP = P(account is an advertiser) × (expected advertiser spend × margin × P(churn after wrongful suspension)) + review and appeal cost + user lifetime value lost if the account was a real user
Cost of a false negative (C_FN):
C_FN = invalid-traffic refunds + (bid reduction × elasticity × impression volume) + (malicious-ad exposures × incremental churn probability × user LTV) + expected regulatory and enforcement costs
Estimate the churn terms from historical wrongful-suspension cohort analysis and from exposure-to-churn attribution studies on known bot-served impressions.
Threshold rule. With a calibrated score p for a given account, suspend when:
p > C_FP / (C_FP + C_FN)
For example, if C_FP = $500 and C_FN = $100, the optimal threshold is 500 / 600 ≈ 0.83, slightly lower than the current 0.85.
Beyond a single threshold. Use segment-specific thresholds — a higher bar for accounts with substantial verified spend history — and introduce a middle tier that triggers friction (CAPTCHA, phone verification) or routes accounts to human review rather than auto-suspending. The friction tier substantially lowers the effective C_FP by giving borderline accounts a path to recovery.
Common Mistakes
- Reporting AUC or accuracy alone without specifying the operating threshold
- Measuring recall only on accounts that were already flagged, which cannot detect false negatives by construction
- Randomizing advertisers and reading user-level retention as though no spillover exists
- Proposing a switchback (time-based alternation) design for a 30-day retention outcome — carryover effects invalidate it
- Discussing the precision–recall trade-off in purely qualitative terms without a cost model or a derived threshold rule