ML System Design · Module 41 of 47 · 7 concepts · about 7 min

The Designs Compared

The fifteen designs side by side: what each predicts, where its labels come from, how fast it must answer and what makes it hard, the handful of patterns they share, and a quick way to map an unfamiliar question onto a design you already know.

At work: The revision page before an interview. Most ML design questions are a variation on one of these fifteen; recognising which one, in the first minute, is half the battle.

All fifteen at a glance

What it is

Each design, reduced to the four decisions that shape it most. Read across a row to recall a design; read down a column to see how the same decision varies.

Why it matters

Seeing them together shows that the hard part differs every time, even when the architecture looks similar.

  • In an interview, naming the hard part early is what earns the deep-dive time.

In the real world: Candidates who revise designs as a comparison, rather than one at a time, report recognising new questions much faster.

Visual example

Designs

Modules 26 to 40.

The fifteen designs: target, labels, speed, hard part
moduledesignpredictslabels fromanswer withinthe hard part
26RecommendationsAdd to basketImpressions, basket events~100 msHuge fan-out; cold start
27Search rankingGraded relevanceClicks + human judgements~150 msQuery understanding
28FraudFraud probabilityChargebacks, reviewers~100 msRare, late labels; adversaries
29Delivery timeMinutes (a percentile)Actual delivery times~50 msAsymmetric cost; live features
30Demand forecastingUnits per store-day (range)Sales, corrected for stock-outsNightly batchCensored demand; millions of series
31Ad clicksClick probabilityClicks on impressionsTens of msCalibration; the auction
32ModerationPolicy violationReviewers under guidelinesMinutesMeasuring misses; evasion
33Visual searchSame productPhoto-product pairs~1 sDomain gap
34Blurring imageryBoxes around faces and platesAnnotated boxesBatch (hours)Recall on tiny objects
35Video searchRelevance to typed textSatisfied watches + judgements~200 msMaking video searchable
36Video recommendationsWatch time and satisfactionWatches, surveys~200 msChoosing the objective
37EventsRegister and attendRegistrations, check-ins~200 msEvery item is new; place and time
38Similar listingsBooked as an alternativeBrowsing sessions, bookings~100 msLearning similarity from behaviour
39Social feedMany actions → one valueInteractions, surveys~300 msValue beyond engagement
40People you may knowAccepted connectionAccepted requestsPrecomputedTwo-hop scale; privacy

Pattern 1: retrieve, then rank

What it is

Recommendations, search, video search, video recommendations, events, similar listings, feed and people-you-may-know all follow the same shape:

  • candidate generation from several cheap sources (embeddings, filters, graph, co-occurrence);
  • a light ranker if candidates are many;
  • a heavy ranker predicting one or more targets;
  • re-ranking for list-level rules (diversity, policy, availability).

What changes is where candidates come from: an embedding index (products, videos), filters (events: place and time), the graph (people), the user's connections (feed).

Why it matters

Recognising the shape frees attention for what is specific.

  • In an interview, draw the cascade in a minute, then spend the time on the candidate sources and labels that make this problem different.

In the real world: Public descriptions from YouTube, Meta, Pinterest, Airbnb and LinkedIn all show this shape with different candidate sources.

Visual example

Pattern

The same skeleton under eight of the fifteen designs.

Retrieve, then rank

  1. cheap sources, in parallel
    EmbeddingsNearest items
    FiltersPlace, time, stock
    GraphFriends of friends
  2. Light rankerThousands → hundreds
  3. Heavy rankerOne or many targets
  4. Re-rankDiversity, policy, availability

Forcing every problem into the cascade. Forecasting, blurring and fraud scoring are not ranking problems; they score one item at a time.

Pattern 2: score one item, then decide

What it is

Fraud, ad clicks, moderation and delivery time score a single item per request, then a decision layer acts:

  • a calibrated probability or a percentile;
  • thresholds or bands set from costs and capacity (fraud review, moderation queues);
  • rules that override the model where policy requires;
  • a fallback when the model cannot answer.

Why it matters

Here the model is only half the system: the decision layer decides what the prediction is worth.

  • Interviewers expect thresholds tied to costs, and capacity limits for human review.

In the real world: Risk, trust-and-safety and ads systems all separate scoring from policy so thresholds can change without retraining (module 3).

Stopping at 'the model outputs a probability'. Without the decision layer the design does not say what happens to the customer.

Pattern 3: batch over everything

