ML system design
ML and AI system design for interviews: recommendation and ranking, LLM serving, RAG and agents. Free to read.
ML and AI system design for interviews: recommendation and ranking, LLM serving, RAG and agents. Free to read.
44 write-ups
| Title | Difficulty |
|---|---|
| Design a Bot and Spam Detection System Catch bot accounts and spam posts on a social platform in real time with a cascade of rules, behavior models and text classifiers, while adversaries adapt and real users stay unharmed. | Medium |
| Design a Coding Agent like Claude Code An agent that reads, edits and runs code: the harness loop and its tools, permissions, context in big repos, cloud sandboxes, and a pipeline that turns failing tests into bugs and fix PRs. | Hard |
| Design a Duplicate Event Detector Find events that describe the same real-world happening, created by different hosts with different words, using blocking, a pairwise match model, clustering and safe merge actions. | Medium |
| Design a Homepage Recommendation System The models behind a personalized home page of rows, for e-commerce, food delivery stores, Netflix-style titles and Spotify shelves: row generation, item ranking and page assembly. | Medium |
| Design a News Feed Ranking System Rank posts from friends, pages, groups and recommendations for a Facebook or LinkedIn-style feed with a multi-task model, a tunable value model, integrity demotions and user preferences. | Hard |
| Design a Prohibited Item Detection System Keep weapons and other banned goods off a marketplace with multimodal classifiers over listing text and photos, seller signals, and a human review loop that produces the labels. | Medium |
| Design a RAG System Answer questions over hundreds of millions of private documents with cited, grounded answers, keep the index fresh as documents change, and meet the bar for legal work. | Hard |
| Design an Ads Ranking System Predict calibrated click and conversion probabilities for every eligible ad, turn them into auction scores and prices, and handle delayed conversions, new ads and miscalibration. | Hard |
| Design an AI Shopping Assistant A chat assistant that turns "tacos for six, under $50" into a real cart: grounded catalog search, validated cart changes, multi-turn refinement, latency and cost, and the travel-booking variant. | Medium |
| Design an LLM Gateway One proxy between a company's apps and every LLM provider, with model routing, response and prompt caching, fallbacks, cost and latency observability, and per-team budgets and token quotas. | Medium |
| Design an LLM Inference System Serve a /v1/chat/completions API on a shared GPU fleet with continuous batching, a paged KV cache, prefill/decode disaggregation, LoRA adapters and cache-aware routing. | Hard |
| Design an ML Fraud Detection System Train and serve models that catch payment fraud and account takeovers in under 100 ms, despite labels that arrive months late, extreme class imbalance and fraudsters who adapt. | Hard |
| Design ChatGPT Stream model responses token by token to millions of users, survive dropped connections, store branching conversations and keep a fleet of GPUs busy but not overloaded. | Hard |
| Design ETA Prediction Predict arrival times for rides and food deliveries: a residual model on top of the routing engine, stage-by-stage delivery ETAs, live traffic and kitchen load, quantiles and serving at 600k QPS. | Hard |
| Design Natural-Language Search for a Food Delivery App Search that understands "protein food under 30 min" and "spicy biryani near me": query parsing into filters, hybrid lexical and vector retrieval, context-aware ranking and dish tagging. | Medium |
| Design NotebookLM Let users drop PDFs, web pages and YouTube videos into a notebook and ask questions answered only from those sources, with every claim linked to the exact passage it came from. | Medium |
| Design People You May Know Suggest people to connect with on a Facebook or LinkedIn-style network: graph and shared-context candidates, a ranker for invites that get accepted, cold start and privacy. | Medium |
| Design TikTok's Video Recommendation System The models behind a TikTok or Reels For You feed: multi-source retrieval, a multi-task ranker over watch signals, re-ranking, cold start for new videos, and training that keeps up within minutes. | Hard |
| Design a Browser Agent A multimodal agent that operates a real browser: screenshots vs DOM, the action space, sandboxed browser fleets, prompt injection from pages, and confirmations before consequential actions. | Hard |
| Design a Deep Research Agent An agent that plans, searches, reads hundreds of sources and writes a cited report over 5-30 minutes: the research loop, durable long-running jobs, claim-level citations, cost budgets and evals. | Hard |