The Classic ML System Design Interview: Designing a Ranking or Recommendation System
A 7-step answer for the ML system design interview on recommenders, from objective to drift, plus a scored weak vs strong answer and six practice prompts.

Last updated: November 2026.
Quick answer: Answer in seven steps: define the objective, describe the data and labels, generate candidates, rank them, pick metrics such as precision@k and NDCG, design serving, and plan monitoring for drift. Treat candidate generation and ranking as separate stages with separate models. Spend the most time on the objective and the metrics, since every later choice depends on them.
The prompt can fit on one line: design the home feed for a short-video app. Drawing a box for candidate generation and a box for ranking takes a minute. The rest of the round tests whether you can say what each box is trained to predict and how you'd know the whole thing works.
If your loop also has a GenAI design round, the LLM system design guide covers that one. This post covers the older question: ordering items for each user with models trained on what users did before. Prepare it whenever the team you're interviewing with owns a feed or a search page, even if the job post talks mostly about LLMs. Those products still have to decide what each user sees first.
What Does the ML System Design Round Test?
Behind the diagram, the interviewer is checking four skills:
- Turning a product goal into a label. "Show people videos they'll like" has to become a number the model predicts for every user and video pair.
- Knowing why the system has stages. You can explain what breaks if you run your heaviest model on the whole catalog.
- Matching metrics to the goal. Offline numbers help you iterate, and an online test makes the call.
- Thinking past launch. The model changes what users see, which changes the data it trains on next.
Notice what's missing from that list: the model architecture. Architecture names are the easiest part of this topic to memorize, so they're the weakest signal you can send. Say "two-tower model" in your first three minutes and expect the next question to be what it's trained to predict. Have that answer ready before you name anything.
What Is the 7-Step Answer Skeleton?
Talk in this order. The minutes assume a 45-minute slot and leave a few spare for the interviewer's detours.
| Step | What you decide | Rough minutes | Follow-up to expect |
|---|---|---|---|
| 1. Objective | What "good" means for the product, and the label the model predicts | 7 | "Why not just optimize clicks?" |
| 2. Data and labels | Which logged events become positives and negatives | 5 | "Where do your negatives come from?" |
| 3. Candidate generation | How to cut a huge catalog to a short list, fast | 5 | "What happens to a video uploaded an hour ago?" |
| 4. Ranking | Which model orders the short list, using which features | 6 | "Why that model over a simpler one?" |
| 5. Metrics | Offline metrics for each stage, then the online test | 8 | "Offline NDCG went up and the A/B test went down. Why?" |
| 6. Serving | How the system answers inside the latency budget | 5 | "Which parts can you precompute?" |
| 7. Monitoring and drift | What you watch after launch, and when you retrain | 6 | "What feedback loop did you just build?" |
If the objective is wrong, every box after it optimizes the wrong thing very efficiently. That's why the objective and metrics rows get the most minutes.
How Do You Turn a Vague Prompt Into an Objective?
Ask what the product team wants more of, and get the setting before you draw anything:
- What should grow? Watch time? Purchases? Pick one primary goal.
- Where does the list appear? A full-screen feed and a row under a product page call for different designs.
- How big is the catalog, and how fast does it change? New items every second is a different problem from a catalog that changes weekly.
- What's the latency budget? You'll need this number in step 6.
Then pick a proxy you can log, and say what it gets wrong. Clicks are the obvious proxy and a bad one on their own: a click-only model learns to promote thumbnails that earn a tap and lose the viewer seconds later.
A stronger setup predicts a few outcomes for each user and video pair:
- the chance they start watching
- the expected watch time if they do
- the chance of a hide or a report
The final score combines them with weights: reward expected watch time, and subtract a penalty for a likely hide. Say out loud that the weights are a product decision you'd revisit after the A/B test.
Then name your guardrails, the metrics that must not get worse even when the main one improves. Hide rate is one. The share of views going to new creators is another, if the product depends on new creators sticking around.
Seven minutes on this feels slow. Spend them anyway, because the label and the metrics both come from this step.
What Data and Labels Do You Need?
Everything the model learns comes from logs, so describe the logs before the model. Start with a record of every time an item was shown to a user, whether or not they touched it. Each row should hold:
- the user and the item
- the position it was shown in
- the time and the surface, such as the home feed or search
- the outcome, such as seconds watched or a hide
Without those rows you only have positives. A click log shows what people chose and nothing about what they scrolled past, and what they scrolled past is where your negatives come from.
Then raise the problem hiding in those logs before the interviewer does: the top slot gets clicks partly because it's the top slot. Google's Rules of Machine Learning puts it plainly in Rule #36: "If you put an app in the first position it will be clicked more often, and you will be convinced it is more likely to be clicked." The remedy it describes is to train with the display position as a feature, then give every candidate the same default position at serving time, because you score candidates before you've decided their order.
Two more problems deserve a mention:
- Delayed labels. A purchase can land days after the impression that caused it. Decide how long you wait before you count an impression as a negative.
- Cold start. New users have no history and new items have no engagement. For a new user, start from sign-up choices and location, and fill the gaps with popular items. For a new item, use content and creator features.
Why Split the System Into Candidate Generation and Ranking?
Your most accurate model is too slow to run on every item in the catalog for every request. So a fast first stage cuts the catalog to a short list, and a slower model orders only that list. Google's recommendation systems course describes the same shape with one more pass at the end:
- Candidate generation "narrows down a large pool of potential recommendations to a smaller subset for further evaluation."
- Scoring runs a more precise model on that smaller set.
- Re-ranking applies final constraints, such as removing items the user explicitly disliked or boosting fresher content.
How does candidate generation find a short list fast?
Use several cheap sources and merge their results. Each one catches items the others miss:
- Embedding neighbors. Train a model that places users and items in the same vector space, then pull the items nearest the user from an approximate nearest-neighbor index.
- Co-engagement. Items that people who watched this user's recent videos also watched.
- Fresh and trending. A reserved slice for new uploads, so they can collect the engagement the other sources rely on.
- Follows. Recent items from accounts the user chose to follow.
Judge this stage by recall: of the items a user went on to engage with, how many made it onto the short list? Poor recall caps the whole system, because the ranker can only reorder what it receives.
How should the ranking model work?
The ranker sees only the short list, so it can afford heavier features:
- User features, such as long-term interests and what they watched this session
- Item features, such as length and how well it's doing so far
- Cross features, such as whether this user has finished this creator's videos before
- Context, such as device and time of day
Start with a baseline you can defend. A gradient-boosted tree model on those features is a respectable first ranker, and proposing it first shows judgment. Rule #4 of Google's Rules of Machine Learning makes the same argument for starting simple: "Keep the first model simple and get the infrastructure right." Then say what would justify a neural ranker, such as enough data to learn useful embeddings, or the need to predict all three outcomes from step 1 with shared layers.
Which Metrics Should You Name, and Where?
Name a metric for each stage, then say how the online test settles it. Offline metrics let you iterate quickly, and the A/B test makes the decision.
| Metric | What it tells you | Where it fits |
|---|---|---|
| Recall@k | How many of the items a user later engaged with made the short list | Candidate generation |
| Precision@k | How many of the top k slots held something relevant | Ranking, when relevance is yes or no |
| NDCG | Whether the most relevant items sit highest, with graded credit | Ranking, when some engagements are worth more than others |
| Log loss or AUC | Log loss checks how accurate each predicted probability is; AUC checks how well the predictions rank positives above negatives | Each prediction the ranker makes |
| Online A/B test | Whether users do more of what you care about, with guardrails intact | The launch decision |
Be ready to explain NDCG without a formula. Each result earns credit for how relevant it is, and that credit shrinks on a logarithmic scale the lower the result sits. The total is divided by the score of the best possible ordering, so a perfect ranking scores 1 and you can compare across users with different numbers of relevant items. Precision@k is blunter: it counts relevant items in the top k and ignores their order, so it can't tell a hit in slot 1 from a hit in slot 10.
Then prepare for the follow-up in row 5 of the skeleton: offline NDCG went up, and the A/B test came back flat or worse. Have a reason ready. Your offline test set was logged under the old model, so it only holds reactions to items the old model chose to show. A new model that surfaces different items gets graded on data that barely covers them. Two other answers worth having: the offline label didn't match the online goal, or features were computed one way in training and another way in serving.
If the A/B testing side is your weak spot, what data science interviews test in 2026 covers the edge cases, like guardrail metrics and many tests running at once.
How Do You Serve Recommendations Within the Latency Budget?
Take the latency budget from step 1 and spend it stage by stage.
- Precompute what changes slowly. Item embeddings can be computed in batch and loaded into the nearest-neighbor index ahead of time.
- Fetch what changes fast at request time. A user's last few watches and the session context come from a low-latency feature store.
- Log the features you served. Rule #29 of Google's Rules of Machine Learning: "The best way to make sure that you train like you serve is to save the set of features used at serving time, and then pipe those features to a log to use them at training time."
- Plan the fallback. If the ranker times out, serve the short list in a cheap order, such as by popularity, so the user still gets a feed.
Logging served features also means the model trains on the same values it sees live, which removes one common cause, feature skew, behind the row 5 follow-up.
What Should You Say About Monitoring and Drift?
An answer that ends at "deploy the model" hands the end of the round to the interviewer's questions. Cover what you'd watch:
- Inputs. Feature distributions compared with the training data, so a broken pipeline or a shift in who uses the app shows up before the metrics drop.
- Outputs. The spread of predicted scores, and the share of the feed going to new items.
- Outcomes. The primary metric and guardrails from step 1, on a dashboard someone actually checks.
- Model age. How stale the training data is, with a retraining schedule matched to how fast the catalog changes.
Then name the feedback loop you created. The model decides what people see, and people can only engage with what they see. Tomorrow's training data is made of those engagements, so the system drifts toward recommending more of what it already recommends. One fix is a small exploration slice: a share of traffic where some candidates get boosted or shuffled, with the probability of showing each one logged, so the model can learn about items it would never have picked.
What Does a Weak Answer Look Like Next to a Strong One?
Same prompt for both: design the home feed for a short-video app with a catalog of several million videos. The scores use an illustrative 1 to 4 scale for each step, and both answers are hypothetical.
| Step | Weak answer | Score | Strong answer | Score |
|---|---|---|---|---|
| Objective | "Maximize clicks" | 1 | Predicts starts, watch time and hides, combined with tunable weights, plus guardrails | 4 |
| Data and labels | "Use each user's history" | 2 | Logs every item shown with its position, defines negatives, handles delayed labels | 4 |
| Candidate generation | Skipped; scores the whole catalog | 1 | Merges embedding neighbors, co-engagement, fresh uploads and follows, judged by recall | 4 |
| Ranking | "A deep neural network" | 2 | Gradient-boosted baseline first, with a reason to move to a multi-output neural ranker | 3 |
| Metrics | "Accuracy" | 1 | Recall@k, NDCG and log loss offline, then an A/B test with guardrails | 4 |
| Serving | "Put it behind an API" | 2 | Precomputed embeddings, request-time features, logged features, a fallback | 3 |
| Monitoring and drift | Not mentioned | 1 | Input and output drift alerts, an exploration slice, a retraining schedule | 4 |
| Total | 10 / 28 | 26 / 28 |
The weak answer stops at the first layer of every step. It names a model and an API and never says how either could fail. The strong answer uses the same building blocks and attaches a reason and a risk to each one. The widest gaps sit in the rows a memorized diagram can't fill, like the objective and monitoring.
What Should You Practice?
Here are six original prompts, written in the style of scenarios candidates describe in public interview write-ups. Give each one a 45-minute sitting out loud, and reach metrics by minute 25.
- "Customers also bought." An online store wants a row of related items under each product. (Tests item-to-item candidates, and what counts as a positive when purchases are rare.)
- A weekly "jobs for you" email. A job board sends each seeker ten openings a week. (Tests labels that arrive weeks later, and matching on both sides, since the employer has to want the candidate too.)
- People you may know. Suggest new connections on a professional network. (Tests graph-based candidates, and where the privacy line sits on which signals you may use.)
- Marketplace search. Order the results for a query on a secondhand marketplace. (Tests query-dependent features and position bias in the click logs.)
- A brand-new user's first feed. Someone just installed a short-video app and has watched nothing. (Tests cold start, and how fast the system should learn from the first few swipes.)
- Watch time fell after a retrain. The new ranker beat the old one offline, and a week after launch watch time is down. Diagnose it. (Tests whether you check the offline test set and the serving features before blaming the model.)
Rehearse number 6 twice. Start from what changed between the offline test and live traffic, using the metrics and serving sections above, before you question the model itself.
The 4-week AI/ML interview plan alternates classic and LLM designs in its third week, and these six prompts can fill its classic days.
How Does PokeBot Fit In?
Reading builds your vocabulary. Saying the design out loud while someone pushes back is what the round tests.
- The reading half. The AI/ML Engineer Interview Workbook has 21 questions with original worked solutions, restated from publicly shared interview experience. Its ML System Design & Applied Cases chapter is the one for this round.
- The speaking half. In the app, set your target role (the AI/ML interview prep page shows how), then start a Technical session in Interview Practice and answer in Audio Mode. Add the six prompts above under "I have my own interview questions," and turn on follow-up questions so the interviewer presses on your answers. Every session is scored. For a harder run, set Interviewer Style to Challenger, which pushes back on almost every answer.
Do one prompt a day in the week before your loop, and redo whichever one scored lowest.
Frequently Asked Questions
How do I answer a machine learning system design interview for a recommender?
Work through seven steps in order: the objective, the data and labels, candidate generation, ranking, metrics, serving, and monitoring for drift. Spend the most time on the objective and the metrics, since every later choice depends on them. Keep candidate generation and ranking as separate stages with separate models, and finish by naming the feedback loop your system creates.
What is the difference between candidate generation and ranking in a recommender?
Candidate generation cuts a huge catalog down to a short list quickly, using cheap sources such as embedding nearest neighbors, co-engagement, and fresh or trending items. Ranking then scores only that short list with a slower, more accurate model and richer features. Judge candidate generation by recall, because the ranker can only reorder what it receives, and judge ranking with metrics such as NDCG.
What metrics should I mention in a recommendation system design interview?
Name metrics per stage: recall@k for candidate generation, precision@k or NDCG for ranking, and log loss or AUC for each prediction the ranker makes. Then say an online A/B test makes the launch decision, with guardrail metrics such as hide rate that must not get worse. Add that offline gains can vanish online, for example because the offline test set was logged under the old model, or because the offline label or serving features differ from what you trained on.
How do I explain NDCG in an interview without a formula?
Each result earns credit for how relevant it is, and that credit shrinks on a logarithmic scale the lower the result sits in the list. The total is then divided by the score of the best possible ordering, so a perfect ranking scores 1 and you can compare results across users or queries that have different numbers of relevant items.
Why shouldn't a recommender optimize for clicks alone?
Clicks reward items that earn a tap and lose the viewer seconds later, so a click-only model learns to promote bait. A stronger objective predicts several outcomes for each user and item, such as the chance they start watching, the expected watch time, and the chance of a hide or report, then combines them with weights the product team can tune. Guardrail metrics catch what the weights miss.
How do you handle cold start in a recommendation system design answer?
For new users, start from the signals you do have, such as choices made at sign-up and location, and fill the gaps with popular items until the first interactions arrive. For new items, use content and creator features, and reserve a slice of candidates for fresh uploads so they can collect the engagement other sources depend on. Then say how quickly the system starts learning from a new user's first few interactions.
Is classic ML system design still worth preparing now that GenAI design rounds exist?
Yes, whenever the team you're interviewing with owns a feed or a search page. Those products have to order items for every user, and that ordering problem is what the classic round tests. For an LLM-focused role, prepare one classic design and one GenAI design, since the evaluation and monitoring questions carry over between them.
How can PokeBot help me prepare for an ML system design interview?
PokeBot's AI/ML Engineer Interview Workbook has 21 questions with original worked solutions, including an ML System Design & Applied Cases chapter. In the app, start a Technical session in Interview Practice, answer in Audio Mode, add your own design prompts under 'I have my own interview questions', and turn on follow-up questions so the interviewer presses on your answers. Every session is scored.