Library

ML system design

How to run a 45-minute design round with real numbers, then the systems these loops ask for, from ranking and retrieval to batch inference, GPU scheduling and a production incident.

Practice questions

43
Running a 45-minute ML design round
  1. 1.A request fans out to 40 index shards and waits for all of them. Each shard is slower than the target 1% of the time, independently. About what share of requests miss the target?
  2. 2.A single-server queue runs at 90% utilization. Traffic grows until it's 95% busy. What happens to the average time in the system, in the M/M/1 model?
  3. 3.Jobs arrive at 800 a minute and workers can process 1,000 a minute. Processing stops for 30 minutes while jobs keep arriving. How long after recovery is the backlog gone?
  4. 4.You have 500 million item vectors of 128 dimensions in float32 and want an IVF index with product quantization at M = 16 sub-vectors of 8 bits, plus Faiss's 8-byte id per vector. About how much memory does each version need?
  5. 5.Your design needs an LLM fleet for 300 requests a second at peak, 400 output tokens each. A load test shows one GPU sustains 2,000 output tokens a second at the latency target, and you plan to run at 60% of that. How many GPUs?
Search ranking with no text query
  1. 1.Your stays ranker can train on clicks, which are plentiful, or bookings, which are rare. Which label, and why?
  2. 2.The main ranker costs 200 µs per listing. A city search has 10,000 eligible listings and the p99 budget is 250 ms. What does the design need?
  3. 3.Airbnb adds the listing's position as a feature during training. What does it set that feature to when scoring live searches, and why?
  4. 4.Seven million listings at 64 float32 dimensions take about 1.8 GB. Why did Airbnb choose IVF over HNSW for retrieval?
  5. 5.New listings have no bookings or views, and the ranker leans on those features. What did Airbnb find works better than a fixed ranking boost?
Retrieval-assisted answers for support agents
  1. 1.BM25 ranks policy A first and dense retrieval doesn't return it. Policy B is fifth in BM25 and fourth in dense retrieval. With reciprocal rank fusion at k = 60, which ranks higher?
  2. 2.Why randomize an agent-assist test by agent rather than by ticket?
  3. 3.Your judge agrees with experts on 93% of 200 suggestions, with kappa 0.72. It then flags 6% of production. What's the best estimate of the true unfaithful rate, given it catches 73% of real problems and falsely flags 3.5% of good ones?
  4. 4.At about 3 ms per candidate, reranking 150 candidates pushes the budget 2 ms over 2 seconds. What's the cheapest fix?
  5. 5.Anthropic reports contextual embeddings plus contextual BM25 plus reranking cut the top-20 retrieval failure rate by 67%, from 5.7% to 1.9%. What happened to recall at 20?
  6. 6.A refund policy was retired yesterday, but agents still see it cited today. What's the most likely gap?
Finding the interesting images in an unlabeled pile
  1. 1.You rank a filtered pile by distance to the nearest training images, and the top 100 are mostly blank frames and corrupted files. What's the best fix?
  2. 2.Interesting images are 5% of what two labelers see, and they agree 90% of the time. What can you conclude?
  3. 3.How much RAM does an HNSW index with M = 32 need for a billion 768-dimensional float32 vectors, using Faiss's formula of d × 4 + M × 2 × 4 bytes per vector?
  4. 4.You retrain with 50,000 mined images and slice error falls from 18% to 12%. What's the most important missing comparison?
  5. 5.SemDeDup clusters a billion embeddings into 50,000 equal clusters before comparing pairs. About how many times fewer comparisons is that than all pairs?
  6. 6.640 of 1,000 planted known-interesting images land in the selected top 100,000. What does that tell you?
Serving features under different freshness needs
  1. 1.A daily feature row has event time Mar 2 00:00 and reached the online store at Mar 2 04:10. The previous row reached it at Mar 1 04:10. An impression at Mar 2 02:00 needs this feature in training. Which row matches what serving read?
  2. 2.Why does logging the served feature vector remove training-serving skew?
  3. 3.The ranker fetches from three stores in parallel. Each is independently past its own p99 on 1% of requests. On what share of requests is at least one of them past its p99?
  4. 4.A stream keeps a feature 10 seconds behind the events. Someone adds a 15-minute cache in front of the store to cut read load. How old can the value be when the model reads it?
  5. 5.At 20,000 requests a second with 500 candidates each, why keep title features in each server's memory?
A batch inference service: failures and overload
  1. 1.Tenant A submits 100,000 requests (15,000 replica-seconds of work) at 9:00. Tenant B submits 100 requests at 9:05. Ten replicas are free for batch. Under one FIFO queue per model, when does B finish?
  2. 2.A design uses a fixed 10-minute timeout, with no heartbeats, to reset requests stuck in running. Generation runs at 31 tokens a second. What happens to a request with a 32,000-token answer?
  3. 3.With full jitter, a base of 1 second and a cap of 60 seconds, how long does a client sleep before its retry at attempt 4?
  4. 4.A model's queue holds 300 replica-hours of work, the next 24 hours offer about 400 idle replica-hours, and a 150-replica-hour batch arrives. What does admission against the window say?
  5. 5.GPU utilization is 95% and the worker error rate is flat. Which metric tells you the service is about to break its promise?
An ML job scheduler for CPU and GPU clusters
  1. 1.Eight nodes have 8 GPUs each. Small jobs use 23 GPUs, spread so every node has some. An 8-GPU job can't start. What is the cause?
  2. 2.A pool has 64 GPUs and 2,048 vCPUs. A team's tasks each use 8 GPUs and 64 vCPUs. What is one task's dominant share?
  3. 3.Two 16-GPU jobs each have 12 GPUs placed and wait for 4 more. Nothing else is running. What should the scheduler have done?
  4. 4.A reservation for a big job starts in 90 minutes on node N. Which job may backfill onto N now?
  5. 5.A job's mean time between failures halves. By Young's approximation, how should its checkpoint interval change?
  6. 6.Why classify each failure before retrying it automatically?
Working a production incident: three overlapping bugs
  1. 1.8% of servers are bad, each user sends 12 requests, and routing goes from random to fully sticky. What changes?
  2. 2.The maximum probability is computed from values kept in fp32 (0.30103), and the filter compares bf16 values against it. The top token's bf16 value is 0.30078. What does a keep-the-top-token filter do?
  3. 3.Can a correct approximate top-k, which keeps the largest value of each bin and then takes an exact top-k of those, ever drop the single most likely token?
  4. 4.A bug degrades 0.8% of requests, and an eval scores 80% when healthy. About how many questions does the eval need to see the drop at two standard errors, even if every affected answer turns wrong?
  5. 5.Reports of worse answers are rising, they contradict each other, and error rates look normal. What do you do first?