Library

Volume 1 · Additional Advanced System Design Scenarios

Notebook
Sign in

Section 65

Global Content Moderation Pipeline for User-Generated Content

2,443 words · about 11 min

Problem Statement

Design a pipeline that moderates user-generated content (text, images, video) globally, combining automated ML/LLM classification with human review queues, supporting dozens of languages, providing an appeal workflow, and meeting strict latency requirements so that most legitimate content is visible near-instantly while high-risk content is held or removed before wide distribution.

Requirements Clarification

  • Assume 50 million content submissions/day (posts, comments, images, short videos) across a global user base.
  • Latency tiers to clarify with interviewer: (a) pre-publish synchronous check for a fast automated pass (target <300ms) that catches clear-cut violations (known-hash matches, blocklisted terms) before content is even visible; (b) post-publish async deeper scan (target <5 sec for text/image, <60 sec for video) that can retroactively remove/limit-distribute content that slipped through; © human review SLA for escalated/ambiguous cases (target <2 hours for high-severity queue, <24 hours for standard queue).
  • Language support: assume top 20 languages cover ~95% of volume; must still handle long-tail languages without a fully trained classifier for each.
  • Severity tiers: content is classified into categories (e.g., spam, harassment, graphic violence, CSAM, hate speech, misinformation) each with different automated-confidence thresholds and different legal/removal urgency (CSAM-class content requires immediate automated block + mandatory legal reporting pipeline, zero tolerance for human-review delay).
  • Appeal workflow: users can appeal a moderation decision; assume appeal SLA of <48 hours and requirement that appeal review be by a different reviewer/pool than the original decision (auditable, avoids reviewer bias repetition).
  • Assume ~2-5% of all content gets flagged by automated systems for further scrutiny (human review or async deeper model); the rest publishes after the fast pre-publish pass.

Architecture Diagram

User submits content
        │
        ▼
┌───────────────────────────────────────────────────────────────────────┐
│                     Ingestion & Fast Pre-Publish Gate (<300ms)          │
│  ┌─────────────────┐  ┌───────────────────┐  ┌──────────────────────┐ │
│  │ Hash Match        │  │ Lightweight        │  │ Rate/Spam Heuristics  │ │
│  │ (PhotoDNA-style    │  │ Classifier          │  │ (velocity, account     │ │
│  │  known-bad hash    │  │ (fast text/image    │  │  reputation, new-      │ │
│  │  DB — CSAM, terror  │  │  model, distilled,  │  │  account signals)      │ │
│  │  content)           │  │  cached embeddings) │  │                        │ │
│  └─────────┬──────────┘  └──────────┬─────────┘  └───────────┬───────────┘ │
│             └────────────────────────┼─────────────────────────┘             │
│                                        ▼                                     │
│                          Decision: BLOCK / PUBLISH+FLAG / PUBLISH             │
└───────────────────────────────────┬───────────────────────────────────────┘
                                      │  (publish path, majority of content)
                     ┌────────────────┼─────────────────────┐
                     ▼                                        ▼
              Content goes live                    Event -> Async Deep Scan Queue
                     │                                        │
                     │                          ┌─────────────▼──────────────────────┐
                     │                          │   Async Deep Scan (<5s text/image,   │
                     │                          │   <60s video)                        │
                     │                          │  - Larger multimodal LLM classifier   │
                     │                          │    (nuanced hate speech, context,     │
                     │                          │     coded language, satire detection) │
                     │                          │  - Multi-language routing:            │
                     │                          │    top-20 lang -> native fine-tuned    │
                     │                          │    model; long-tail -> translate-then- │
                     │                          │    classify pipeline                  │
                     │                          │  - Video: frame sampling + audio       │
                     │                          │    transcript + visual classifier      │
                     │                          └─────────────┬──────────────────────┘
                     │                                        │
                     │                     confidence high -----auto-action (remove/limit)
                     │                     confidence low/medium -----▼
                     │                                    ┌──────────────────────────┐
                     │                                    │  Human Review Queue        │
                     │                                    │  - Priority queue by         │
                     │                                    │    severity (CSAM/violence   │
                     │                                    │    jump the line)            │
                     │                                    │  - Reviewer pool routed by    │
                     │                                    │    language/region/expertise  │
                     │                                    │  - Reviewer tooling: context, │
                     │                                    │    model explanation, similar-│
                     │                                    │    case precedent lookup      │
                     │                                    │  - Wellness controls: content  │
                     │                                    │    blurring, rotation limits   │
                     │                                    └────────────┬──────────────────┘
                     │                                                 │ decision
                     │                                                 ▼
                     │                                    ┌──────────────────────────┐
                     └───────────────────────────────────▶│  Action & Notification     │
                                                            │  Service                    │
                                                            │  - remove/limit-distribution │
                                                            │  - notify user + reason      │
                                                            │  - log to audit trail        │
                                                            └────────────┬──────────────────┘
                                                                         │
                                                            ┌────────────▼──────────────────┐
                                                            │  Appeal Workflow                │
                                                            │  - user files appeal            │
                                                            │  - routed to different reviewer │
                                                            │    pool than original decision  │
                                                            │  - decision + rationale logged   │
                                                            └─────────────────────────────────┘

  Special path (parallel, always-on, highest priority):
  CSAM / imminent-harm hash or high-confidence classifier match --> immediate hard block,
  no publish, mandatory legal/NCMEC-equivalent reporting pipeline, bypasses normal queue entirely.

  Feedback loop: human review decisions -> labeled training data -> periodic model retraining
  (with strong QA on label quality, since human reviewers can disagree / have bias).

