Preparing your design workspace

Loading the problem and your latest saved attempt…

Redesign a Production Spam Classifier

Diagnose a classifier whose offline accuracy hides poor production recall, then design a robust, cost-aware replacement with safe experimentation and drift monitoring.

Problem statement

For this exercise, assume a job-related messaging product uses a spam and quality classifier before delivery. The current model reports high offline accuracy but performs poorly in production, especially through low spam recall.

Begin with exploratory analysis of false negatives and reproduce the offline-to-production gap using versioned features, predictions, outcomes, delayed labels, and useful traffic slices.

Propose features for a replacement that can recognize conventional spam, language-model-generated content, prompt-injection attempts, and other adversarial content. The online decision may allow, quarantine, or send a bounded subset to human review, and it must retain an access-controlled decision and feedback trail.

Compare a gradient-boosted tree, a compact neural network, a fine-tuned self-hosted language model of roughly one billion parameters, and a hosted language model. Explain training or fine-tuning, leakage and overfitting prevention, latency, throughput, inference and maintenance cost, and a defensible compute comparison using measured operations or FLOPs where meaningful. Optimize spam recall subject to a maximum false-positive or quarantine rate for legitimate messages, and report slice-level quality, latency, throughput, cost, and business loss. Assume twenty million messages per day, a peak of three thousand messages per second, 99.99% availability, and a 150 millisecond p95 online decision target. Only a promoted model and a safe fallback may serve online; other models remain offline candidates.

Design a safe rollout from the current model to the new one. Begin with shadow evaluation, then use a deterministic five-percent treatment whose primary randomization unit is recipient to limit user-level interference; retain sender and message identifiers for analysis and guardrails. Define business metrics, precompute sample size, use a two-sided significance threshold of 0.05, specify rollback guardrails, and stage the ramp. After deployment, monitor feature distributions, calibration, delayed recall and precision, false-negative slices, latency, cost, attacks, data drift, and concept drift against versioned baselines; freeze or fall back when reviewed thresholds are crossed. Prompt-injection defenses, adversarial evaluation, and bounded retention must be part of the design. Broader job-search ranking, account enforcement, and unrelated moderation products are outside scope.

What to build

  1. Reproduce the offline-to-production quality gap and explore false negatives by stable model, feature, label, time, and traffic slices.
  2. Classify each eligible message as allow, quarantine, or bounded human review while recording versioned features, predictions, outcomes, and feedback.
  3. Compare tree, compact neural, self-hosted small language-model, and hosted language-model candidates across quality, adversarial robustness, latency, throughput, compute, cost, and maintenance.
  4. Shadow, randomize, measure, guard, ramp, roll back, and monitor a replacement without silently degrading legitimate-message delivery or spam protection.

At scale

  • For this exercise, assume twenty million messages per day with a peak classification rate of three thousand messages per second.
  • For this exercise, target 99.99% classifier availability and a p95 online decision latency of 150 milliseconds.
  • For this exercise, use deterministic five-percent recipient-level randomization after shadow evaluation, with a two-sided significance threshold of 0.05 and a precomputed sample size.
  • For this exercise, retain access-controlled decision and feedback data only for a bounded policy period and compute delayed quality metrics on versioned cohorts.