KatInterview

Screening Pipeline for Abusive Jobs and Memory Crashes

Machine LearningModel answer
MediumModel answerMachine Learningml-system-designcontent-moderationresource-forecasting

Last updated

Design an ML-backed gate for a shared compute platform that flags abusive submitted code or text and predicts memory-exhaustion crashes, with low latency, high precision, and drift monitoring.

Screening Pipeline for Abusive Jobs and Memory Crashes

You run a multi-tenant data processing platform where users submit jobs made of code, configuration, and sometimes free text. Two kinds of bad jobs need to be caught early:

  1. Abusive or prohibited content. Toxic text, illegal material, malware, crypto-miners, credential theft, and similar misuse hidden in submitted code or text.
  2. Likely memory exhaustion. Jobs that will probably crash with an out-of-memory (OOM) error and waste cluster capacity, or destabilize a shared node.

Design an ML-based screening system that handles both.

Requirements

Functional

  • Low-latency inference suitable for real-time screening at submission.
  • Retraining pipelines that adapt to new abuse patterns.
  • Automated mitigation: reject, warn, throttle, hold for review, or adjust resources.

Non-functional

  • Throughput of thousands of concurrent submissions.
  • High precision, so legitimate but complex code is not blocked.
  • Robustness against users who deliberately try to evade the filter.

Your answer should cover

  • Taxonomy and data: how you define "harmful", and what data you use to train the memory predictor.
  • Modeling: which model families you use for content classification versus resource forecasting.
  • Architecture: the path from submission to decision, and where screening plugs into job execution.
  • Monitoring: how you detect drift, adversarial pressure, and degradation in production.

State your assumptions about scale and latency budgets, and discuss the main trade-offs.

Hints

Hint 1

Treat the two problems differently: content safety is adversarial, memory prediction is cooperative. Share infrastructure (gateway, features, policy engine, feedback loop) but specialize the models.

Hint 2

Not every check has to block the submission. Do cheap, high-confidence checks synchronously, and run expensive or uncertain analysis asynchronously while the job runs in a restricted sandbox.

Hint 3

Memory-crash labels come for free from runtime outcomes, but early-cancelled jobs are censored, and a crash costs far more than over-provisioning. Think about quantile prediction and asymmetric costs.

Hint 4

For monitoring, think about score distributions, reviewer-confirmed precision, appeal overturn rate, and how new confirmed abuse examples can take effect before the next full retrain.