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.
27 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 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 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 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 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 Feature Store Define ML features once, compute them in batch and streaming, serve them online in milliseconds and build point-in-time correct training sets from the same definitions. | Hard |
| Design a Real-Time Voice Assistant A voice agent that talks back in under a second: streaming STT, LLM and TTS, turn detection and barge-in, WebRTC and phone calls, tools mid-conversation, and running 40,000 calls at once. | Hard |
| Design a Speech Recognition System Meeting transcription with live captions and an accurate transcript after the call: streaming vs batch ASR, speaker diarization, word timestamps, custom vocabulary and measuring WER properly. | Medium |
| Design a Text-to-Speech Service An ElevenLabs-style speech API: text normalization, codec language models and vocoders, streaming synthesis under 300 ms, prosody control, voice cloning with consent, MOS evaluation and audio watermarking. | Medium |
| Design AI Code Completion Copilot-style inline completion: fill-in-the-middle models, retrieving context from the repo, a 250 ms budget per keystroke, and acceptance and retention metrics that tell you if it helps. | Hard |
| Design an AI Search Engine like Perplexity Answer questions with a cited, up-to-date summary of the web in a few seconds, by searching, reading and synthesizing pages live, and go deeper with multi-step research when asked. | Hard |
| Design Object Detection for Autonomous Vehicles 3D object detection for a self-driving car: camera and LiDAR fusion in bird's-eye view, a 50 ms on-vehicle budget, a data engine with auto-labelling, the long tail, and safety evaluation. | Hard |
| Design Real-Time Video Understanding Models that watch live video as it happens: on-device detection and tracking for 30 fps effects, and cloud stream understanding that drives auto comments, captions and highlights. | Hard |
| Design Visual Search Search with a photo, like Pinterest Lens or Google Lens: object detection and crops, image embeddings trained with contrastive learning, ANN retrieval over billions of images, re-ranking and exact product matching. | Medium |