SDSystem DesignConcepts to case studies
System DesignDSA
x
0/311
Part 1: Foundations
Part 2: APIs and Communication
Part 3: Caching
Part 4: Data and Storage
Part 5: Architecture
Part 6: Distributed Systems
Part 7: Advanced Data Topics
Part 8: Operations and Security
Part 9: Estimation and Interview Method
Part 10: Case Studies
  • Design Ride Sharing (Uber/Lyft)
  • Design a Payment System
  • Design Ticket / Hotel Booking
  • Design a Search Engine
  • Design Google Maps
  • Design a Collaborative Editor (Google Docs)
  • Design a Metrics and Monitoring System
  • Design a Distributed Message Queue (Kafka-like)
  • Design an E-commerce System (Amazon)
  • Design a Content Recommendation System (YouTube/Netflix)
System Design/Case Studies/Hard
Interview case study

Design a Content Recommendation System (YouTube/Netflix)

Pick the few items worth showing out of millions: candidates, ranking, fresh feedback and cold start.

⏱ 38 min readHard case studyAdvanced25 cross-questionsHas visualizer
Prompt60-sec answer45-min plan1 Clarify2 Estimate3 API + Data4 Design5 Deep dives6 Scale7 Wrap upCross-questionsVariationsScoringMistakesCheat-sheet

StartThe prompt and what is really being tested

The interviewer says

“Design a content recommendation system, like the home page on YouTube or Netflix.”

It is short on purpose. Your first job is to make it specific.

What they checkWhy it matters
Scoping a broad prompt“Recommendations” can mean a model, a pipeline, a UI, or a whole company. A strong candidate says which part they design (the system that retrieves, ranks, learns and serves) and what they leave out.
The funnel ideaYou cannot score 100 million items per request. Cheap retrieval, then a heavier ranker, then re-ranking is the core answer. The interviewer wants the numbers that force it.
Data and feedback loopsWhat you log (especially what was shown) decides what you can learn. Training and serving must see the same features. The system also trains on its own output, which biases it.
Cold start and freshnessNew users and new items have no history. A design that only works for warm users and old items fails the first follow-up.
Operating a learning systemModels drift, deployments go wrong quietly, and offline metrics lie. Experiments, guardrails, fallbacks and cost are part of the design.

TL;DRThe whole design in 60 seconds

Recommendations are a funnel: from 100 million items, a few cheap retrievers pick about 2,000 candidates, a small model trims them, a heavier ranker scores a few hundred, and a re-ranker adds variety and rules to give the 30 items shown. All of it must finish in about 200 ms.

  • Scale: 200M daily users, about 50,000 home-page requests a second at peak, and about 1 million feedback events a second at peak.
  • Retrieval: several sources in parallel (similar to the user through embeddings and nearest-neighbour search, similar to what they watched, trending, new from subscriptions). Anything dropped here can never come back.
  • Ranking: a model predicts watch time or click probability from user, item and context features, read from an online feature store that matches the one used for training.
  • Learning loop: log every impression with its position and a request ID, stream events to a log, compute fresh features within minutes, and retrain on a schedule. Ship every model through an A/B test.
  • Cold start: new users get popular and context-based lists, new items get content-based vectors and a small exploration budget.
  • Honest limits: offline metrics are only a filter, the system feeds on its own choices, and the objective (clicks versus satisfaction) is a product decision, not a technical one.
💡How to use this page
Read the 60-second answer first. Then work through steps 1 to 7 in order, and try each step yourself before reading the model answer. Finish with the cross-questions: say your answer out loud, then open the model one.

PlanA 45-minute plan

4
3
4
8
16
7
3
Minutes per step (total 45). A guide, not a rule: move time to the part the interviewer cares about.
StepMinutesWhat to get done
1. Clarify4Scope hard: home page only. Objective, scale, freshness, cold start, what is out.
2. Estimate3Requests per second, events per second, embedding size, candidates times requests.
3. API and data4Get recommendations, log events. Interactions, features, embeddings, models.
4. High-level design8Online funnel and offline training loop. One request, one event.
5. Deep dives16The funnel and budget, embeddings and nearest-neighbour search, features and feedback, cold start, experiments.
6. Scale and failures7Feature store down, slow ranker, bad model, cost, privacy deletion.
7. Wrap up3Recap, trade-offs, what you would build first.

Step 1Clarify requirementsabout 4 min

🤔
Pause. Try it yourself first
You have 60 seconds. This prompt is huge, so write down what you will NOT design before you write what you will. Then five questions: what is shown, what counts as success, how many users and items, how fresh, and who has no history.

Questions to ask, and why

AskWhy you ask itTypical answerHow it changes the design
Which surface: the home page, an “up next” list, search results, or all of them?Each has different inputs and latency. Search has a query. Up next has a current item. Home has only the user.The home page for logged-in users. “Up next” uses the same engine with a seed item.One service with a surface parameter. Home is the main design.
What is the goal: clicks, watch time, or something harder to measure like satisfaction?The objective shapes labels, the model and the failure modes (clickbait).Long-term engagement, approximated by watch time with guardrails for satisfaction and variety.The ranker predicts several outcomes and a blend score. Guardrail metrics are part of every experiment.
How many daily users, how big is the catalog, and how often do new items arrive?Decides whether we can score everything and how fresh the index must be.200M daily users, 100M items, about 100,000 new items a day.Scoring everything is impossible. A funnel is required, and new items need a fast path.
How many home-page requests and how many feedback events a day?Sets serving and logging capacity.About 5 requests per user per day, and about 100 events per user per day.About 50,000 requests a second at peak, and about 1 million events a second at peak.
What is the latency target?It fixes the budget for retrieval plus ranking.Under 200 ms at p99 for the response, with a cheaper fallback if something is slow.A stage-by-stage time budget, timeouts, and a popularity fallback.
How fresh must recommendations be? If I watch a video, when should the next page change?Decides whether we need streaming features or only a nightly job.Within a few minutes for recent activity. New items should appear within an hour.A nearline path (stream processing) for recent-activity features and a small real-time index for new items.
What about new users and new items with no history?Cold start is where simple designs break.Both must work from day one, in a reasonable way.Popular and context-based fallback for users, content features and exploration for items.
Do I design the model itself, or the system around it?Prevents an hour of model theory.The system: retrieval, features, serving, logging, training pipeline, experiments. Treat models as black boxes with a known input and output.We name model types, but spend time on data flow, latency and operations.
Are there safety, region and policy rules?Filters must run in the pipeline, not only in the model.Yes: age ratings, regional licensing, blocked content, and user “not interested” signals.Hard filters before ranking and a policy check after re-ranking.
Is video delivery, search, ads or moderation part of this?Scoping out loud saves time and shows judgement.No. Video delivery, search and ads are separate systems.We link them and leave them out.

