AlgoInsight

Free lesson Β· ML System Design Interviews

Overview: The Five-Step Framework

Easy6 min readmachine-learningml-system-designinterview-prep

When you walk into an ML system design interview, you need a mental framework to guide your thinking. Without one, you'll bounce around randomly and confuse yourself (and the interviewer).

Here's our five-step framework that works for almost every ML system design problem:

The Five Steps at a Glance

πŸ” Step 1: The Detective Phase - Clarify Requirements

What: Ask clarifying questions to understand the business problem, constraints, and scale.

Why it matters: This is the most important step. A wrong problem solved perfectly is still wrong.

Questions you'll ask:

Time: 10-15 minutes

πŸ“‹ Step 2: The Framing Phase - Frame the ML Problem

What: Translate the business problem into a clear ML task.

Why it matters: "Increase user engagement" is not an ML problem. "Predict whether a user will click a video" is.

What you'll do:

Time: 5-8 minutes

πŸ“Š Step 3: The Data Phase - Data Preparation & Feature Engineering

What: Discuss where data comes from, how to prepare it, and how to create useful features.

Why it matters: "Garbage in, garbage out." The best model with bad data loses to a simple model with great data.

What you'll do:

Time: 8-12 minutes

🧠 Step 4: The Brain Phase - Model Development & Architecture

What: Choose and design the model architecture.

Why it matters: This is what most people think of as "ML," but it's actually just one piece of the puzzle.

What you'll do:

Time: 10-12 minutes

πŸš€ Step 5: The Ship-It Phase - Evaluation, Deployment & Monitoring

What: Discuss how to evaluate the model, deploy it, and keep it healthy in production.

Why it matters: A model that works offline but crashes in production is useless. A model that works but no one knows it's degrading is dangerous.

What you'll do:

Time: 8-10 minutes

The Full Picture: How the Steps Connect

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Step 1: Detective Phase                                     β”‚
β”‚ "What are we solving? For whom? With what constraints?"     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Step 2: Framing Phase                                       β”‚
β”‚ "What's the ML problem? Inputs? Outputs? ML category?"      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Step 3: Data Phase                                          β”‚
β”‚ "Where's the data? How do we prepare it? What features?"    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Step 4: Brain Phase                                         β”‚
β”‚ "What model? What loss? How to train?"                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Step 5: Ship-It Phase                                       β”‚
β”‚ "How to evaluate? Deploy? Monitor? Retrain?"                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The Five Steps in Action: Recommend Movies

Let's walk through a quick example to see how these steps work together.

Problem statement: "Design a system to recommend movies to users on a streaming platform."

Step 1: The Detective Phase

Candidate: "Before I design a solution, let me understand the problem better. What are our key goals? Are we trying to maximize engagement, retention, or both?"

Interviewer: "Great question. Mainly engagementβ€”we want users to click and watch our recommendations."

Candidate: "How many users do we have?"

Interviewer: "About 100 million monthly active users."

Candidate: "And what's our latency requirement? How quickly do we need to generate recommendations?"

Interviewer: "Under 200ms for the homepage. The recommendations need to appear in the feed instantly."

Candidate: "Understood. One more thingβ€”do we have user behavior data already? Click history, ratings, watch time?"

Interviewer: "Yes, we have 5 years of click data and watch time data."

What we learned: 100M users, <200ms latency, maximizing clicks, we have historical click and watch data.

Step 2: The Framing Phase

Candidate: "So the business goal is engagement through recommendations. The ML problem I'd frame this as: predict the probability that a user will click on a movie recommendation. Inputs are the user's history and movie features. Output is a score between 0-1. This is a ranking problemβ€”we generate top-N recommendations ranked by click probability."

Interviewer: "Good. Could we frame it differently?"

Candidate: "Sure. We could do collaborative filtering where similar users watch similar movies. Or we could predict watch time instead of clicks. But click prediction seems most aligned with our engagement goal."

What we know now: The ML task is click prediction (classification/ranking), and we have a baseline framing.

Step 3: The Data Phase

Candidate: "For data, we'd use historical user-movie interactions. Our features would include: user features (watch history, preferences), movie features (genre, rating, popularity), and interaction features (how long ago they watched similar movies). We'd split the data chronologicallyβ€”train on history before a certain date, validate on recent history, test on the most recent data."

Interviewer: "Why chronological split?"

Candidate: "Because in a real system, we're always predicting the future. If we randomly split data, we'd overestimate performanceβ€”the model would train on data from the future. Chronological split is more realistic."

What we designed: Data sources, feature engineering strategy, and a realistic evaluation approach.

Step 4: The Brain Phase

Candidate: "For the model, I'd start with a simple baseline: logistic regression on engineered features. If that doesn't hit our accuracy targets, I'd explore gradient boosting or neural networks. Given our latency constraint of 200ms, we need fast inference, so deep learning would only work if we can optimize it heavily."

Interviewer: "What loss function?"

Candidate: "Binary cross-entropy since we're predicting click probability (0 or 1). We might also weight the lossβ€”positive clicks might be rare, so we'd upweight them to prevent the model from always predicting 'no click.'"

What we chose: Baseline model with clear trade-offs (simple vs. accurate) and a loss function suited to the problem.

Step 5: The Ship-It Phase

Candidate: "For evaluation, offline we'd measure precision, recall, and AUC on the test set. Online, we'd A/B test the recommendation systemβ€”half of users see our new recommendations, half see the old system. We'd measure click-through rate, watch time, and user retention. For deployment, we'd use a model server to generate predictions in real-time. We'd monitor for driftβ€”if user behavior changes, the model needs retraining. Maybe monthly or on-demand if performance drops."

Interviewer: "What if the model performs great offline but poorly online?"

Candidate: "Good question. That usually means our offline metrics don't capture something real. Maybe our features leak information about future clicks. Or maybe online users behave differently than our training data. We'd investigate the data distribution, adjust features, or collect more recent training data."

What we planned: Full evaluation strategy, real-time serving architecture, and monitoring/retraining approach.

Time Allocation: The Breakdown

Here's the recommended time for a 45-minute interview:

Step Time %
Step 1: Detective Phase 12 min 27%
Step 2: Framing Phase 6 min 13%
Step 3: Data Phase 10 min 22%
Step 4: Brain Phase 10 min 22%
Step 5: Ship-It Phase 5 min 11%
Buffer (Q&A, thinking) 2 min 5%

Key insight: Don't spend equal time on each step! Steps 1, 3, and 4 deserve the most attention. Step 2 and 5 are shorter but critical for showing you understand the full system.

When to Spend More / Less Time

Spend MORE time on:

Spend LESS time on:

πŸ’‘ Tip: If you find yourself in a deep discussion about neural network architectures in minute 30 and haven't talked about deployment, gently steer back: "That's a great point on model complexity. But before we go too deepβ€”I want to make sure we're thinking about the latency constraints. That might actually simplify our model choice. Should we discuss serving first?"

The Framework is a Guide, Not a Straitjacket

You don't have to follow these steps in lockstep order. Sometimes an interviewer will ask you about deployment (Step 5) before you've finished data discussion (Step 3). That's fine! The framework is a mental checklist, not a rigid sequence.

But the five-step mindset should always be there. Every interview, you're answering:

  1. What problem are we solving?
  2. How do we define success in ML terms?
  3. What data powers our system?
  4. What model makes sense?
  5. How does it work in the real world?

Answer those five questions well, and you've nailed the interview.

Back to ML System Design Interviews