ML System Designintermediatemust-know5 min

A Framework for Any ML Design Round

The 45-minute whiteboard round that determines your engineering level at tier-1 tech companies.

ML System Design interviews evaluate end-to-end architectural thinking. To succeed, use a structured 6-step framework: Clarify Problem & Business Metrics -> Data Ingestion & Features -> Baseline & Model Design -> Offline/Online Evaluation -> Serving & Latency Budget -> Monitoring & Feedback Loops. Always lead with simple heuristics before complex deep learning, and state tradeoffs out loud.

ML System Designintermediatemust-know5 min

Framing a Business Problem as ML

Turning a vague business goal into something a model can actually learn.

Problem Framing translates vague real world business objectives into concrete machine learning problems. Key steps include identifying the core prediction target, defining input features and output labels, selecting appropriate loss functions, and establishing metrics that align model performance directly with business KPIs. Proper framing prevents building models that optimize high accuracy while completely failing business goals.

ML System Designintermediatemust-know5 min

Online vs Offline Evaluation

Why a model with stellar offline AUC can fail completely when deployed to real production users.

Evaluating ML systems requires a two-stage process: Offline Evaluation on historical datasets (ROC-AUC, NDCG, RMSE) and Online Evaluation on live production traffic (A/B testing, CTR, Conversion Rate, Latency). A major challenge in applied ML is offline-online metric misalignment, caused by position bias, selection bias, feedback loops, and static offline data failing to capture dynamic user behavioral reactions.

ML System Designintermediatemust-know5 min

Batch vs Real-Time Inference

Predict on demand, or run everything overnight? It depends on freshness.

Batch vs Real-Time Inference represents the fundamental serving architecture choice in production ML systems. Batch inference precomputes predictions for all users or items offline (e.g. nightly Spark jobs) and stores results for fast lookup. Real-time inference computes predictions on demand when a request arrives, using the freshest features. Many production systems use a hybrid approach combining both.

ML System Designintermediatemust-know5 min

Training–Serving Skew

When a model performs great during offline training but fails in live production due to mismatched data or logic.

Training Serving Skew happens when the data or environment during live inference does not match what was used during model training. Common causes include calculating features differently in real time versus offline batch jobs, data leakage during training, or feature values changing between training and serving. Engineers prevent skew by using unified feature stores, shared feature transformation code, and point in time data logging.

ML System Designintermediatemust-know5 min

Communicating Tradeoffs Out Loud

Explaining your design choices out loud, which is half of the interview.

Communicating Tradeoffs Out Loud is a critical skill in machine learning system design interviews. Every technical design choice involves compromises between latency, accuracy, cost, memory, and operational complexity. Strong candidates state their architectural choices explicitly, explain why alternative approaches were rejected, and justify how their compromises serve business goals.

ML System Designbeginner5 min

Why You Propose a Baseline First

Build the simple model first. It often wins, and it always tells you something.

Proposing a Baseline First is a fundamental best practice in machine learning engineering and system design interviews. Before building complex 100 layer Transformer or GNN architectures, start with a simple, interpretable baseline (e.g. Heuristic Rules, Logistic Regression, BM25, or Most Popular items). Baselines validate data pipelines, set lower bound performance benchmarks, provide fast fallback options, and quantify ROI improvements of complex models.

ML System Designintermediate5 min

Clarifying Requirements & Constraints

The questions to ask in the first five minutes of a design interview.

Requirements Gathering is the critical first phase of System Design interviews and enterprise ML architecture design. Engineers must clarify Functional Requirements (core capabilities, user interactions), Non-Functional Requirements (latency SLAs, throughput QPS, availability, freshness), and Resource Constraints (GPU/CPU budget, memory limits). Establishing clear parameters upfront prevents over-engineering complex architectures for simple requirements.

ML System Designintermediate5 min

Latency vs Throughput vs Cost

Fast, high volume or cheap: serving models means picking a balance.

