ML and AI system design interview questions
15 machine learning and AI system design questions in an order that builds on itself: retrieval and ranking, then a model inside a request, then training and experiments, then serving large language models and the retrieval and agent systems built on them. Each has a full reference design, a strong candidate’s walkthrough, and a mock interview with an AI interviewer that sees your whiteboard.
ML system design rounds are system design rounds first: requirements, numbers, a design that works end to end, then deep dives. What changes is where the deep dives go: features and labels, training and serving skew, accelerators, evaluation and safe rollout.
1Retrieval and ranking
Find a few hundred candidates fast, then rank them with a learned model, then apply the rules. The pipeline behind feeds, search and recommendations, and the shape most ML interviews start from.
The “recommended for you” video home feed: 50 personalised videos picked from billions for 500 M daily users in under 200 ms.
The home timeline of Twitter, Instagram or Facebook: posts from people you follow, ranked, fresh, and fast for hundreds of millions of users.
A managed vector database: 10,000 tenants, 20 B vectors, filtered top-k in under 50 ms at 0.95 recall, and writes searchable in seconds.
Read alongside: Recommendation systems · Search ranking and relevance · Vector search, embeddings and RAG
2A model inside a request
A prediction that has to come back in tens of milliseconds, on features that must match what the model was trained on, with labels that arrive late or never. Where ML meets money and safety.
The model that predicts whether a user clicks an ad: 150 M calibrated predictions a second inside a 100 ms auction, retrained every hour.
Allow, block or challenge 10,000 card payments a second in under 100 ms, then learn from chargebacks that arrive months later.
Catch spam, nudity, hate and illegal media in 4 billion daily posts and comments before they spread, with 15,000 reviewers for the hard cases.
Pick the best of 10 M active ads for 5 M requests a second in under 100 ms, within every campaign’s targeting, budget and frequency caps.
Read alongside: Feature stores and serving machine learning models · Feature flags and A/B testing
3Training and experiments
Getting models built and proven: jobs across thousands of accelerators that survive failing hardware, and experiments that tell a real improvement from noise.
Run training jobs from one GPU to 8,192 on a shared 16,384-GPU cluster: each starts whole or not at all and survives hardware failure.
Run 500 experiments at once on 300 M users: sticky variants in microseconds, exposure logging, and confidence intervals teams can trust.
Read alongside: Feature flags and A/B testing · Feature stores and serving machine learning models
4Serving large language models
Accelerators are the scarce resource: batching, KV caches, streaming tokens and admission control, then the products built on them.
Serve a large language model behind an API: queue the requests, batch them onto scarce GPUs, stream tokens back, and keep every accelerator busy without blowing the latency budget.
- Design ChatGPThard
An AI chat assistant for 100 M weekly users whose streamed answers survive dropped connections, call tools mid-answer, and share scarce GPUs across tiers.
Inline AI code suggestions for 10 M developers, shown within 300 ms of a pause in typing, when most requests are never used.
Read alongside: Building LLM features: serving, latency and cost
5Retrieval and agents on top of LLMs
Answering over a company’s own documents without leaking them, and agents that call tools for minutes or hours and must survive crashes, loops and runaway cost.
An assistant that answers employees’ questions from their company’s documents, with citations, only from what each user may open, minutes after edits.
Host customers’ tool-calling LLM agents: a million runs a day lasting minutes to hours, surviving crashes, staying within budget and acting only with permission.
An agent that finds, edits and tests code in a developer’s repository, on their laptop or in the cloud: 8 M tasks a day.
Read alongside: Vector search, embeddings and RAG · Designing AI agent systems
Asked something that is not here?
Bring your own question to a mock round: the AI interviewer runs it the same way and debriefs you against what a strong answer contains. How the debrief is scored.