KatInterview

Real-Time Harmful Content Screening for an Image-Sharing Platform

Machine LearningModel answer
MediumModel answerMachine Learningml-system-designcontent-moderationclassification

Last updated

Design an ML pipeline that screens uploaded images, captions and links for spam, phishing and unsafe imagery within a tight latency budget while keeping false positives low.

Screening Uploaded Posts for Harmful Content

You are building the safety layer for a large image-sharing platform that stores billions of user posts. Each post has an image, a title and description, and an optional outbound link. Design an ML system that decides, as part of the upload request, whether a post is harmful (spam, phishing, unsafe imagery, and similar).

Requirements

Functional

  • Judge each post using both the image and its metadata (text and link URL).
  • Produce a decision that the upload flow can act on immediately.

Non-functional

  • Latency: the decision must be available within about 200 ms of the upload request.
  • Throughput: thousands of requests per second, with peak bursts above the average.
  • Quality: precision must be high, because wrongly punishing legitimate creators is expensive.

What your answer should cover

  1. Data strategy: where ground-truth labels come from, how you cope with harmful posts being rare, and how you avoid biased evaluation.
  2. Model and pipeline: feature extraction for images, text and links, how you combine them, and which models you pick.
  3. Serving: how the model plugs into the upload path, how you meet the latency target, and what happens when the model is slow or down.
  4. Feedback loop: how user reports and moderator decisions flow back into training and thresholds.
  5. Adversarial robustness: how you stop bad actors from probing the system to find blind spots.

State your assumptions about traffic, base rates and targets explicitly, and discuss the trade-offs behind your choices.

Hints

Hint 1

A yes/no verdict is too coarse. Consider a small set of graded actions (allow, limit reach, send to review, block) so that only very confident cases are blocked automatically.

Hint 2

Split the work: a fast synchronous path made of cheap checks that clears most traffic, and a heavier or slower asynchronous path that can retroactively remove content. Decide in advance whether each failure mode fails open, fails soft or fails closed.

Hint 3

Moderators only see what the model flagged, so the labels are biased by the system itself. Think about how a random audit sample, hard-negative mining and reporter reliability weighting would fix this, and what an attacker can learn from your API responses.