0% completed
Introduction: Classic ML Design Questions
On This Page
The Questions Repeat
The Shape Most of Them Share
What You Should Already Know
The Lessons
Two Words You Will See Everywhere
Before You Start
The Questions Repeat
ML system design interviews cover many products, but several design patterns appear often.
Common examples include recommendations, feed ranking, search ranking, ad click prediction, fraud detection, and harmful content detection.
These questions are useful practice because they cover different data, serving, and evaluation requirements.
Understanding these designs helps you approach related questions, such as job matching. Identify which parts transfer and which requirements need a different solution.
This module teaches them, one lesson at a time.
The Shape Most of Them Share
These systems share ideas, but they do not all use the same architecture.
Recommendations and search often use a funnel: a sequence of stages that reduces a large candidate set. Instead of running an expensive model on millions of items, the system selects a smaller set first.
- Retrieve. A cheap, fast stage selects a few hundred promising items out of millions.
- Rank. A slower, smarter stage scores those few hundred and sorts them.
- Apply the rules. A final layer adjusts the top handful for business reasons: freshness, variety, "don't show two ads in a row."
This funnel is useful for retrieval and ranking. Fraud detection instead scores individual transactions. Harmful content detection can use a cascade that sends selected items to more expensive checks.
Each lesson emphasizes a different set of requirements.
Recommendations introduces multi-source retrieval, ranking, and final rules. Start here.
Feed ranking adds many goals at once. A good post is one you will like, comment on, and not report. Balancing those goals is the main problem.
Search ranking adds a query and position bias. People are more likely to notice results near the top, so clicks do not measure relevance alone.
Ad click prediction adds auction and budget constraints. The predicted probability affects the estimated value of an ad. Its accuracy matters, not just its position relative to other scores.
Fraud detection adds an adaptive attacker. Fraudsters change their behavior to avoid detection. Missed fraud and false declines both have costs, and their relative sizes depend on the transaction.
Harmful content detection adds scale and high stakes. You are filtering the whole platform. A wrong decision in either direction either silences a real user or lets abuse through.
Some of those terms may be new to you right now: position bias, calibration, adaptive adversaries. Do not worry. Each lesson defines its own new idea in plain language before using it.
What You Should Already Know
This module builds on ML Systems Foundations. You should understand features, batch and online inference, evaluation, and monitoring. Each product design chooses the infrastructure it needs; a feature store or online model is not mandatory in every system.
Every design lesson also walks the seven-step framework in the same order. The first seven sections of each lesson are the seven steps, so the order you study is the order you will use in the interview.
Each lesson then ends with an interview kit:
- a 30-second spoken answer, with the follow-ups you are likely to get,
- the common mistakes that weaken an answer,
- two variation questions that apply the same design to a similar product.
The Lessons
| The question the lesson answers | Lesson |
|---|---|
| How do you pick 10 items for a user out of a catalog of 50 million? | Design a Recommendation System |
| What changes when the items are your friends' posts and there are five kinds of "good"? | Design Feed Ranking |
| How does a search query change the funnel, and why are clicks biased? | Design Search Ranking |
| How do predicted probabilities affect ad auctions? | Design Ad Click Prediction |
| How do you design against an opponent who adapts to your model? | Design Fraud Detection |
| How do you catch harmful content at web scale without silencing real users? | Design Harmful Content Detection |
| Can you run the whole funnel on a fresh problem? | Capstone: People You May Know |
Two Words You Will See Everywhere
Two terms appear throughout the retrieval and ranking lessons.
1. Candidate generation, also called retrieval, is the first stage of the funnel.
It cheaply pulls a few hundred items that might be a good fit out of the whole catalog. It usually does this with a precomputed index, or by finding items whose embeddings sit close together. An embedding is a list of numbers that captures what an item is about, and items the model treats as similar get similar numbers.
Its job is recall: of all the items the user would have wanted, how many made it through this stage?
If the right item is not pulled here, nothing later can recover it. Ranking can only sort what retrieval hands it.
2. Ranking is the second stage.
It scores those few hundred items with a richer model and sorts them by predicted value. Value means whatever the product cares about: a click, a watch, a new connection, a purchase.
Its job is precision at the top: of the few items you show first, how many are actually good? The user sees only that top handful, so this is where ranking quality matters most.
Before You Start
Pick a product you use that has a feed or recommendations. Then answer three quick questions.
- Roughly how many items are in its catalog, and how many do you see in one session? This difference explains why candidate selection matters.
- Name three interactions the app could use, with appropriate permission, to improve recommendations.
- Think of an irrelevant item it showed you. A retrieval failure means better items existed but were not selected as candidates. A ranking failure means better candidates were selected but ranked too low. You would need logs or experiments to determine which occurred.
Reading Progress
0%
On This Page
The Questions Repeat
The Shape Most of Them Share
What You Should Already Know
The Lessons
Two Words You Will See Everywhere
Before You Start