Key Design Decisions

  1. Two-stage automated pipeline (fast synchronous pre-publish + deeper async post-publish) vs. a single comprehensive check before anything publishes.

    • Chosen: fast pre-publish pass uses only cheap, high-precision signals (hash matching against known-bad content, a small distilled classifier, account/velocity heuristics) to catch obvious violations within the <300ms budget; the deeper, more expensive multimodal/LLM-based classification runs asynchronously after publish for the vast majority of content, with the ability to retroactively pull down content.
    • Alternative: hold every piece of content until the full deep classifier completes before publishing.
    • Trade-off: holding everything for deep review would push publish latency to seconds (unacceptable for real-time social/comment experiences) and would not scale computationally to the full deep model on 100% of 50M/day submissions; the two-stage approach accepts a small window where a violation is technically visible before the async scan catches it (mitigated by keeping that window short and by the fact that severe content — CSAM, known terror content — is caught by the fast hash-match/high-precision path specifically because it cannot wait).
  2. Confidence-threshold routing to human review vs. fully automated decisioning.

    • Chosen: automated classifiers only take unilateral action (remove/limit) at high confidence; medium/low-confidence and inherently ambiguous categories (satire vs. hate speech, context-dependent harassment) route to human review.
    • Alternative: fully automate all decisions to avoid human review cost/latency.
    • Trade-off: full automation is cheaper and faster but produces unacceptable false-positive rates on nuanced categories (context, sarcasm, cultural variation) at global scale, generating user backlash and legal/regulatory risk; human review adds cost (large reviewer workforce) and latency but is necessary for defensibility, appeal-ability, and continuous model-quality feedback. The threshold itself is a tunable dial the platform actively manages — raising automation confidence thresholds over time as models improve, verified via periodic sampling audits comparing automated decisions against human re-review.
  3. Multi-language strategy: native fine-tuned models for top languages vs. translate-then-classify for long tail.

    • Chosen: dedicated fine-tuned classifiers (or well-tested multilingual LLM classification with in-language few-shot examples) for the top ~20 languages covering 95% of volume; a translate-to-a-pivot-language-then-classify fallback pipeline for the long tail.
    • Alternative: rely on a single multilingual model uniformly for all languages.
    • Trade-off: a single multilingual model is operationally simpler but typically underperforms on nuanced, culturally-specific violations (coded hate speech, regional slurs, local context) especially for lower-resource languages; native/dedicated models for high-volume languages give materially better precision/recall where it matters most (95% of volume), while translate-then-classify is an acceptable, cheaper stopgap for long-tail languages where dedicated model investment isn’t justified by volume — accepting somewhat lower quality there is an explicit, monitored trade-off, not a blind spot.
  4. Priority-queue human review (severity-based) vs. FIFO review queue.

    • Chosen: reviewer queue is a priority queue keyed by predicted severity/urgency (imminent-harm and CSAM-adjacent content jump to the front and get near-immediate review or are auto-actioned entirely outside the human queue; low-severity spam/borderline content queues normally).
    • Alternative: FIFO — first flagged, first reviewed.
    • Trade-off: FIFO is simpler and fairer in a naive sense but means a severe, actively-harmful post could sit in queue behind thousands of low-severity spam flags during a volume spike, which is an unacceptable outcome; priority queuing requires reliable severity prediction (itself a model that can be wrong) and risks queue starvation for low-severity items during sustained high-severity volume, requiring a fairness floor (guaranteed minimum throughput for lower-priority queues) to avoid indefinite starvation.
  5. CSAM/imminent-harm as a fully separate, zero-latency-tolerance path vs. folding it into the general severity-priority system.

    • Chosen: hash-matched or high-confidence CSAM/imminent-harm content is hard-blocked automatically and routed to a mandatory legal reporting pipeline entirely outside the standard human review/appeal flow — no publish window, no standard appeal process (subject to legal requirements, not product policy).
    • Trade-off: this removes human judgment/appeal from an entire category, which is deliberate — for this category, legal obligation and the severity of false negatives (content ever being visible) outweighs the cost of occasional false positives on hash-adjacent content, and the reporting obligation is a hard compliance requirement, not a product design choice.
  6. Reviewer tooling and wellness design as an architectural concern, not just a UI afterthought.

    • Chosen: reviewer tooling includes content blurring/progressive reveal for graphic content, mandatory rotation limits (time-boxed exposure to a queue category), model-provided explanations/highlighted spans to speed decisions, and precedent lookup (similar previously-decided cases) to improve consistency.
    • Trade-off: this adds engineering scope beyond “just show content, get a label,” but reviewer accuracy and retention degrade sharply without it (well-documented in industry practice), and inconsistent human labels directly poison the retraining feedback loop — so this is a data-quality and legal-liability investment, not merely a wellness nicety.