Write the scope on the board

Functional (must do)
  • •Return a ranked list of about 30 items for a user and surface
  • •Record impressions, clicks, watch time and explicit feedback (like, not interested)
  • •Keep recommendations fresh using recent activity and new items
  • •Work for new users and new items (cold start)
  • •Apply filters: already watched, blocked, region, age rating
Non-functional (how well)
  • •Latency: under 200 ms at p99 for a recommendations request
  • •Availability: 99.99%. A weaker list is better than an empty page
  • •Scale: about 50,000 requests and 1 million events a second at peak
  • •Freshness: recent activity within minutes, new items within an hour
  • •Quality changes are measured by A/B tests, never shipped on offline metrics alone
Out of scope (say it)
  • •Video storage, transcoding and delivery (see Design Video Streaming)
  • •Search and query understanding (see Design a Search Engine)
  • •The ads auction
  • •Training algorithm research (we design the pipeline around the models)
  • •Content moderation (we only consume its decisions)
🎤
Say it out loud
“Let me narrow this. I will design the home-page recommendation system for logged-in users: the service that retrieves candidates, ranks them, adds variety and policy rules, and the loop that logs feedback and retrains. Roughly 200 million daily users, 100 million items, 50,000 requests a second at peak and under 200 milliseconds. The goal is long-term engagement, using watch time with guardrails. I will treat the models as black boxes and spend my time on data flow, latency and operations. Video delivery, search, ads and moderation are separate systems. Does that match?”

Step 2Estimate the scaleabout 3 min

🤔
Pause. Try it yourself first
On paper: requests a second, events a second, how big are the vectors, and how many item scorings a second if each request scores 2,000 candidates? Which number forces the funnel?

Assumptions (say them first)

AssumptionValue
Daily active users200 million
Home-page requests per user per day5
Feedback events per user per day (clicks, plays, watch pings, likes)100
Catalog size, new items per day100 million items, about 100,000 new a day
Peak compared to average4 times
Average event size in the log100 bytes
Embedding128 numbers, 4 bytes each (float32)
Candidates after retrieval, and kept for the heavy rankerabout 2,000, trimmed to about 500
Features per scored itemabout 50
Items returned per request30

The arithmetic, line by line

WhatMathsResult
Requests per day200M × 51 billion
Requests per second (average, peak)1B ÷ 86,400 ≈ 11,600, × 4about 12,000 and 46,000 (call it 50,000)
Events per day200M × 10020 billion
Events per second (average, peak)20B ÷ 86,400 ≈ 231,000, × 4about 230,000 and 925,000 (call it 1 million)
Event log per day, per year with 3 copies20B × 100 B = 2 TB; × 365 × 32 TB a day, about 2.2 PB a year with copies (plus about 0.6 TB a day for the lists of items shown)
Log ingest bandwidth (average, peak)231,000 × 100 B; 925,000 × 100 Babout 23 MB/s and 93 MB/s (about 10 partitions at 10 MB/s, so plan for 30 or more)
User embeddings200M × 128 × 4 Babout 102 GB (about 26 GB at 1 byte per number)
Item embeddings100M × 128 × 4 Babout 51 GB (about 13 GB at 1 byte per number)
Scoring everything per request (not possible)100M items × 46,000 requests a second4.6 trillion scorings a second, so a funnel is required
Heavy ranker work with 2,000 candidates2,000 × 46,00092 million scorings a second, and 2,000 × 50 = 100,000 feature values per request
Heavy ranker work after trimming to 500500 × 46,00023 million scorings a second, 25,000 feature values per request
Nearest-neighbour queries and nodes46,000 queries a second ÷ 2,000 per replica (assumed)about 23 replicas, so about 25 of the item index
What the numbers tell us about the design
  • •Scoring the whole catalog would be 4.6 trillion scorings a second. The funnel is not an optimisation, it is the only way the system works at all.
  • •The vectors are small. 51 GB of item embeddings fits in memory on a few machines, and 13 GB with one byte per number. Nearest-neighbour search is a memory and CPU problem, not a storage problem.
  • •The ranker is the cost centre. 2,000 candidates is 92 million scorings a second. Trimming to 500 with a cheap model cuts that by 4 times, which is why the funnel has more than two stages.
  • •Events are the biggest data: 2 TB a day, about 2 PB a year with copies. Impressions (what was shown) are cheap to log from the server and are the most valuable rows for training.
  • •New items arrive at about 1 a second, which is tiny. Freshness is a small side index, not a rebuild of the big one.
🎤
Say it out loud
“The maths forces the design. 200 million users with 5 visits a day is a billion requests, about 12,000 a second and 46,000 at peak. Scoring the whole catalog of 100 million items for each would be 4.6 trillion scorings a second, so we need a funnel. Embeddings are small, 51 gigabytes for the items, so nearest-neighbour search fits in memory. If I send 2,000 candidates to the heavy ranker it is 92 million scorings a second, so I trim to 500 with a cheaper model first. And 100 feedback events per user is 20 billion a day, 2 terabytes, which is the data that keeps the models learning.”

Step 3Define the API and the data modelabout 4 min

🤔
Pause. Try it yourself first
Write the two calls that matter: ask for recommendations, and report what happened. What must the response contain so that the next event can be tied back to the exact list that was shown?

Endpoints

MethodPathRequestResponseNotes
GET/v1/recommendations?surface=home&n=30&cursor=none200 { requestId, modelVersion, items: [{ itemId, position, reason }], nextCursor }Auth required. requestId and modelVersion are for logging and debugging. The cursor holds a session seed so page 2 continues the same ranking. Falls back to a popular list rather than an error.
POST/v1/events{ events: [{ type, itemId, position, requestId, ts, watchMs? }] }202Batched from the client, idempotent by (userId, eventId). Types: impression_seen, click, play, watch_progress, like, not_interested. Always carries requestId and position.
POST/v1/feedback/not-interested{ itemId | channelId }204Applied immediately to a per-user block set that the filters read, and also sent as a training signal.
GET/internal/candidates/{source}?userId=&limit=none200 { itemIds[], scores[] }Internal. One endpoint per retriever. Called in parallel with a tight timeout.
POST/internal/rank{ userContext, itemIds[] }200 { scores[] }Internal model server call. Batches many items per call and returns within a deadline.

Data model

