KatInterview

ML Infrastructure for Real-Time Engagement Prediction

Machine LearningModel answer
MediumModel answerMachine Learningml-systemsfeature-engineeringinference-architecture

Last updated

Build an end-to-end platform for predicting user engagement likelihood, covering feature pipelines, online/offline stores, training workflows, and high-throughput inference.

Problem

You're designing infrastructure for a machine learning system that predicts whether a user will engage with content (such as leaving a comment on a social media post). Your interviewer clarifies that you should treat the predictive model itself as given—your focus is on the platform and infrastructure that surrounds it.

Scope

Design a production system that handles:

  • Offline components: generating training datasets, orchestrating model training, versioning artifacts
  • Online components: serving predictions in real-time at scale, fetching features with low latency
  • Feature infrastructure: managing features across batch and streaming pipelines, maintaining consistency between training and serving
  • Operational concerns: monitoring model and data health, handling failures gracefully, supporting experimentation

Context and Constraints

Make reasonable assumptions, but state them explicitly. Consider:

  • Scale: The system serves predictions for a high-traffic consumer application (tens of thousands of requests per second at peak)
  • Latency: End-to-end prediction latency must stay within 50–150 ms at p95
  • Feature freshness: Some signals need near-real-time updates (within seconds or minutes)
  • Consistency: Training data must reflect what the model actually sees during inference
  • Cold start: The system must handle new users and new content gracefully
  • Iteration: Support safe model rollout, A/B testing, and rapid experimentation

What to Cover

Explain your approach to:

  1. Event collection and labeling: What data gets logged, how labels are defined and joined
  2. Feature management: Batch vs. streaming features, online/offline stores, preventing training-serving skew
  3. Training workflows: Dataset construction, versioning, evaluation, promotion criteria
  4. Serving architecture: Real-time vs. batch inference, caching strategies, fallback mechanisms
  5. Production operations: Monitoring (data quality, model performance), retraining triggers, reliability patterns

Be concrete about trade-offs and failure modes. The interviewer may drill into any component.

Hints

Hint 1

Think about how to ensure features computed offline for training exactly match those fetched online during inference

Hint 2

Consider which features can be precomputed vs. must be computed per-request, and how caching reduces load

Hint 3

Plan for what happens when feature lookups time out or models fail—graceful degradation matters at scale