What it is

Forecasting and imagery blurring process everything in batch, and so do the heavy parts of people-you-may-know and video ingestion:

  • throughput and total job time matter, not per-request latency;
  • output validation before anything is used (forecasts paused on wild jumps; images audited);
  • partitioned, re-runnable pipelines (module 8) and checkpointed workers (module 15);
  • a fallback to the previous run's output if a run fails.

Why it matters

Batch systems fail differently: not slowly, but by producing a whole bad output at once.

  • Validation gates on the output are their equivalent of a canary release.

In the real world: Nightly forecasting and large media-processing jobs are judged by finishing on time and by output checks, not by milliseconds.

Applying online-serving thinking (latency budgets, replicas) to a batch problem and missing the real risks: deadlines, bad outputs, cost.

Pattern 4: learn a space where similar things are close

What it is

Visual search, video search, similar listings, the retrieval stage of recommendations, and graph embeddings for people all learn embeddings:

  • contrastive training on pairs that should be close (photo and product; query and watched video; listings in one session; connected people);
  • negatives that teach the right distinctions (same brand different size; same market; non-connected people);
  • nearest-neighbour indexes, rebuilt with every model change;
  • cold start by content features or by averaging neighbours.

Why it matters

Most of the design effort goes into what counts as a positive pair and which negatives to use; the network architecture matters less.

In the real world: The same contrastive recipe underlies CLIP, Airbnb's listing embeddings, two-tower recommenders and node2vec, despite very different data.

Choosing easy negatives. The embeddings then learn the obvious (city, category) and fail on the distinctions users care about.

Recognising an unfamiliar question

What it is

In the first minute of a new question, ask four things:

  • one item or a list? A list means retrieve-then-rank; one item means score-then-decide;
  • now or in advance? Live means a latency budget; in advance means a batch pipeline;
  • where do labels come from, and when? This usually reveals the hard part (delay, bias, cost);
  • what does a mistake cost, and to whom? This sets the metric, the threshold and the guardrails.

Then pick the closest of the fifteen and adapt it out loud.

Why it matters

Interviewers vary the domain to stop memorised answers; the four questions transfer to any domain.

  • 'This is like the event design, because every job posting is new and expires' is a strong opening.

In the real world: Interviewers often describe the best answers as 'recognised the shape, then focused on what was unusual about it'.

Visual example

Mapping

Start from the closest, then adapt.

Common questions and their closest design
questionclosest designwhat is different
Job recommendationsEvents (37)Two-sided: employers must want the applicant too
Restaurant recommendationsRecommendations (26)Location and opening hours filter candidates
Spam email detectionModeration (32) and fraud (28)Fast-moving adversaries; very high volume
Surge pricingDelivery time (29) and forecasting (30)The prediction changes behaviour; switchback tests
Music playlist continuationSimilar listings (38)Sequences; listening skips as negatives
Duplicate listing detectionVisual search (33)Pairs across the catalogue, not query to catalogue
Notification rankingSocial feed (39)Sending has a cost; fatigue limits
Self-driving object detectionBlurring imagery (34)Real-time on the vehicle; safety-critical

Saying 'this is the same as recommendations' and reciting module 26. Name the closest design, then say clearly what is different.

Exercise: map five new questions

What it is

A short build that uses this module's ideas. Write it yourself before looking anything up; the checks at the end tell you whether it works.

Why it matters

An idea you have only read fades in a week.

  • Building it once, even in fifty lines, is what makes it yours.
  • Interviewers can tell the difference between someone who has read about a loop and someone who has debugged one.

In the real world: This is the most efficient final-week interview practice: recognising shapes rather than memorising designs.

Your task. For five ML design questions not covered in this course, name the closest design and what must change.

Steps

  1. Pick five: for example 'recommend courses on a learning platform', 'detect fake product reviews', 'predict hospital readmission', 'rank comments under a post', 'estimate a car's resale price'.
  2. For each, answer the four recognition questions: one item or a list; now or in advance; where labels come from and when; what a mistake costs.
  3. Name the closest of the fifteen designs.
  4. List the three most important differences and how each changes the design.
  5. Pick one and present it in 20 minutes, starting with 'this is closest to …, except …'.

You are done when

  • Every question has a stated closest design and three concrete differences.
  • Your presentation reaches evaluation and monitoring within 20 minutes.

Stretch. Ask a friend to choose the five questions for you, so you cannot pick comfortable ones.