Latency vs Throughput vs Cost is a fundamental tradeoff in ML system design. Latency measures how fast a single request gets a response. Throughput measures how many requests the system handles per second. Cost measures the hardware spend. Optimizing one often hurts another, so engineers must choose the right balance for their use case.

ML System Designintermediate5 min

Caching Strategies for ML Systems

The cheapest prediction is the one you already made.

Caching in ML Systems intercepts redundant compute and data requests across every tier of the machine learning lifecycle. Caching spans Feature Store Caching (low-latency Redis key-value feature lookups), Model Prediction Caching (caching exact/semantic model outputs for frequent inputs), Prompt Caching (reusing pre-computed KV Cache tensors for static LLM prefixes), and Embedding Caching. Effective caching requires selecting optimal eviction policies (LRU, LFU, TTL) and invalidation triggers to prevent stale data.

ML System Designintermediate5 min

Guardrails, Fallbacks & Degradation

What your ML system does when the model is wrong or the servers are on fire.

Guardrails and Fallbacks protect machine learning applications from failing catastrophically in production. Guardrails filter invalid inputs and block dangerous or policy violating model outputs before they reach users. Graceful Degradation and Fallbacks ensure that when model servers crash or experience high latency, the application reverts to simple heuristic rules or cached static responses to maintain system uptime.

ML System Designintermediate5 min

Back-of-Envelope Capacity Estimation

Quick maths to size memory, bandwidth and GPUs before you design anything.

Back of Envelope Capacity Estimation calculates rough hardware and infrastructure requirements early in system design. Engineers convert business metrics like Daily Active Users and request frequencies into technical metrics like queries per second, network bandwidth, vector memory footprint, and GPU server cluster sizes. These rough calculations dictate whether a proposed architecture is technically viable and affordable.

ML System Designintermediate5 min

Human-in-the-Loop Design

Letting the model handle the easy cases and people handle the hard ones.

Human in the Loop Design integrates human judgment directly into automated machine learning workflows. Pure automation fails when models encounter ambiguous edge cases, low confidence predictions, or high risk safety decisions. Human in the loop systems route uncertain predictions to human reviewers, using human decisions to protect user safety and continually improve model training data.

ML System Designintermediate5 min

Build vs Buy vs API

Call an API, adapt an open model, or train your own?

Build vs Buy vs API is a strategic decision for every engineering organization introducing machine learning. Buying third party cloud APIs (like OpenAI or Google Vision) offers fast time to market with zero infrastructure overhead. Building custom models from scratch provides total data privacy, custom feature integration, and lower per request costs at massive scale. Adapting open source models offers a middle ground balancing flexibility and engineering effort.

ML System Designadvanced8 min

Design: Recommendation Feed

Design a personalised feed for millions of users, end to end.

Designing a Recommendation Feed requires a multi-stage retrieval and ranking pipeline. The system starts with Candidate Generation (retrieving hundreds of items from millions using Two-Tower embeddings and ANN search), followed by a Ranking stage (scoring candidates with a deep model considering user context), and finally a Re-ranking stage (applying business rules, diversity constraints, and freshness boosts).

ML System Designadvanced8 min

Design: Search Ranking

Design a search engine that finds and orders the right results.

Designing a Search Ranking System requires understanding queries, retrieving candidate documents, and ranking them by relevance. The pipeline starts with Query Understanding (spelling correction, intent classification, entity extraction), then Retrieval (BM25 lexical and dense vector hybrid search), followed by a learned Ranking model (Learning-to-Rank with NDCG optimization), and finally business rule re-ranking.

ML System Designadvanced8 min

Design: Fraud Detection

Catch fraud in real time when almost every transaction is honest.

Designing a Fraud Detection System requires handling extreme class imbalance (0.01% fraud rate), real-time scoring under strict latency budgets, and minimizing both false positives (blocking legitimate users) and false negatives (missing actual fraud). The architecture combines rule-based filters, real-time ML scoring, and human review queues.

ML System Designadvanced8 min

Design: Ad Click Prediction

Predict who will click an ad, accurately enough to price it.

