Design a Harmful-Content Classification Service
Design data preparation, model training, online inference, review, and feedback for harmful user-generated content.
Problem statement
For this exercise, assume a social product accepts a text post with at most one image and must assign Allow, Review, or Block under a versioned safety policy before broad distribution.
The service should prepare labeled training data, train and release model versions reproducibly, produce an online verdict with reason codes, route uncertain cases to human review, and capture appeal or reviewer outcomes for later learning.
The same content and policy/model version must have one auditable final verdict; model failures must not silently allow content. Author identity, recommendation ranking, law-enforcement workflows, private-message scanning, and generation of moderation policy are outside scope.
For one deployment of this same service, assume a verdict may take up to about one minute after submission while the item stays out of broad distribution, and assume an item earns ad revenue only after it is allowed, so items in Review or Block earn nothing.
In that deployment, explain what your features look like and what the time budget changes in serving. Keep recall high online, then use offline annotation to raise precision, without being so aggressive that most items stop earning.
The meaning of the minute, its percentile, the revenue rule and any feature list are practice assumptions.
What to build
- Classify each submitted text-and-optional-image item as Allow, Review, or Block with policy, model, and reason metadata.
- Route Review outcomes to a human queue and apply one auditable final verdict.
- Prepare versioned datasets from eligible labels, reviewer decisions, and appeals and release reproducible model versions.
- In the one-minute deployment, set versioned thresholds that favor recall, use offline annotation to improve precision, and measure the ad revenue held back by Review and Block outcomes.
At scale
- Assume 1,000 content submissions per second at peak and a tenfold burst for one minute.
- Return an initial verdict within 500 ms at p95 and maintain 99.9% monthly availability.
- Retain verdict and version metadata for one year while raw review samples follow a 30-day retention policy.
- Human-review latency may be minutes, but each queued item must be delivered at least once without losing the final decision.
- Practice assumption: in the one-minute deployment, 99% of items reach a first automated verdict within about one minute of submission. The 500 ms target applies only to the base service.