StoreKey and valueNotes
Interaction logappend-only events: (user, item, type, position, requestId, ts, watchMs)Kafka, then a data lake in a columnar format. The source of truth for training. About 2 TB a day.
Exposure logrequestId → user, modelVersion, list of (item, position)Written by the serving system when it responds. Needed for “already seen” filters and unbiased training.
Online feature storeuser:{id} and item:{id} → feature values, with freshness timestampsKey-value, low latency. Recent-activity features are updated by a stream job within minutes.
Offline feature storethe same feature definitions, as tables with historyUsed to build point-in-time-correct training sets, so there is no leakage from the future.
Embeddings and ANN indexuser vector, item vector, approximate nearest-neighbour index, all with a model versionItem index sharded and replicated, rebuilt on a schedule plus a small real-time index.
Model registrymodel name, version, training data range, metrics, statusControls which version serves which share of traffic. Supports instant rollback.
Item catalog and policyitem metadata, region, age rating, statusSource for filters. Cached in memory by the serving system.
What one training row needs (sketch)
label      = watched >= 30s?   (or expected watch time)
features   = user features AS OF the request time   <- point-in-time, not today's values
           + item features AS OF the request time
           + context (device, hour, position shown)
requestId  = joins the impression to later clicks and plays
modelVersion = which model chose this list (to correct for its own bias later)
📝Which store, and why
The log is huge, append-only and read in bulk, so it goes through Kafka into object storage in a columnar format (Parquet), where batch jobs train models. Online serving needs single-digit-millisecond reads by key, so features live in a key-value store (an in-memory or wide-column store). Embeddings are read by nearest-neighbour search, so they live in a dedicated index held in memory. The online and offline feature stores share one definition per feature, which is how we avoid training and serving seeing different numbers.
🎤
Say it out loud
“Two calls matter. GET recommendations returns about 30 items, a request ID, and the model version. POST events carries impressions, clicks and watch time, and every event carries that request ID and the position the item was shown at, so I can rebuild exactly what the user saw. Storage: a Kafka log feeding a columnar data lake for training, an online key-value feature store for serving, an embedding index in memory, and a model registry. The online and offline feature stores share the same definitions, so training and serving agree.”

Step 4Draw the high-level designabout 8 min

🤔
Pause. Try it yourself first
Draw one request and one click. On the request, what shrinks the 100 million items down to 30, and in what order? On the click, where does it go so that tomorrow's model learns from it?
Recommendation system: high-level design
📱Clienthome page
→↓GET
🚪Recommendation APIauth, budget, fallback
→↓
Funnel (online)
🔎Retrievers (parallel)ANN, item-to-item, trending, subscriptions
↓about 2,000
🧹Filters + light rankerseen, blocked, region, trim to 500
↓
🎯Heavy rankermodel server, batched
↓
🎛️Re-rankervariety, policy, exploration
Serving data
🧠Online feature storeuser and item features
📐Embedding indexesbig ANN + small fresh index
📚Catalog and policymetadata, rules
Learning loop
📨Event log (Kafka)impressions, clicks, watch
↓
🌊Stream jobsrecent features, counters
🏞️Data lakeParquet, training sets
Models
🏋️Training pipelinesdaily or hourly
🗂️Model registryversions, rollout, rollback
🧪Experiment serviceA/B tests, guardrails
Top: the online funnel answers a request in about 200 ms. Bottom: the learning loop turns events into features, models and a new index.
ComponentWhat it does
Recommendation APIApplies the time budget, calls the stages with timeouts, logs the exposure, and returns a popular fallback list if anything fails.
RetrieversSeveral cheap sources run in parallel: nearest neighbours of the user vector, items similar to recent watches, trending by region, new items from subscriptions.
Filters and light rankerRemove what must not be shown (already seen, blocked, region, age rating), merge and de-duplicate, then trim about 2,000 to about 500 with a small model.
Heavy rankerA model server scores the 500 with user, item and context features, predicting watch time and click probability, then blends them into one score.
Re-rankerAdds variety (not five from one channel), freshness, policy rules and a small exploration share, then cuts to 30.
Online feature storeLow-latency features by key. Recent-activity values are refreshed by stream jobs within minutes.
Embedding indexesA large approximate nearest-neighbour index rebuilt on a schedule, and a small index of new items updated within minutes. Both carry the model version.
Event log, stream jobs, data lakeEverything the user does is logged once, used in minutes for fresh features, and kept for batch training.
Training, registry and experimentsModels are trained on a schedule, evaluated offline, canaried, A/B tested, and only then promoted. Rollback is one switch.
Write path (follow one request)
  1. The client batches events (impressions seen, clicks, plays, watch progress), each with the requestId and the position, and calls POST /v1/events.
  2. The ingest service validates and de-duplicates by event ID, then appends to the Kafka log. It returns 202 without waiting for any processing.
  3. A stream job reads the log and updates fast features in the online store: the user's last 50 watches, today's watch time, each item's recent click and watch rates. These are minutes old.
  4. The same log is written to the data lake in a columnar format, partitioned by day, for batch jobs.
  5. A scheduled pipeline joins impressions with later clicks and plays by requestId, attaches features as they were at request time, and builds a training set.
  6. A training job produces new models and embeddings. They are evaluated offline, then registered with a version.
  7. The new version is canaried to a small share of traffic, A/B tested against the current one, and promoted or rolled back.
  8. A new embedding model means rebuilding the item index and user vectors, then swapping them in together with the matching ranker (same version).
Read path (follow one request)
  1. The client calls GET /v1/recommendations. The API authenticates, picks the experiment arm and model version for this user, and starts a 200 ms budget.
  2. It loads the user context (a few dozen features and the user vector) from the online feature store.
  3. It calls the retrievers in parallel, each with its own timeout (about 40 ms). Slow ones are skipped, and the rest are used.
  4. It merges and de-duplicates the candidates, then applies filters: already watched (a per-user set or Bloom filter), blocked, region, age rating.
  5. A light model trims the list to about 500. Item features come in one batch read, mostly from a local cache.
  6. The heavy ranker scores the 500 in one batched call to the model server. The API blends the outputs into a final score.
  7. The re-ranker enforces variety and policy, adds exploration items, and keeps the top 30.
  8. The API logs the exposure (requestId, model version, items and positions) and returns the list. If any stage failed or was late, it returned a cached or popular list instead.