Designing an Ad Click Prediction System requires predicting calibrated click probabilities for real-time ad auctions. The system must handle billions of daily impressions, sparse high-cardinality features, and strict latency requirements. Architecture involves candidate ad retrieval, a deep CTR model (DCNv2, DIN), probability calibration, and auction ranking by expected value.

ML System Designadvanced8 min

Design: Enterprise RAG Chatbot

Design a company chatbot that answers from its own documents.

Designing an Enterprise RAG Chatbot combines retrieval from a company knowledge base with LLM generation to produce grounded, accurate answers. The architecture involves document ingestion and chunking, embedding and indexing in a vector database, hybrid retrieval, context assembly with prompt engineering, LLM generation, and citation verification to reduce hallucinations.

ML System Designadvanced7 min

Design: Social Feed Ranking

Rank a social feed so it is engaging without being junk.

Designing a Social Feed Ranking System orders posts from friends, creators, and advertisers into a personalized timeline. The system must balance multiple objectives (engagement, content quality, user satisfaction) while handling viral content spikes, filter bubbles, and creator ecosystem health.

ML System Designadvanced7 min

Design: Content Moderation

Find harmful posts at scale across text, images and video.

Designing a Content Moderation System detects policy-violating content (hate speech, violence, nudity, spam) across text, images, and video at platform scale. The architecture combines automated ML classifiers with human reviewer queues, handling millions of uploads per day with sub-second scoring latency.

ML System Designadvanced7 min

Design: Delivery ETA Prediction

Predict when the food will arrive, from kitchen to doorstep.

Designing a Delivery ETA Prediction System estimates how long a food delivery will take from order placement to doorstep arrival. The prediction must account for restaurant preparation time, driver assignment wait time, route distance with real-time traffic, and last-mile complexities like apartment building access.

ML System Designadvanced7 min

Design: Spam & Abuse Detection

Stop spam and fake accounts on a messaging platform.

Designing a Spam and Abuse Detection System identifies and removes unwanted messages, fake accounts, and abusive users from messaging and social platforms. The system combines real-time content classification, behavioral signals, sender reputation scoring, and graph-based detection of coordinated abuse campaigns.

ML System Designadvanced6 min

Design: Query Autocomplete

Suggest the rest of a search before the user finishes typing.

Designing a Query Autocomplete System predicts and suggests complete search queries as a user types each character. The system must return suggestions within 100ms of each keystroke, handle typos and partial prefixes, personalize suggestions based on user history, and rank candidates by expected relevance.

ML System Designadvanced6 min

Design: Dynamic Pricing

Set prices that move with demand, without upsetting customers.

Designing a Dynamic Pricing System adjusts product or service prices in real time based on demand signals, inventory levels, competitor prices, time sensitivity, and customer segments. Applications include ride-sharing surge pricing, airline ticket pricing, hotel room rates, and e-commerce flash sales.

ML System Designadvanced6 min

Design: Customer Support Copilot

Design an AI assistant that helps answer customer support tickets.

Designing a Customer Support Copilot uses LLMs and retrieval to assist or automate customer support interactions. The system retrieves relevant help articles and past ticket resolutions, generates draft responses for human agents or auto-replies for simple cases, and escalates complex issues to human specialists.

ML System Designadvanced6 min

Design: Document Data Extraction

Pull clean fields out of messy invoices, receipts and forms.

Designing a Document Data Extraction System converts unstructured document images (invoices, receipts, tax forms, contracts) into structured key-value data. The pipeline combines Optical Character Recognition (OCR) to extract raw text with layout-aware models that understand spatial relationships between text blocks to identify fields like invoice number, date, total amount, and line items.

ML System Designadvanced5 min

Scaling Inference to Millions of Users

Serving predictions to millions of users without falling over.

Scaling Inference to Millions of Users requires distributed model serving architectures and load balancing. To handle massive traffic volumes without crashing, systems employ Horizontal Pod Autoscaling, dynamic batching, model caching, model quantization, and asynchronous prediction queues. Proper scaling maintains sub second response times even during massive traffic spikes.

SCROLL · SAVE · TAP TO GO DEEPER