Scale Math

  • 50M submissions/day ≈ 580/sec average, assume 3-5x peak multiplier for regional/time-of-day skew ≈ 2,000-3,000/sec peak.
  • Fast pre-publish gate must sustain ~3,000 QPS at <300ms p99 — hash matching against a known-bad DB (bloom filter + exact match, sub-millisecond) and a distilled lightweight classifier (a few ms on optimized inference) comfortably fit; horizontally scaled stateless workers.
  • ~2-5% flagged for deeper scrutiny = 1M-2.5M/day into the async deep-scan/human-review funnel.
  • Of that, assume roughly 20% end up needing actual human review (the rest resolved automatically by the deep async classifier at high confidence) = 200K-500K human review decisions/day. At an assumed average reviewer throughput of ~150-300 decisions/reviewer/8-hour shift (varies hugely by content complexity/severity), this requires roughly 700-3,300 full-time-equivalent reviewer-shifts/day globally — a very large operational workforce, typically distributed across follow-the-sun regional review centers/vendors, which is why automation-threshold tuning (decision #2) has direct, large-dollar operational cost implications, not just a quality knob.
  • Video deep scan: assume average video 60 sec, frame-sampled at ~1 frame/sec plus audio transcript classification; at meaningful video submission volume (say 2M videos/day), this is a substantial GPU compute budget for frame-level image classification at scale — typically batched, not per-video-synchronous, to control cost.
  • Appeal volume: assume ~5-10% of actioned content is appealed = order tens of thousands/day, each requiring a distinct reviewer from the original decision-maker, adding proportional reviewer capacity planning.

Failure Modes & How They’re Handled

  • Human review backlog spike (viral event, coordinated abuse campaign): queue depth balloons past SLA. Mitigated by auto-scaling reviewer capacity where possible (surge staffing/vendor pools), temporarily tightening automated-action confidence thresholds to shed more volume to automation during the spike (with post-hoc audit sampling to catch quality regression), and a fairness floor ensuring high-severity queue never starves regardless of overall backlog.
  • Adversarial evasion (content designed to slip past classifiers — leetspeak, embedding text in images, coded terms): Mitigated with OCR-on-image text extraction feeding the same text classifiers, continuous red-teaming/adversarial-example generation to retrain against known evasion patterns, and cross-signal correlation (account behavior + content + network signals) rather than relying on content classification alone.
  • Reviewer inconsistency/bias poisoning the training feedback loop: Mitigated by inter-rater reliability monitoring (sampling the same content to multiple reviewers, tracking agreement rate), mandatory calibration sessions, and excluding low-confidence/high-disagreement labels from automatic retraining pipelines pending senior review.
  • Regional legal requirement divergence (content legal in one jurisdiction, illegal in another): Mitigated by geo-aware policy configuration in the decision layer — the same content classification confidence can map to different actions (global remove vs. geo-restricted visibility) depending on jurisdiction-specific policy tables, kept as data/config rather than hardcoded logic so legal/policy teams can update without code deploys.
  • False positive at scale during automation-threshold misconfiguration: a bad model deploy or threshold change causes mass wrongful removal. Mitigated by canary rollout of classifier/threshold changes on a small traffic sample with automated false-positive-rate monitoring against a labeled benchmark set before full rollout, plus fast rollback capability and prioritized reprocessing of an incident window if a bad deploy is caught late.
  • CSAM hash-matching pipeline failure (silent outage): the highest-severity path fails open. Mitigated by treating this pipeline as tier-0 critical infrastructure with independent health monitoring, synthetic canary submissions verifying detection continuously, and a fail-closed default (if the hash-match service is unreachable, hold content rather than publish) specifically for this path, even though the general pipeline may fail open elsewhere for availability.

Interviewer Follow-Up Q&A

Q: How do you prevent the human review queue from becoming the bottleneck that determines your entire system’s effective latency? A: By minimizing what actually needs human eyes — investing continuously in raising automated confidence thresholds safely (via the audit/canary process), using human decisions primarily as a feedback signal to improve automation rather than as the default path, and applying priority queuing with a fairness floor so review capacity is spent proportionally to actual risk rather than uniformly across all flagged content. The design goal is a shrinking human-review percentage over time as models mature, tracked as a first-class metric.

Q: How would you handle satire or newsworthy content that technically matches a violation pattern (e.g., graphic war footage in a news context)? A: Context-aware exceptions — a policy layer that allows verified accounts (news organizations, established journalists) or content tagged/labeled with newsworthiness context to route to a specialized review lane with different thresholds, rather than a single one-size rule. This is inherently a human-judgment-heavy category; the architecture’s job is to route it to reviewers with the right expertise/context quickly, not to fully automate it, and to support content warnings/age-gating as a middle ground between full removal and unrestricted publish.

Q: What’s your strategy for languages/dialects where you have almost no labeled training data? A: Translate-to-pivot-language-then-classify as a stopgap (accepting some precision loss, monitored via periodic human-audited sampling specifically for that language), combined with active learning — prioritizing human review sampling from that language’s flagged content specifically to build a labeled dataset over time, and community/regional-partner input for culturally-specific violation patterns a central model would miss. This is explicitly framed as a known gap being actively closed, not a solved problem.

Q: How do you measure whether the moderation system is actually working, beyond raw throughput/latency SLAs? A: Track precision and recall against a continuously-refreshed, independently-audited golden labeled dataset (not just internal-decision agreement, which can be circular); track appeal overturn rate (high overturn rate signals over-aggressive automation); track prevalence metrics (estimated fraction of violating content actually visible on the platform at a point in time, via sampling, not just how much was actioned) since actioned-volume alone can be gamed by over-flagging low-risk content while missing high-risk content.

Q: The system removes content automatically at high confidence — how do you make that defensible/auditable given the appeal and legal exposure? A: Every automated action logs the model version, confidence score, matched category/signal, and (where feasible) an explanation artifact (highlighted span/region that triggered the classification); this audit trail is what the appeal reviewer and any legal/regulatory inquiry uses. Decisions are never “black box only” — the system is architected so any action can be reconstructed and justified after the fact, which is as much a data-retention and logging design requirement as it is a modeling one.