Design Harmful Content Detection: ML Content Moderation System

ML system design for harmful content detection: multimodal classifiers, per-harm thresholds, human review queues, prevalence, appeals and adversaries.

Advanced 3 min read · Updated

The question: design a system that detects harmful content (hate speech, violence, nudity, spam, scams, self-harm) on a social platform where users upload text, images and video. It must catch most violations before many people see them, avoid removing legitimate posts, route hard cases to human reviewers, and keep up with adversaries who change tactics. It's a common integrity question at social media companies.

1. Clarify requirements

QuestionAnswer
Content types?Text posts and comments, images, short videos; multiple languages
Scale?1B new posts per day, ~12K per second average
Actions?Remove, reduce distribution, add a warning screen, or send to review; per policy
Timing?Score at upload (before distribution) where possible; re-score when reports or virality arrive
Reviewers?A few thousand trained reviewers, with capacity of a few million decisions a day
Appeals?Users can appeal removals; appeal outcomes must be tracked

2. Frame it as an ML problem

Multilabel classification: one post can violate several policies. Output a probability per harm category. Each category gets its own thresholds, because the cost of errors differs: a missed child-safety violation is far worse than a missed spam post, while over-removing political speech has its own serious cost.

HarmPriorityTypical operating point
Child safety, terrorismHighestVery high recall; aggressive auto-action plus hash matching; human review of borderline
Violence, self-harmHighHigh recall; warning screens and resources for some content
Hate speech, harassmentHigh, context-dependentBalanced; heavy use of human review for borderline
Spam, scamsHigh volumeHigh precision for auto-removal; reduce distribution when unsure

3. Architecture

uncertainretrainUploadHash matchknown bad mediaEncoderstext · image · videoFusion classifierper-harm scoresPolicy enginethresholds · actionsRemove / reduce / allowReview queuesby harm · languageLabels + appeals
The moderation pipeline: hash matching catches known content instantly, multimodal classifiers score new content, a policy engine maps scores to actions, and uncertain or high-reach items go to human review. Reviewer and appeal decisions become labels.

4. Models

  • Hash matching: perceptual hashes of known violating images and videos match re-uploads even after resizing or cropping. Cheap, precise, first line.
  • Unimodal encoders: a multilingual text encoder, an image encoder, and a video model on sampled frames plus audio transcripts.
  • Fusion: a classifier over concatenated embeddings (and metadata) so a harmless image with a hateful caption is caught.
  • Multi-task heads: one per harm category sharing the encoders; adding a new policy means adding a head and labels, not a new system.
  • Account and behaviour signals: new account, posting rate, prior violations, network of known bad actors; often more robust than content alone against spam.
  • Foundation models: LLMs or vision-language models with a policy prompt can label new harm types quickly and serve as teachers for smaller, cheaper production classifiers; see model compression.

5. Labels

Human labels are central here. Policy teams write guidelines; trained reviewers label; disagreements are adjudicated. Sampling for labelling uses active learning around the thresholds and over-samples rare harms and languages. See data labeling.

Policies change. When the definition of a harm changes, old labels can become wrong. Version labels with the policy version and retrain from relabelled data.

6. Serving and scale

Uploads        : 1B/day ≈ 12K/s avg, ~30K/s peak
Text           : cheap; every post and comment scored synchronously at upload
Images         : ~400M/day; image encoder on GPU, batched, ~50 ms
Video          : ~50M/day; sample frames + transcribe audio asynchronously;
                 distribution held back or limited until scored
Re-scoring     : when a post gets reports or goes viral (e.g. 10K views/hour),
                 re-score with a heavier model and prioritise review
Review queue   : ~1-2% of uploads flagged → 10-20M/day; only the top ~2M by
                 (severity × p × predicted reach) reach humans; the rest are actioned
                 by thresholds or reduced in distribution
  • Prioritise review by expected harm: severity × probability × predicted views. A borderline post from an account with millions of followers goes first.
  • Reduce distribution while uncertain, instead of choosing only between removal and full reach.
  • Reviewer wellbeing: blur graphic media by default, cap exposure per reviewer, rotate queues.

7. Evaluation

MetricWhat it tells you
Precision and recall per harm at the operating thresholdQuality of automated decisions
Prevalence (views of violating content per 10K views), from random sample reviewThe user's actual exposure, the north-star metric
Proactive rate (share found before any user report)How much the system catches on its own
Appeal overturn rateOver-enforcement signal
Slice metrics by language and regionWhether smaller languages are under-protected

8. Adversaries and monitoring

  • Bad actors misspell words, add noise to images and use coded language. Augment training data with these perturbations and refresh labels from recent reports.
  • Monitor per-harm score distributions, report rates and prevalence weekly; a jump in reports with flat model flags means a new pattern.
  • Rapid response: analysts can add hashes, keywords or rules in minutes while models are retrained.

Where it’s used

Social networks

Multimodal classifiers, hash matching and large review operations measured by prevalence.

Marketplaces

Detecting prohibited items and scam listings with text, image and seller signals.

Generative AI products

The same per-harm classifiers act as guardrails on prompts and model outputs.

In an interview

  • Frame it as multilabel with per-harm thresholds set by the cost of errors.
  • Layer hash matching, multimodal models, account signals and human review.
  • Prioritise the review queue by severity × probability × reach.
  • Measure prevalence from random samples, plus appeal overturns and slice metrics.

Frequently asked questions

How do platforms detect harmful content at scale?

Hash matching catches known violating media, multimodal classifiers score new text, images and video per harm category, a policy engine applies per-harm thresholds, and uncertain or high-reach items go to human reviewers whose decisions retrain the models.

How is content moderation quality measured?

By prevalence (views of violating content measured from random samples), proactive detection rate, precision and recall per harm, appeal overturn rates and slice metrics by language.

Further reading