🎤
Say it out loud
“Here is the picture. A request loads the user's features and vector, then calls several retrievers in parallel: nearest neighbours of the user vector, items similar to recent watches, trending, and subscriptions. That gives about 2,000 candidates. Filters remove what must not be shown, a light model trims to 500, the heavy ranker scores those in one batched call, and a re-ranker adds variety, policy rules and a little exploration. We log the exposure with a request ID and return 30 items, or a popular list if anything is slow. Underneath, every event goes to a Kafka log, stream jobs refresh features within minutes, and batch pipelines train new models that go through an A/B test before promotion.”

Step 5Deep dive into the hard partsabout 16 min

🧠The pattern for every deep dive
Problem → options → pick one → say why → say what it costs. Interviewers score the reasoning more than the choice.
5.1

The funnel and the 200 ms budget

The problem: We have 100 million items and 200 ms. The invariant is: every item shown was either retrieved by some source or put there on purpose (exploration), and the whole request returns something useful even if a stage is slow or down.

OptionHow it worksGoodBad
Score everything with one modelRun the best model on every item for every request.No recall loss, one model to maintain.4.6 trillion scorings a second. Impossible.
Precompute lists offlineA nightly job computes the top 30 per user and stores it.Instant reads. Cheap at serving time. Easy to reason about.Stale (does not react to what you just watched). Storage and compute for users who never return. No context such as the hour or device.
Two stages: retrieve, then rankCheap sources give about 2,000 candidates and one model ranks them.The standard shape. Bounded cost per request.The ranker sees only what retrieval gave it. 2,000 is still 92 million scorings a second.
Retrieve, trim, rank, re-rank (funnel)Parallel retrievers, a light model trims to about 500, a heavy ranker scores them, a re-ranker applies variety and policy.Each stage is as cheap as its job allows. Time budgets and fallbacks per stage. Quality can be improved stage by stage.More parts to run and monitor. Errors compound: an item dropped early is gone for good.
Pick
A four-stage funnel online, plus precomputed lists for the heaviest users as a cache and fallback (a hybrid)

The funnel is the only option that fits the cost. The important rule is that each stage can only choose among what the previous one passed on. A great ranker cannot recover an item the retrieval stage dropped, so recall at retrieval is the quality ceiling for the whole system. That is why we run several different retrievers in parallel (similar to the user, similar to recent watches, trending, subscriptions) rather than one very good one: they find different kinds of good items.

Give every stage a time budget and a fallback. For example: load user context 15 ms, retrieval 40 ms (the slowest retriever, with a hard timeout), filters and light ranking 25 ms, heavy ranker 60 ms, re-rank 10 ms, logging and response 10 ms. That is 160 ms and leaves 40 ms of slack for the p99 tail. If a retriever is late we skip it. If the heavy ranker is late we return the light-model order. If everything fails we return a cached or popular list. A precomputed list for the most active users (refreshed every few minutes) both saves compute and gives a ready fallback, at the cost of some staleness.

StageInput to outputBudgetIf it is slow or down
User contextuser id to features and vector15 msUse a cached copy, or treat the user as new
Retrieval100M to about 2,00040 msSkip the late retriever, keep the others
Filters and light rank2,000 to about 50025 msSkip the light model, filter only
Heavy rank500 to ordered 50060 msUse the light-model order
Re-rank500 to 3010 msSimple rules only (no variety search)
Log and respondwrite the exposure10 msLog asynchronously, never block
📝Where quality is lost
Recall is lost at retrieval and cannot be fixed later. Precision is lost at ranking. In the visualizer below, widen retrieval and watch the “lost for good” counter. Then make the ranker cheap and watch precision drop instead.
🎤
Say it out loud
“I would build a funnel. Scoring all 100 million items per request is about 4.6 trillion scorings a second, so cheap retrievers run in parallel and give about 2,000 candidates. A light model trims to 500, a heavy ranker scores those in one batched call, and a re-ranker adds variety and policy rules. Each stage has a budget, for example 40 milliseconds for retrieval and 60 for the ranker, and a fallback, ending at a popular list. The key point: nothing downstream can recover an item that retrieval dropped, so I use several different retrievers. I also precompute lists for the heaviest users as a cache and a fallback.”
5.2

Candidate retrieval with embeddings

The problem: We must find, in about 20 ms, the few hundred items out of 100 million that are closest to a user, and new items must be findable within minutes. The invariant is: the user vector and the item vectors must come from the same model version, or the distances mean nothing.

OptionHow it worksGoodBad
Exact nearest neighboursCompare the user vector with every item vector.Perfect recall.100 million comparisons of 128 numbers per request. Far too slow.
Tree or hash based approximate searchSplit the space into cells (IVF) or hash similar vectors together (LSH) and search only a few cells.Fast, simple to build, easy to shard.Recall drops if the cells are cut badly. Needs tuning of how many cells to probe.
Graph based approximate search (HNSW)Build a graph where each vector links to near neighbours and walk it towards the query.Very good recall and speed in memory.Memory heavy (links plus vectors). Slow to rebuild. Deletes and updates are awkward.
Compressed vectors (product quantisation)Store each vector in about 16 bytes by coding parts of it, and search on the compact form, often with a re-check of the top results.100 million vectors in about 1.6 GB instead of 51 GB. Fits on one machine.Lower accuracy. Training the codebooks is a step. Usually combined with IVF or a re-check.
Pick
A sharded approximate index (graph or cell based, compressed where needed) for the main catalog, plus a small separate index for new items, merged at query time

Approximate search trades a little recall for a huge speed gain. At 100 million items and 128 numbers each the raw vectors are 51 GB, or about 13 GB at one byte per number, so the index fits in memory across a handful of machines. We split it into shards of a few million items. Each query goes to every shard and the best results are merged, so the shard count is a latency and cost lever: more shards means smaller, faster searches but more calls per request (46,000 requests a second times 8 shards is about 370,000 shard calls a second).

