Build a Multimodal Pipeline to Flag and Handle Unsafe Videos
Machine LearningModel answerLast updated
Design an ML-driven system that screens uploaded and already-published videos for policy violations, blends automation with human reviewers, supports appeals, and resists evasion.
Problem
You are asked to design the machine-learning system that keeps a large video-sharing platform safe. It must find videos that break policy, decide what to do with them, and let people challenge those decisions.
Requirements
- Cover several policy areas, for example graphic violence, self-harm, hateful conduct, and sexual content.
- Work in two modes: when a video is uploaded, and on videos that are already live (for example after a user report, a sudden spike in views, a new model, or a policy change).
- Combine automated actions with human reviewers.
- Keep both kinds of error low: harmful videos that slip through, and legitimate videos that get wrongly taken down.
- Support appeals by creators and keep a trustworthy audit trail of every decision.
What to cover
- Scope and scale. State your assumptions (volume, video length, latency targets).
- Architecture. Data flow from upload to final action, and how already-published content is re-checked.
- Model strategy. How you use video, audio, text, and context signals together, and how you keep compute cost under control.
- Labeling and review. Queues, prioritization, label quality, and feedback into training.
- Metrics. What you measure offline and online, and how you handle very low prevalence.
- Appeals and auditability.
- Adversarial evasion. How bad actors try to get around the system and how you respond.
Hints
Hint 1
Start by writing down numbers (uploads per day, average length, frames sampled per second). They will justify a cascade where cheap checks run on everything and expensive models only on a small, uncertain slice.
Hint 2
Not all harms are equal. Think about which categories need recall at almost any cost, which need high precision, and how graduated actions (restrict, reduce reach, remove) plus configurable thresholds let you handle both without retraining.
Hint 3
For metrics, remember that violations are rare. Plain accuracy is useless, and you need an unbiased random sample to estimate true prevalence and recall. For evasion, think about re-encoding, cropping, overlays, and adversarial probing, and how hashing, augmentation, and red-teaming address them.
Model answer
Hard Try it yourself first — then compare your approach, complexity and edge cases.
1. Clarify scope and scale
Assumptions (state them out loud):
- About 5M uploads/day, 5 minutes on average, so roughly 25M video-minutes/day.
- Sampling keyframes at 1 fps gives about 1.5B frames/day, around 17K frames/s on average and about 50K/s at peak.
- Latency: hash matching in under 1 s; upload decision p95 under 5 minutes for videos shorter than 10 minutes. Longer videos stay in a limited-visibility state until fully scanned.
Actions are graduated: allow, age-restrict, warning interstitial, reduce distribution, remove, remove plus account strike, and legal escalation (for example, mandatory reporting for child-safety material).
Error tolerance depends on severity. For child safety and violent extremism, recall dominates. For borderline areas like satire versus hate, precision matters because wrongful removals harm creators. Thresholds must therefore be per category and changeable without retraining.
2. Architecture
Upload -> Transcode -> Feature extraction (frames, audio, OCR, ASR, metadata)
-> Stage 0: hash match vs known-bad DB -> auto-action + legal pipeline
-> Stage 1: cheap per-modality classifiers (everything)
-> Stage 2: multimodal fusion model (flagged/uncertain only)
-> Policy engine (category thresholds x severity x uploader risk)
-> Action service -> allow | restrict | remove | human queue
Published content <- re-scan scheduler (reports, view velocity, new model/policy, hash updates)
Human review -> labels -> training store -> retrain -> shadow eval -> deploy
Appeals -> independent reviewer -> append-only decision log
A cascade is essential: a large video-language model on 1.5B frames/day is unaffordable, so cheap models screen everything and only roughly 5-10% of content reaches the expensive stage.
Core data: a Signal table (model, version, category, score, segment times) and an immutable, append-only Decision table (action, category, source auto/human/appeal, policy version, threshold config version, evidence references). The decision table doubles as the audit log.
3. Model strategy
- Stage 0, hashing. Perceptual video and image hashes against internal and industry-shared databases. Deterministic, high precision, catches re-uploads instantly.
- Stage 1, per-modality models. Frame classifier on keyframes plus a light temporal model on short clips for motion-dependent harms; audio event model plus ASR feeding a multilingual text classifier; OCR on overlays plus title and description; context features such as uploader history and similarity to removed content.
- Stage 2, fusion. A transformer over per-segment embeddings from all modalities, with multi-label outputs and timestamps of violating segments. Fusion matters because many harms appear only in combination (benign footage with a hateful voiceover, or news coverage versus glorification of the same clip). For new policies with few labels, an optional VLM/LLM judge can compare hard cases against the written policy, rate-limited for cost.
- Policy engine. Calibrated scores (for example temperature scaling) go through per-category thresholds kept in versioned config. High-severity: low auto-action threshold and aggressive routing to review. Low-severity: auto-remove only at very high confidence; the uncertain band goes to humans or to "reduce distribution" while pending.
- Training. Shared backbone with multi-task heads. Prevalence is well under 1%, so use focal loss or reweighting and hard-negative mining (video games, boxing, medical footage for the violence head). Augment with re-encoding, crops, and overlays.
4. Labeling and human review
- Queues split by category, language, and region. Priority is roughly P(violation) x severity x projected views, so a likely-viral borderline video outranks an obscure one.
- Label quality: detailed guidelines with examples, seeded gold questions, double review plus senior adjudication on hard cases, and inter-annotator agreement (Cohen's kappa) per category. Low kappa usually points to unclear policy rather than bad reviewers.
- Active learning: sample from the uncertainty band and from model disagreements. Also label a uniform random sample to estimate prevalence and recall without selection bias.
- Reviewer wellbeing: blurred or grayscale default view, muted audio, click-to-reveal, exposure caps, rotation, and counseling.
- Feedback loop: human labels and appeal overturns feed training, tagged with policy version; relabel affected slices when policy changes.
5. Metrics
- Offline: per-category precision-recall curves and PR-AUC (not accuracy), recall at a fixed precision, calibration error, and slice metrics by language, region, and video length.
- Online: prevalence of violating views (views on violating content divided by all views, estimated from the random sample), proactive rate (share of removals found before any user report), time-to-action, reviewer agreement with the model, appeal rate, and overturn rate.
- Guardrails: overturn rate per category and model version. A spike signals a bad model or threshold rollout; roll back via config.
- Roll out new models in shadow mode first, then a small traffic slice, comparing against human-labeled samples.
6. Appeals and auditability
Every decision stores model versions and scores, threshold config version, policy version, evidence segments, and reviewer ID plus rationale. Appeals go to a different, more senior reviewer who does not see the first reviewer's identity, which reduces anchoring. Overturns restore the video, remove strikes, and become training examples. Records are immutable so any past decision can be reproduced and explained for regulators or creators.
7. Adversarial evasion
Typical tactics: re-encoding, cropping, mirroring, speed changes, overlays or borders, splicing harmful clips into benign ones, coded language, misspellings, and probing the system to learn thresholds.
Defenses:
- Hashes and embeddings that are robust to transforms, plus near-duplicate search against removed content.
- Augmentation during training that mimics these transforms.
- Segment-level scoring so a short harmful clip inside a long benign video is still caught.
- Frequent re-scans when models or hash sets are updated.
- Account-level and network-level signals (repeat offenders, coordinated uploads).
- Red-team exercises, and rapid retraining on newly found evasion patterns.
- Limiting feedback to uploaders (generic notices rather than scores) to make threshold probing harder.
8. Trade-offs and common mistakes
- Using one global threshold instead of per-category, severity-aware ones.
- Reporting accuracy or ROC-AUC on a 0.1%-prevalence problem.
- Measuring recall only on items the model flagged (selection bias); you need a random sample.
- Ignoring cost, i.e. running the heavy model on everything.
- Treating moderation as only removal, with no graduated actions, appeals, or audit trail.
- Forgetting reviewer wellbeing and policy versioning.
The central trade-off: more automation lowers latency and cost but raises wrongful removals; more human review improves quality but cannot scale. The cascade, calibrated thresholds, and prioritized queues let you spend human attention where it adds the most value.