New items need a different path. Rebuilding the big index takes hours, but a new video should be recommendable within minutes. A small second index (for example, the last day's items, tens of thousands of vectors) is cheap to rebuild or update constantly, and at query time we search both and merge. The item vector for a brand-new item comes from its content (title, tags, thumbnail, channel) because it has no watch history yet.

The versioning rule is strict. A new embedding model changes what every number means. User vectors, item vectors, the index and the ranker features that use them must be switched together under one model version. Mixing versions does not crash anything: the results just quietly get worse.

ChoiceMemory for 100M itemsNotes
float32 vectors, 128 numbers51 GBRaw vectors only, before the search structure
8-bit numbers (scalar quantisation)13 GBSmall loss of accuracy, simple, 4 times smaller
Product quantisation, 16 bytes per vector1.6 GBAbout 30 times smaller, lower accuracy, often re-checked with larger vectors
Graph links, 32 per item at 4 bytes13 GB extraOn top of the vectors, for a graph index
⚠️The silent failure
Roll out a new embedding model by building the whole new set (user vectors, item vectors, index, ranker) as one versioned bundle, shadow-test it, then switch traffic together. Keep the old bundle until the new one is proven.
🎤
Say it out loud
“For retrieval I use approximate nearest-neighbour search over item embeddings. At 100 million items and 128 numbers each that is 51 gigabytes, or 13 with 8-bit numbers, so it fits in memory across a few shards. A query goes to all shards and the results are merged. New items cannot wait for an hours-long rebuild, so there is a small second index for the last day's items, built from content features, and we search both. And the user vector, item vectors, index and ranker must all be the same model version, otherwise quality silently drops, so I ship them as one bundle.”
5.3

Features, labels and the feedback loop

The problem: The model is only as good as the data it learns from, and that data is produced by the system itself. The invariant is: the features used in training must equal the features the model sees when serving, as of the same moment.

OptionHow it worksGoodBad
Compute features separately offline and onlineA data team builds training tables and engineers rewrite the same logic in the serving code.Each side can be tuned for its job.Two versions of every feature drift apart. This is training and serving skew, and it is the most common silent bug.
One feature definition, two storesDefine each feature once. A pipeline writes it to an offline table (with history) and to an online key-value store.Same logic in both places. Point-in-time correct training data is possible.A feature store platform to build and run. Backfills are costly.
Compute everything in the requestCalculate features from raw events when the request arrives.No staleness.Far too slow for hundreds of features and 2,000 items.
Log the features at serving timeWrite the exact feature values used for each request, and train on those logs.Zero skew by construction, no leakage.Big logs (features times items times requests). Cannot add a new feature to old data without a backfill.
Pick
One feature definition feeding an offline and an online store, plus logging of the key features used at serving time for audit and debugging

The two stores share one definition, so a feature like “watch time in the last 7 days” is computed by the same code for training and serving. To build a training row we must use the value as it was at the time of the request (a point-in-time join), never today's value. Using today's value leaks the future into the past and gives wonderful offline numbers and poor real ones.

Features come at three speeds. Slow ones (long-term taste, item quality) are batch jobs and refresh daily. Medium ones (recent activity, item click rate in the last hour) come from stream jobs and refresh in minutes. Request-time ones (device, hour, position) are free. Labels are tricky: a click is quick, but watch time arrives later, and a short watch may mean “bad” or “wrong moment”. We wait for a window, then label, and use stronger signals (long watches, likes, repeat visits) together with negative ones (skips, “not interested”).

The loop has a trap. We only get feedback on what we showed. Items at position 1 get far more clicks than items at position 10, so a model trained on raw clicks learns that position-1 items are good. Log what was shown and where (the exposure log), train with position as a feature that is set to a fixed value at serving time or corrected for, and keep a small random or exploratory share so the data includes items the model would not have chosen.

Bias or trapWhat happensMitigation
Position biasTop slots get more clicks regardless of qualityLog position, correct for it in training, test with randomised slots
Exposure biasWe never learn about items we did not showExploration share, retrieval from several sources
Popularity feedback loopPopular items get shown, so they get more clicks, so they get shownNormalise by exposure, add a novelty boost, exploration
Label leakageFeatures computed with data from after the requestPoint-in-time joins only
Delayed labelsWatch time is known minutes laterLabel windows, incomplete-label handling, refresh the model on a schedule
Clickbait objectiveClicks rise, satisfaction fallsPredict watch time and satisfaction, use guardrail metrics
Exploration: spend a small budget to learn (sketch)
for each request:
    top = ranked list (30)
    if user is in exploration group:
        pick 2 slots (not the first three) and fill them with
        items that have few impressions, chosen by uncertainty
        (e.g. a bandit: score + bonus for being uncertain)
    log which slots were exploratory
🎤
Say it out loud
“The most important rule is that training and serving see the same features. I define each feature once and publish it to an offline table and an online store, and I build training rows with point-in-time joins so nothing from the future leaks in. Fast features, such as the last 50 watches, come from a stream job within minutes. I log exactly what was shown and at what position, because a model trained only on clicks learns position bias and feeds on its own choices. To break the loop I keep a small exploration share so the system keeps learning about items it would not normally pick.”
5.4

Cold start, variety and exploration

The problem: A new user has no history and a new item has no views, yet both must be handled well. The home page must also be varied enough that it is not ten near-identical items, and we must spend a little engagement to learn about new items.

OptionHow it worksGoodBad
Popular for everyoneShow the globally popular list to cold users and ignore new items until they get views.Trivial, safe.Poor first impression. New items never get views, so they never become popular (a deadlock).
Content and context basedFor users: device, country, language, onboarding picks. For items: embeddings from title, tags, thumbnail and channel.Works from the first request. Gives each new item a place in the space.Weaker than behaviour-based signals. Needs a content model.
Exploration budgetReserve a few slots for items with little data, chosen by uncertainty (a bandit), and measure how they do.Solves the new-item deadlock. Produces unbiased training data.Costs some engagement. Needs careful measurement.
Re-ranking for varietyAfter ranking, pick the final list so that no topic or channel dominates (for example, a maximum of two per topic, or a marginal-relevance pass).A better page, and protection against filter bubbles.Reduces the model's top-line score a little. Needs tuning.
Pick
Content and context features for cold start, a small exploration budget for new items, and a re-ranker that enforces variety and policy

A new user is handled by falling back through layers: onboarding picks if they gave any, then context (country, language, device, time of day), then regional popular items, adapting after the first few clicks because recent-activity features update within minutes. A new item gets a content embedding and enters the small fresh index, so it can be retrieved on day one.

Exploration needs a budget, and the budget is smaller than people expect. New items arrive at about 100,000 a day. If each needs about 1,000 impressions to get a stable estimate, that is 100 million impressions a day, out of about 30 billion shown (1 billion requests with 30 items), roughly 0.33%. So an exploration share of 1% is plenty. Two slots out of 30 (6.7%) would cost up to about 4% of expected engagement if those items perform at 40% of normal, and would buy far more learning than needed. Place exploratory items below the first few slots and measure them as their own group.

The re-ranker finishes the job: a cap per topic and per channel, a freshness nudge, hard policy rules (age rating, region, safety checks, “not interested”), and a final check that nothing blocked slipped in from a late stage.

🎤
Say it out loud
“For a new user I fall back through layers: onboarding choices, then context like country and device, then regional popular items, and the fast features pick up their first clicks within minutes. For a new item I give it an embedding from its content and put it in a small fresh index so it is retrievable immediately. To break the deadlock where new items never get views, I spend an exploration budget. The maths says about 1,000 impressions per new item is 100 million a day, about a third of a percent of impressions, so a 1% budget is plenty. Then a re-ranker enforces variety and policy rules before the list is returned.”
5.5

Experiments, rollout and running it

The problem: A new model that looks better offline can be worse in production, and a bad deployment hurts millions of users in seconds. The invariant is: no model reaches all users without passing an online experiment, and any model can be rolled back immediately.

OptionHow it worksGoodBad
Ship when offline metrics improveCompare AUC or NDCG on a held-out set and deploy the winner.Fast, cheap.Offline metrics ignore the feedback loop and position bias. Models that win offline often lose online.
Shadow modeRun the new model on live requests but do not show its output. Compare the lists and the latency.Safe. Catches crashes, latency and big list differences.Cannot measure user behaviour, because users do not see its output.
Canary then A/B testShow it to 1% to 5% of users, check guardrails, then run a proper experiment against the current model on a larger share.Measures real behaviour. Limits the blast radius.Takes days, needs enough traffic, and assignment must be stable.
InterleavingMix results from two models into one list and see which items get clicked.Needs much less traffic to detect a difference.Measures preference between lists, not long-term effects. Used as a first filter, not the last word.
Pick
Offline evaluation as a filter, then shadow, canary and a full A/B test with guardrail metrics, and instant rollback via the model registry

Offline metrics answer “is this model plausible?”. Only an online test answers “is it better for users?”. Use a stable assignment (hash the user ID with the experiment name), so a user stays in one group. Measure the main metric (for example watch time per user) and the guardrails (return rate, satisfaction surveys, share of content from new creators, latency, error rate). With high variance in watch time, detecting a 0.5% change needs about 2.5 million users per group by a rough power rule, which is about a day at 5% of 200 million users, so the test must run long enough to cover weekly cycles and the novelty effect.

Operations matter as much as the model. Watch for drift (feature distributions, embedding norms, score distributions), data pipeline failures (a stale feature that is silently zero), serving latency, and cost (accelerator or CPU hours per million requests). Cost levers are batching, smaller or distilled models, 8-bit numbers, caching the top of the funnel, and precomputing for heavy users. A 5% canary is about 2,300 requests a second, enough to see a problem within minutes.

🎤
Say it out loud
“Offline metrics are only a filter. A new model goes to shadow mode first to check latency and list differences, then a 5% canary with guardrails, which is about 2,300 requests a second and enough to see problems in minutes, and then a full A/B test with stable assignment. Interleaving can speed up the early comparison. I watch the main metric, such as watch time, plus guardrails like return rate, variety and latency. Any model version can be rolled back with one switch in the registry, and I monitor drift, stale features and cost per thousand requests.”
VisualizerThe funnel: where recall is lost, and what each stage costsStart with “Similar to this user” and a small candidate list: the red dashed rings are loved titles that never reached the ranker. Try “Mixed”, widen the list, then swap in the cheap ranker, turn on diversity, and try a brand-new user.
Stage 1: where do candidates come from?
Stage 2: the ranker
Stage 3: diversity (max 2 per topic)
The viewer
Exploration slots (2 of 10)
A map of 60 titles. Distance from the star is how well a title fits this viewer. Green = in the final top 10, cyan = reached the ranker but was cut, grey = never retrieved. An amber ring marks one of the 8 titles the viewer would really love. Squares are brand-new titles.
Title 1: Drama, popularity 100, freshness 74Title 2: Comedy, popularity 9, freshness 44Title 3: Sci-fi, popularity 0, freshness 90, brand new, loved by this viewerTitle 4: Docs, popularity 7, freshness 50Title 5: Music, popularity 11, freshness 8Title 6: Drama, popularity 42, freshness 78Title 7: Comedy, popularity 8, freshness 14Title 8: Sci-fi, popularity 16, freshness 17Title 9: Docs, popularity 6, freshness 46Title 10: Music, popularity 10, freshness 34Title 11: Drama, popularity 26, freshness 48Title 12: Comedy, popularity 7, freshness 4Title 13: Sci-fi, popularity 1, freshness 92, brand newTitle 14: Docs, popularity 78, freshness 68Title 15: Music, popularity 9, freshness 32Title 16: Drama, popularity 19, freshness 34Title 17: Comedy, popularity 6, freshness 44Title 18: Sci-fi, popularity 11, freshness 76, loved by this viewerTitle 19: Docs, popularity 37, freshness 4Title 20: Music, popularity 8, freshness 13Title 21: Drama, popularity 15, freshness 72Title 22: Comedy, popularity 2, freshness 94, brand newTitle 23: Sci-fi, popularity 10, freshness 4Title 24: Docs, popularity 25, freshness 7Title 25: Music, popularity 7, freshness 50Title 26: Drama, popularity 13, freshness 82Title 27: Comedy, popularity 64, freshness 9Title 28: Sci-fi, popularity 8, freshness 23, loved by this viewerTitle 29: Docs, popularity 18, freshness 10Title 30: Music, popularity 6, freshness 10Title 31: Drama, popularity 11, freshness 48, loved by this viewerTitle 32: Comedy, popularity 34, freshness 24Title 33: Sci-fi, popularity 0, freshness 96, brand new, loved by this viewerTitle 34: Docs, popularity 15, freshness 79Title 35: Music, popularity 6, freshness 58Title 36: Drama, popularity 9, freshness 52Title 37: Comedy, popularity 23, freshness 14Title 38: Sci-fi, popularity 7, freshness 56Title 39: Docs, popularity 12, freshness 77Title 40: Music, popularity 54, freshness 74Title 41: Drama, popularity 8, freshness 37Title 42: Comedy, popularity 17, freshness 36Title 43: Sci-fi, popularity 6, freshness 23Title 44: Docs, popularity 10, freshness 17Title 45: Music, popularity 31, freshness 57, loved by this viewerTitle 46: Drama, popularity 7, freshness 37Title 47: Comedy, popularity 1, freshness 98, brand newTitle 48: Sci-fi, popularity 6, freshness 46Title 49: Docs, popularity 9, freshness 12Title 50: Music, popularity 22, freshness 34Title 51: Drama, popularity 7, freshness 82Title 52: Comedy, popularity 12, freshness 78Title 53: Sci-fi, popularity 47, freshness 38, loved by this viewerTitle 54: Docs, popularity 8, freshness 68Title 55: Music, popularity 17, freshness 69Title 56: Drama, popularity 6, freshness 69Title 57: Comedy, popularity 10, freshness 67Title 58: Sci-fi, popularity 2, freshness 100, brand new, loved by this viewerTitle 59: Docs, popularity 7, freshness 37Title 60: Music, popularity 13, freshness 36★
◯ loved title◌ loved but never retrieved★ the viewer
Catalog → candidates → shown
60 → 15 → 10
1,500 real candidates scored
Recall at retrieval
4 of 8
50% of loved titles found
Precision at 10
3 of 10
loved titles in the top 10
Lost for good
4
loved, never retrieved
Total time
124 ms
budget 200 ms
Time budget (illustrative model)
28
23
45
20
Retrieval 28 msFeatures 23 msRanking 45 msRe-rank 8 msOther 20 ms| red line = 200 ms budget
The top 10 this viewer sees
1. #18 Sci-fi2. #53 Sci-fi3. #55 Music4. #38 Sci-fi5. #21 Drama6. #57 Comedy7. #28 Sci-fi8. #7 Comedy9. #16 Drama10. #23 Sci-fi
Amber = one of the 8 titles this viewer would love. Exploration slots skip the funnel on purpose, so new titles can collect their first views.
Only 4 of the 8 items this viewer would love reached the ranker. The other 4 were dropped at retrieval, and no ranker, however good, can bring them back. Widen retrieval or add another source (try “Mixed”).

A teaching model with a fixed 60-title catalog and no random numbers. “Loved” titles come from a hidden score the system never sees. The latency model is made up: retrieval 20 ms + 0.005 ms per real candidate, features 0.015 ms per candidate (0.005 for the cheap ranker), ranking 0.03 ms per candidate (0.01 cheap), re-rank 8 ms, other 20 ms. Real numbers depend on hardware, batching and the model.

Step 6Scale, bottlenecks and failuresabout 7 min

🤔
Pause. Try it yourself first
If traffic doubles, what breaks first? If the feature store is down for five minutes, what do users see? If a bad model ships, how quickly do you know and how quickly can you undo it?

What breaks first, and the fix

BottleneckFix
Heavy ranker compute (about 23 million scorings a second after trimming)Batch many items per call, trim harder with the light model, use 8-bit numbers or a distilled model, cache scores for hot items briefly, and add model-server replicas.
Online feature store reads (about 25 million item lookups a second before caching)A local in-process cache for item features (items repeat across requests), batched multi-gets, and replicas. A 90% cache hit rate leaves about 2.5 million store reads a second.
Nearest-neighbour index memory and fan-outCompress vectors, shard the index, keep each shard in memory, and balance shard count against the number of calls per request.
Event ingestion (about 1 million events a second at peak)Batch on the client, partition Kafka by user, scale consumers, and use back pressure. Impressions are the bulk, so sample them for non-critical uses.
Cost of the heaviest usersPrecompute and cache the first page for the most active users, refreshed every few minutes, so their repeat visits cost almost nothing.
Tail latency from the slowest stageHard timeouts per stage, hedged calls to a second replica, and the fallback ladder: skip the late retriever, use the light order, then a cached or popular list.
Index and model rebuild timeVersioned bundles built offline, a fresh-items side index for the gap, and blue-green swaps of the whole bundle.

What if a part fails?

FailureHow the design copes
The online feature store is down or slowUse the local cache and stale copies, fall back to context-only features, and drop to the light model or a popular list. Alert on the share of requests served by fallback.
A retriever or the ranker times outSkip that retriever and use the others, or use the light-model order. The user gets a slightly worse list, not an error.
A bad model is deployedA 5% canary with guardrails shows it within minutes. Roll back with one switch in the model registry. Keep the previous bundle warm.
The event pipeline lags or a feature job fails silentlyEach feature carries a freshness timestamp, and the serving code treats a stale value as missing. Alert on freshness and on a feature suddenly becoming all zeros.
Embedding and ranker versions get out of syncShip them as one versioned bundle. The API checks that all stages report the same model version, and refuses to serve a mixed set.
A region failsAnother region serves, with slightly stale features and indexes (replicated asynchronously). The page loads; the personalisation is a little behind.
What to monitor
  • •Latency by stage (retrieval, features, ranking, re-rank), and the share of requests that used a fallback
  • •Online metrics per experiment arm: watch time, click rate, return rate, variety, and guardrails
  • •Data health: feature freshness, null and zero rates, and feature distribution drift against training
  • •Model health: score distribution, embedding norms, and offline-online metric gaps
  • •Event pipeline lag, dropped events, and the join rate between impressions and later clicks
  • •Cost: model-server utilisation and cost per thousand requests
Security and abuse
  • •Treat the user history as sensitive personal data: encrypt it, limit who can read it, and log access.
  • •Support deletion and opt-out: remove a user's events, features and embeddings on request, and exclude them from future training (see Data Privacy and GDPR Basics).
  • •Defend against manipulation: fake accounts and click farms can push content up, so detect abnormal traffic and discount it in features and labels.
  • •Apply policy and safety filters both before ranking and on the final list, so a late stage cannot reintroduce blocked content.
  • •Explain and control: give users “not interested” and history controls that take effect immediately.

Step 7Wrap upabout 3 min

A request loads the user's features and vector, calls several retrievers in parallel for about 2,000 candidates, filters and trims to about 500 with a light model, scores them with a heavy ranker in one batched call, and re-ranks for variety, policy and a little exploration to return 30 items in under 200 ms, with a fallback at every stage. Every impression and click is logged with a request ID and position, flows through Kafka to fresh features within minutes and to a data lake for training. Models and embeddings ship as versioned bundles through shadow, canary and A/B tests, with instant rollback.

Trade-offs you made

DecisionWhat we gainWhat it costs
A multi-stage funnelBounded cost per request and room to improve each stage.More moving parts, and an early drop is permanent.
Several retrievers, mergedHigher recall, because each finds a different kind of good item.More calls per request and a merge step to tune.
One feature definition for training and servingNo training and serving skew.A feature platform to build, run and backfill.
Exploration budgetNew items and unseen tastes get learned about.A small, measured loss in short-term engagement.
Precompute for heavy usersLower cost and a ready fallback.Staler lists and extra storage and refresh work.
A/B tests as the final judgeReal user impact, not offline guesses.Slower iteration and a lot of experiment infrastructure.
If we had more time, we would…
  • •A first version: popular plus item-to-item similarity, a simple ranker, and the event log from day one. Add embeddings and a feature store when the data justifies them.
  • •Multi-objective ranking (watch time, satisfaction, creator health) with explicit weights and guardrails.
  • •Sequence models for session context, and a real-time re-rank using the last few actions.
  • •Multi-region serving with local indexes and regional trending.
  • •Better offline evaluation: counterfactual estimates and interleaving to make experiments faster.
🎤
Say it out loud
“To recap: a request loads the user's features, runs several retrievers in parallel to get about 2,000 candidates, filters and trims to 500, ranks them with one batched call to a heavy model, and re-ranks for variety, policy and a little exploration, in under 200 milliseconds with a fallback at every stage. Every impression and click is logged with its request ID and position, fed into Kafka, turned into fresh features within minutes, and used for batch training. Models ship as versioned bundles through shadow, canary and an A/B test. The trade-offs are more moving parts, a feature platform, and an exploration cost. For a first version I would start with popular plus item-to-item similarity and a clean event log.”

Q&ACross-questions (25)

💡How to practise
Cover the answer. Say yours out loud in 30 to 60 seconds. Then open the model answer, the follow-up, and the weak answer to see what to avoid. Use Open all at the top for a quick read.
Warm-upProbingCurveballWarm-up = basics. Probing = tests depth. Curveball = changes the problem.

The funnel and the numbers

Interviewers start with one request end to end, then push on cost and latency.

Embeddings, features and the feedback loop

Cold start, freshness and quality

Operating it, failures and the curveballs

What ifIf the interviewer changes the problem

A change in requirements is a test of whether you understand why your design looks the way it does.

New requirementWhat changes in the design
Add search: results for a typed query, personalisedA different entry point. Retrieval comes from the search index (see Design a Search Engine), the ranker adds query features, and the personalised score blends in. The feature store and event loop are shared.
An “up next” list after a video endsSeed item as an input. Retrieval leans on item-to-item similarity and the current session, latency is tighter, and the list can be precomputed for popular seeds.
Add a short-video feed with endless scrollMany small requests, so the first batch is ranked heavily and later batches are cheap. Session-sequence features and fast feedback matter more. Prefetch the next batch.
Add ads into the same listA separate auction produces candidates with bids. The re-ranker merges them under rules for spacing and quality, with its own latency budget and logging.
The catalog becomes 10 times largerShard and compress the index, use hierarchical retrieval (cluster first), and spend more effort on the fresh-item path. The funnel shape does not change.
A strict privacy mode with no personal historyUse context and on-device signals, with aggregate popular and content-based retrieval on the server. Measure the quality loss and show users the trade-off.
Real-time re-ranking after every clickA light session model in the request path, fed by a very fast stream of recent actions. More state to keep consistent and a tighter budget, so keep it small and cache aggressively.

ScoreHow answers are judged

AreaWeakGoodGreat
ScopingStarts drawing a model. Never says what is included.States the surface, scale and objective, and what is out of scope.Scopes hard in two minutes, names guardrail metrics, and says it will treat models as black boxes.
EstimationNo numbers, or numbers that do not change the design.Requests, events and vector sizes, and notices the catalog is too big to score.Shows 4.6 trillion scorings a second forces a funnel, and sizes the ranker, feature store and index from it.
DesignOne model and one database.Retrieve then rank, with a feature store and an event log.A funnel with budgets and fallbacks, versioned bundles, a fresh-item index, and a clear online and offline split.
Data and feedbackLogs clicks only. Ignores skew and bias.Logs impressions, point-in-time features, and names position bias.Explains the feedback loop, exploration budget, delayed labels and how skew is prevented by one feature definition.
OperationsShips on offline metrics. No rollback.A/B tests and a fallback list.Shadow, canary, guardrails, drift and freshness monitoring, instant rollback, cost control and deletion handling.
CommunicationJargon without explanation.Explains embeddings and the funnel simply.Uses the numbers, names trade-offs aloud, and admits what is uncertain.

AvoidCommon mistakes on this question

MistakeDo this instead
Designing the model instead of the systemScope it out loud: models are black boxes with inputs and outputs. Spend the time on data flow, latency and operations.
Scoring the whole catalog, or never doing the mathsShow 100 million items times 46,000 requests a second. Let the number force the funnel.
Logging clicks but not impressions and positionsLog every exposure with request ID, item and position. Without it you cannot train fairly.
Ignoring training and serving skewOne feature definition feeding both stores, point-in-time joins, and monitoring of live feature distributions.
Forgetting cold start and new itemsContext for new users, content embeddings and a fresh index for new items, plus a small exploration budget.
Shipping on offline metrics aloneOffline is a filter. Use shadow, canary and an A/B test with guardrails.
Mixing model versionsShip user vectors, item vectors, the index and the ranker as one versioned bundle, and check versions at serve time.
No fallbackEvery stage has a timeout and a cheaper answer, ending at a cached or popular list.

Revise60-second revision sheet

  • ✔Funnel: retrieve about 2,000, trim to about 500, rank, re-rank to 30, all in under 200 ms.
  • ✔Why: scoring 100M items at 46,000 requests a second is 4.6 trillion scorings a second.
  • ✔Recall: what retrieval drops is gone for good, so use several retrievers.
  • ✔Embeddings: 100M × 128 × 4 B = 51 GB (13 GB with 8-bit). Approximate nearest-neighbour search, sharded.
  • ✔Fresh items: a small second index plus content embeddings and an exploration budget (about 1%).
  • ✔Features: one definition, offline and online stores, point-in-time joins. Avoid skew.
  • ✔Log impressions with request ID and position. Beware position and popularity bias.
  • ✔Ship safely: shadow, 5% canary, A/B test with guardrails, instant rollback, versioned bundles.
  • ✔Fallbacks: skip a slow retriever, use the light model, then a cached or popular list.
  • ✔One line: “Narrow the catalog cheaply, rank the few carefully, log what you showed, and let experiments decide.”

Read these topics next

Design a News Feed→

Same two-stage idea (candidates then ranking) for a social feed, with fan-out as the main problem.

Design Video Streaming (YouTube/Netflix)→

The delivery side of what you recommend, and the source of the watch-time signal.

Design a Search Engine→

Retrieval and ranking for a typed query, with the same funnel shape.

Vector Databases→

How embeddings are stored and searched by similarity.

Data Governance and Feature Stores→

Offline and online feature stores and how they avoid skew.

A/B Testing Infrastructure→

How experiments are assigned, measured and read safely.

Kafka Deep Dive→

The event log that carries impressions and clicks.

Data Privacy and GDPR Basics→

Deleting a user's history, features and embeddings.

← Previous
Design an E-commerce System (Amazon)