ML system design interviews check how properly you’ll be able to assume past fashions. In these interviews, selecting an algorithm is just one a part of the reply. You additionally want to clarify how information is collected, how options are created, how predictions are served, and the way the system improves over time.
Most actual ML programs are constructed round product choices. A feed system decides what to indicate. A fraud system decides what to dam. A search system decides what to rank. This text walks by 10 such issues in a sensible interview model.
How you can Suppose in an ML System Design Interview
Begin with the product purpose. Each ML system is constructed to decide. A feed system decides which publish to indicate. A fraud system decides whether or not a fee is dangerous. A search system decides which merchandise ought to seem first.
As soon as the purpose is obvious, outline success. Don’t solely discuss mannequin metrics. A very good ML system design reply ought to cowl three sorts of metrics:
- Mannequin metrics: accuracy, AUC, RMSE, precision, recall, NDCG
- Product metrics: income, retention, conversion, fraud loss, person satisfaction
- System metrics: latency, throughput, availability, freshness, price
Subsequent, focus on the information. Clarify what information is collected, how labels are created, and the place bias can enter. Some labels are fast, like clicks. Some labels are delayed, like chargebacks, complaints, or product returns.
Then break up the system into three views: offline path, on-line path, and suggestions loop.
Offline Path
The offline path is used to arrange information and prepare the mannequin. It normally runs in batches. It focuses on high quality, correctness, and repeatability.
On-line Path
The net path is used to serve predictions. It should be quick and dependable as a result of the person is ready for the outcome.

ML System Suggestions Loop
The suggestions loop connects on-line conduct again to coaching. That is how the system improves over time.

These three diagrams cowl the core construction of most ML programs. In an interview, they aid you clarify the system clearly with out leaping instantly into algorithms.
1. Feed Rating System
A feed rating system decides what a person ought to see subsequent throughout social media, brief video, information, or networking platforms.
Whereas it could seem to be a easy rating downside, manufacturing programs take care of tens of millions of doable posts and might present just a few. So as a substitute of scoring each publish, the system first narrows the candidate set, then makes use of a stronger mannequin to rank one of the best choices.
Downside Assertion
Design a personalised feed rating system. Given a person and a big pool of posts, return a ranked listing of posts that the person is more likely to discover helpful or partaking.
The system ought to deal with freshness, personalization, security, variety, and low latency.
How the System Works
The system normally works in three levels.
- Candidate era selects a smaller set of posts. These posts can come from folks the person follows, matters the person likes, trending content material, related customers, or embedding-based retrieval.
- The rating mannequin scores every candidate. The rating will be primarily based on predicted clicks, likes, feedback, shares, watch time, skips, or hides. In an actual system, the ultimate rating is usually a weighted mixture of many predicted actions.
- A guidelines layer adjusts the ranked listing. It removes unsafe content material, avoids duplicates, improves variety, and prevents the feed from exhibiting too many posts from the identical creator.
Feed Rating Movement

Essential Alerts
The mannequin wants indicators concerning the person, the publish, and the interplay between them.
Helpful indicators embrace:
- Person pursuits and previous conduct
- Creator affinity
- Put up freshness
- Put up engagement fee
- Content material class
These indicators assist the mannequin perceive each long-term preferences and short-term intent. For instance, a person could normally like machine studying content material, however within the present session they might be watching extra career-related posts.
Mannequin Selection
A very good first model can use a gradient boosted tree mannequin. It really works properly with tabular options and is less complicated to debug than a fancy deep mannequin.
Because the system grows, candidate era can use embeddings. The rating mannequin can even turn into extra superior. It might use deep studying fashions, sequence fashions, or multi-task fashions that predict a number of actions directly.
The vital level is to start out easy. A powerful baseline with good logging is extra helpful than a fancy mannequin that’s arduous to observe.
Analysis Metrics
Offline analysis can use AUC, NDCG, precision@Okay, and recall@Okay. These metrics present whether or not the mannequin can rank related posts increased.
On-line analysis is extra vital. The system ought to monitor click-through fee, dwell time, session size, conceal fee, retention, and content material variety.
A feed system shouldn’t optimize just for clicks. Clickbait content material could enhance short-term engagement however hurt long-term person satisfaction.
Commerce-offs
The most important trade-off is relevance versus exploration. If the system solely exhibits content material much like previous clicks, the feed turns into repetitive. If it explores an excessive amount of, the person might even see irrelevant posts.
There may be additionally a trade-off between freshness and high quality. New posts could not have sufficient engagement information but. But when the system ignores new posts, customers could miss well timed content material.
Latency is one other concern. The system should return the feed rapidly. Candidate era, characteristic lookup, and rating ought to all be optimized for quick response.
Interview Tip
In an interview, at all times point out that the system can’t rating each publish on-line. A very good feed system first generates candidates, then ranks them, and at last applies enterprise guidelines.
This exhibits that you just perceive each ML and system scalability.
2. Advertisements CTR Prediction System
An adverts CTR prediction system estimates how probably a person is to click on an advert and makes use of that rating to determine which advert to indicate.
In contrast to regular content material rating, it should steadiness three objectives: person relevance, advertiser returns, and platform income. So the target isn’t just extra clicks, however exhibiting adverts which can be related, protected, and helpful.
Downside Assertion
Design a system that predicts the click-through fee of adverts in actual time. The system ought to use this prediction with advertiser bids, budgets, and public sale guidelines to pick out one of the best advert for a person.
It also needs to respect focusing on guidelines, coverage checks, frequency caps, and marketing campaign budgets.
How the System Works
The system begins when an advert request is created. This may occur when a person opens a web page, searches for one thing, or scrolls by a feed.
- The system filters adverts that aren’t eligible. It checks marketing campaign standing, focusing on guidelines, location, language, machine kind, price range, and coverage constraints.
- The CTR mannequin scores the remaining adverts. It predicts the chance that the person will click on every advert.
- The public sale layer combines predicted CTR with advertiser bids. The ultimate advert is chosen primarily based on anticipated worth, high quality, and enterprise guidelines.
Advertisements CTR Prediction Movement

Essential Alerts
The mannequin ought to use indicators from the person, advert, advertiser, and context.
Helpful indicators embrace:
- Person pursuits and previous advert interactions
- Web page or search context
- Advert class and artistic kind
- Advertiser high quality rating
- System kind and site
These indicators assist the mannequin perceive whether or not the advert is related within the present context. For instance, a journey advert could carry out higher when the person is studying about trip planning than when they’re studying about finance.
Mannequin Selection
A easy baseline can use logistic regression. It’s quick, straightforward to coach, and works properly with sparse categorical options.
A stronger model can use gradient boosted bushes or deep studying fashions with embeddings. These fashions can study higher interactions between customers, adverts, and context.
For very massive advert programs, deep fashions are helpful as a result of there will be tens of millions of customers, adverts, key phrases, and classes.
Analysis Metrics
Offline metrics embrace AUC, log loss, and calibration error. Calibration is essential right here. If the mannequin predicts a CTR of 5 p.c, the actual click on fee ought to be shut to five p.c.
On-line metrics embrace CTR, conversion fee, income per impression, advertiser ROI, price range pacing accuracy, and person criticism fee.
A very good system also needs to monitor long-term person expertise. If customers begin ignoring or hiding adverts, the system could also be optimizing the mistaken factor.
Commerce-offs
The primary trade-off is income versus person expertise. Exhibiting high-paying adverts could enhance income, however these adverts could not at all times be related.
There may be additionally a trade-off between accuracy and latency. A bigger mannequin could predict CTR higher, however the advert system should reply in a short time.
One other trade-off is exploration versus exploitation. The system wants to check new adverts, however it shouldn’t present poor adverts too typically.
Interview Tip
In an interview, don’t describe adverts for CTR prediction as solely a classification mannequin. An actual adverts system additionally contains eligibility checks, auctions, budgets, frequency caps, coverage filters, and logging.
This exhibits that you just perceive the complete manufacturing system, not simply the ML mannequin.
3. E-commerce Search Rating System
An e-commerce search rating system decides which merchandise seem for a person question throughout buying apps, marketplaces, meals supply, and journey platforms.
The purpose is to return helpful outcomes, not simply key phrase matches. The system should perceive intent, product kind, worth, availability, high quality, and person desire. For instance, a question like “trainers underneath 3000” ought to return reasonably priced trainers, not formal footwear or costly merchandise that solely match the phrase “footwear.”
Downside Assertion
Design a search rating system for an e-commerce platform. Given a person question, return a ranked listing of merchandise which can be related, accessible, and more likely to fulfill the person.
The system ought to help key phrase search, semantic search, spelling correction, filters, personalization, and low-latency rating.
How the System Works
The system will be damaged into three steps:
- Rating and Guidelines: Merge candidates, rank them utilizing relevance, recognition, worth, rankings, availability, supply pace, and person conduct, then apply enterprise guidelines akin to filters, sponsored boosts, and out-of-stock elimination.
- Question Understanding: Clear and interpret the question utilizing spelling correction, synonym growth, class detection, and filter extraction.
- Candidate Retrieval: Retrieve merchandise utilizing lexical seek for precise matches and semantic seek for meaning-based matches.
E-commerce Search Rating Movement

Essential Alerts
The rating mannequin ought to use indicators from the question, product, person, and context.
Helpful indicators embrace:
- Question-product textual content match
- Semantic similarity
- Product class
- Worth and low cost
- Product ranking and evaluations
These indicators assist the system keep away from shallow key phrase matching. A product could match the question textual content, however whether it is out of inventory or poorly rated, it shouldn’t rank excessive.
Mannequin Selection
A very good baseline is BM25 with easy enterprise guidelines. That is straightforward to construct and offers robust outcomes for precise key phrase matching.
A greater system can add vector retrieval for semantic matching. This helps with queries the place the phrases don’t precisely match product titles.
For remaining rating, use a learning-to-rank mannequin. LambdaMART, XGBoost ranker, or a neural re-ranker can be utilized relying on latency and scale.
Begin easy. Then enhance the system by including semantic retrieval, personalization, and higher rating options.
Analysis Metrics
Offline metrics embrace NDCG, MRR, precision@Okay, and recall@Okay. These metrics verify whether or not related merchandise seem close to the highest.
On-line metrics embrace CTR, add-to-cart fee, buy conversion fee, zero-result fee, and question reformulation fee.
Zero-result fee is particularly vital. If many customers search and discover nothing, the retrieval layer is weak.
Commerce-offs
The primary trade-off is relevance versus enterprise worth. Probably the most related product could not at all times be one of the best outcome whether it is out of inventory, costly, or poorly rated.
There may be additionally a trade-off between lexical and semantic search. Lexical search is quick and exact. Semantic search improves recall however can return sudden outcomes.
Neural re-ranking can enhance high quality, however it provides latency. So it’s normally utilized solely to the highest candidates, not the complete product catalog.
Interview Tip
In an interview, point out hybrid retrieval. A powerful search system shouldn’t rely solely on key phrase search or solely on vector search.
Additionally point out question understanding. Search high quality typically improves so much when the system appropriately handles spelling errors, synonyms, filters, and person intent.
4. Fraud Detection System
An actual-time fraud detection system checks whether or not a transaction is dangerous throughout funds, banking, e-commerce, insurance coverage, and digital wallets.
The purpose is to cease fraud with out blocking real customers. If the system is simply too strict, good customers get declined. Whether it is too lenient, the corporate loses cash. So the system should make quick, cautious danger choices.
Downside Assertion
Design a fraud detection system that scores fee transactions in actual time. For every transaction, the system ought to determine whether or not to approve it, decline it, ask for additional verification, or ship it for guide assessment.
The system ought to use historic conduct, real-time indicators, guidelines, and ML predictions.
How the System Works
The system will be damaged into three steps:
- Characteristic Extraction: Fetch transaction indicators akin to person historical past, card utilization, service provider kind, machine data, IP location, and up to date exercise.
- Guidelines and ML Scoring: Apply guidelines for identified dangerous patterns, then use an ML mannequin to foretell a fraud danger rating.
- Remaining Determination: Mix the mannequin rating, guidelines, enterprise limits, and danger insurance policies to approve, decline, request verification, or ship the transaction for guide assessment.
Fraud Detection Movement

Essential Alerts
The mannequin ought to use indicators that seize person conduct, transaction danger, and machine patterns.
Helpful indicators embrace:
- Transaction quantity and foreign money
- Service provider class
- Account age
- System fingerprint
- IP location
These indicators are helpful as a result of fraud typically seems as uncommon conduct. A sudden high-value transaction from a brand new machine or nation will be dangerous.
Mannequin Selection
A very good baseline is a gradient boosted tree mannequin. Fraud information is normally tabular, imbalanced, and stuffed with helpful hand-crafted options.
Guidelines shouldn’t be eliminated. They’re helpful for arduous constraints and identified fraud patterns. The mannequin handles patterns which can be tougher to precise as guidelines.
For superior programs, graph-based options will be added. These can detect teams of accounts linked by shared playing cards, units, addresses, or IPs.
Analysis Metrics
Offline metrics embrace precision, recall, PR-AUC, false optimistic fee, and cost-weighted loss.
PR-AUC is beneficial as a result of fraud information is extremely imbalanced. There are normally far fewer fraud transactions than real transactions.
On-line metrics embrace fraud loss, approval fee, chargeback fee, guide assessment fee, and buyer friction.
The system also needs to measure efficiency by phase. For instance, new customers, high-value transactions, and cross-border funds could behave in another way.
Commerce-offs
The most important trade-off is fraud loss versus person friction. A strict mannequin catches extra fraud, however it could decline real customers. A lenient mannequin improves approval fee, however it could enhance fraud loss.
There may be additionally a latency trade-off. The system should rating transactions rapidly as a result of the person is ready. Heavy fashions or gradual characteristic lookups can damage the fee expertise.
One other problem is delayed labels. A transaction could look protected immediately, however a chargeback could arrive days or even weeks later. This makes coaching and analysis tougher.
Interview Tip
In an interview, point out delayed labels and guide assessment. These are vital in actual fraud programs.
Additionally point out that the choice layer ought to mix guidelines and ML. Fraud detection isn’t solely a mannequin prediction downside. It’s a danger determination system.
5. ETA Prediction System
An ETA prediction system estimates when a driver, rider, order, or cargo will arrive. It’s extensively utilized in ride-sharing, meals supply, logistics, and mapping platforms.
The purpose is to offer correct and dependable arrival occasions regardless of altering visitors, route decisions, GPS noise, and ranging pickup or drop-off delays. A very good ETA system ought to be correct, secure, and quick.
Downside Assertion
Design an ETA prediction system for a ride-sharing or supply app. Given the origin, vacation spot, route, driver location, and present context, the system ought to predict the anticipated arrival or supply time.
The system ought to help real-time updates because the journey progresses.
How the System Works
The system will be damaged into three steps:
- Route Technology: Map the origin and vacation spot to the street community and generate candidate routes utilizing distance, street kind, pace limits, and visitors information.
- Base ETA Estimation: Use a routing engine to calculate an preliminary journey time estimate for the chosen route.
- ML-Based mostly Adjustment: Refine the bottom ETA utilizing elements akin to stay visitors, climate, driver conduct, and historic delays to provide a extra correct prediction.
ETA Prediction Movement

Essential Alerts
The mannequin ought to use route, visitors, driver, and context indicators.
Helpful indicators embrace:
- Origin and vacation spot
- Route distance
- Highway kind
- Time of day
- Day of week
These indicators assist the system regulate for real-world circumstances. For instance, two routes with the identical distance could have very totally different ETAs throughout peak visitors.
Mannequin Selection
A very good baseline is a gradient boosted tree mannequin. It really works properly with structured options and is straightforward to debug.
The mannequin can predict the ultimate ETA instantly, however a greater design is to foretell the residual error. This implies the mannequin learns how a lot the routing engine is normally mistaken in a given context.
For superior programs, sequence fashions or graph neural networks can be utilized. These can mannequin visitors patterns throughout street networks. However in addition they enhance complexity.
Analysis Metrics
Offline metrics embrace MAE, RMSE, percentile error, and calibration. MAE is straightforward to know as a result of it measures common time error.
On-line metrics embrace late supply fee, cancellation fee, buyer complaints, and ETA stability.
ETA stability issues as a result of customers don’t like estimates that maintain altering each few seconds. A barely much less correct however secure ETA can typically really feel higher than a extremely risky one.
Commerce-offs
The primary trade-off is accuracy versus stability. Updating ETA too typically could make the estimate extra correct, however it could additionally make the person expertise worse.
There may be additionally a trade-off between mannequin complexity and reliability. A posh visitors mannequin could enhance accuracy, however it’s tougher to debug when predictions go mistaken.
Latency is vital too. ETA is usually proven inside a stay person movement, so the system should reply rapidly.
Interview Tip
In an interview, point out that ML ought to enhance the routing engine, not change it fully.
Additionally point out residual prediction. It exhibits sensible considering as a result of many manufacturing ETA programs mix rule-based routing with ML correction.
6. Spam and Phishing Detection System
A spam and phishing detection system decides whether or not an e mail is protected, undesirable, suspicious, or dangerous.
The purpose isn’t just textual content classification. It should additionally use sender popularity, area historical past, hyperlinks, attachments, and authentication checks to dam dangerous emails with out hiding vital ones.
Downside Assertion
Design a system that classifies incoming emails as protected, spam, phishing, or suspicious.
The system ought to detect malicious hyperlinks, faux senders, dangerous attachments, and suspicious message patterns. It also needs to study from person suggestions, akin to “mark as spam” or “not spam.”
How the System Works
The system will be damaged into three steps:
- Sign Extraction: Parse the e-mail header, sender identification, area popularity, authentication outcomes, URLs, attachments, topic, and physique textual content.
- Guidelines and ML Scoring: Apply guidelines to catch identified threats, then use an ML mannequin to attain the e-mail utilizing textual content, sender, URL, and person conduct indicators.
- Remaining Determination: Ship the e-mail to inbox, spam, warning, or quarantine primarily based on the ultimate danger rating.
Spam and Phishing Detection Movement

Essential Alerts
The system ought to mix content material indicators and safety indicators. Textual content alone isn’t sufficient.
Helpful indicators embrace:
- Sender area and sender popularity
- SPF, DKIM, and DMARC outcomes
- Topic and physique textual content
- URL popularity
- Attachment kind
These indicators assist the system catch various kinds of assaults. A phishing e mail could look regular in textual content, however it could include a suspicious hyperlink or come from a newly created area.
Mannequin Selection
A very good baseline is a textual content classification mannequin with sender and URL options. Logistic regression or gradient boosted bushes can work properly for the primary model.
A extra superior system can use transformer-based fashions for topic and physique understanding. These fashions can detect refined phishing patterns higher than easy key phrase guidelines.
Nonetheless, the system shouldn’t rely solely on the ML mannequin. Guidelines, popularity checks, and authentication outcomes are vital for safety.
Analysis Metrics
Offline metrics embrace precision, recall, F1 rating, and false optimistic fee.
False positives are essential. If a protected e mail is moved to spam, the person could miss one thing vital.
On-line metrics embrace phishing catch fee, person criticism fee, spam folder correction fee, and important-email false optimistic fee.
The system also needs to monitor new assault patterns. Phishing campaigns change rapidly, so previous check information could not mirror present threats.
Commerce-offs
The primary trade-off is security versus person belief. Aggressive filtering catches extra dangerous emails, however it may possibly additionally block real messages.
Conservative filtering reduces false positives, however extra spam or phishing could attain the inbox.
There may be additionally a value trade-off. Deep content material scanning and attachment sandboxing enhance security, however they add latency and infrastructure price.
Interview Tip
In an interview, don’t current this as solely an NLP downside. An actual spam and phishing system combines textual content classification, sender popularity, URL intelligence, authentication checks, guidelines, and person suggestions.
This exhibits that you just perceive how security-focused ML programs work in manufacturing.
7. Visible Defect Detection System
A visible defect detection system identifies defective merchandise on manufacturing traces, warehouses, and high quality management pipelines.
The purpose is to catch defects earlier than merchandise attain prospects, decreasing waste, returns, security dangers, and guide inspection effort. Since merchandise typically transfer constantly, the system should be correct and quick sufficient for close to real-time choices.
Downside Assertion
Design a pc imaginative and prescient system that detects product defects from photos.
The system ought to determine whether or not a product ought to go, fail, or go for human assessment. If wanted, it also needs to find the defect within the picture.
How the System Works
The system will be damaged into three steps:
- Picture Seize and High quality Verify: Seize product photos on the manufacturing line and verify for points like poor lighting, blur, digicam motion, or mistaken angles.
- Imaginative and prescient Mannequin Inference: Preprocess the picture and use a imaginative and prescient mannequin to categorise defects, detect defect packing containers, or phase defect areas.
- Remaining Determination: Mark the product as go or fail if confidence is excessive, or ship unsure circumstances to human reviewers for suggestions and future coaching information.
Visible Defect Detection Movement

Essential Alerts
The picture is the primary enter. However metadata can even assist the system perceive the manufacturing context.
Helpful indicators embrace:
- Product kind
- Digital camera ID
- Manufacturing line
- Batch ID
- Timestamp
These indicators are helpful as a result of defects could rely on a particular machine, batch, materials, or manufacturing situation.
Mannequin Selection
The mannequin selection is determined by the output wanted.
If the system solely wants go or fail, picture classification is sufficient. Additionally it wants to indicate the place the defect is, object detection is best. If it wants precise defect boundaries, segmentation is the higher selection.
A very good baseline is switch studying with a pretrained CNN or imaginative and prescient transformer. That is sensible as a result of defect datasets are sometimes small.
For object detection, fashions like YOLO-style detectors or Sooner R-CNN can be utilized. For segmentation, a U-Internet-style mannequin is a robust baseline.
Analysis Metrics
Offline metrics embrace precision, recall, F1 rating, IoU, and defect-level recall.
Recall is essential when lacking a defect is dear. Precision is vital when false rejects create waste.
On-line metrics embrace false reject fee, false settle for fee, assessment fee, inference latency, and manufacturing downtime.
The system also needs to monitor mannequin efficiency by product kind, digicam, and manufacturing line. This helps detect digicam drift or course of points.
Commerce-offs
The primary trade-off is recall versus waste. Excessive recall catches extra defects, however it could reject good merchandise. Excessive precision reduces waste, however it could miss some defects.
There may be additionally a trade-off between edge inference and cloud inference. Edge inference is quicker and works even with weak community connectivity. Cloud inference is less complicated to replace and monitor, however it provides latency and is determined by community reliability.
One other problem is information imbalance. Defects are sometimes uncommon. The system might even see hundreds of regular merchandise for each faulty one.
Interview Tip
In an interview, point out picture high quality monitoring. Many actual imaginative and prescient programs fail due to lighting adjustments, digicam shifts, blur, or soiled lenses.
Additionally point out human assessment. It helps deal with unsure circumstances and creates new labeled information for retraining.
8. Demand Forecasting System
A requirement forecasting system predicts future product demand for retail, e-commerce, manufacturing, and provide chain operations.
The purpose is to keep up the best stock ranges. Underestimating demand can result in stockouts, whereas overestimating it can lead to extra stock and better prices. A very good forecasting system ought to be correct, secure, and helpful for planning.
Downside Assertion
Design a requirement forecasting system for merchandise throughout shops, areas, or warehouses.
The system ought to predict future demand for every product and time interval. It also needs to deal with holidays, promotions, seasonality, new merchandise, and stockouts.
How the System Works
The system will be damaged into three steps:
- Information Preparation: Gather historic gross sales, stock, pricing, promotions, holidays, product metadata, and retailer information, then clear lacking values, stockouts, returns, and weird spikes.
- Characteristic Engineering and Forecasting: Create time-based options akin to day of week, seasonality, holidays, promotions, and up to date gross sales traits, then predict future demand.
- Planning and Suggestions: Ship forecasts to stock or replenishment programs, evaluate predictions with precise gross sales, and use the suggestions for backtesting and retraining.
Demand Forecasting Movement

Essential Alerts
The mannequin ought to use gross sales, product, pricing, and calendar indicators.
Helpful indicators embrace:
- Historic gross sales
- Product class
- Retailer or area
- Worth and low cost
- Promotion standing
Stockout data is essential. If a product was out of inventory, noticed gross sales don’t present true demand. The person could have needed to purchase the product, however couldn’t.
Mannequin Selection
A easy baseline can use shifting averages or exponential smoothing. These are straightforward to clarify and work properly for secure merchandise.
A stronger system can use gradient boosted bushes with time-based options. This works properly when the mannequin wants to mix gross sales historical past with worth, promotions, and product metadata.
For giant-scale forecasting, international time-series fashions can be utilized. These fashions study patterns throughout many merchandise and shops as a substitute of coaching one separate mannequin for every merchandise.
Probabilistic forecasting can be helpful. As an alternative of giving one quantity, the system can predict a variety. This helps planners put together for uncertainty.
Analysis Metrics
Offline metrics embrace MAE, RMSE, MAPE, WAPE, and pinball loss for probabilistic forecasts.
WAPE is usually helpful in enterprise settings as a result of it measures error relative to complete demand.
Enterprise metrics embrace stockout fee, stock holding price, waste, service stage, and misplaced gross sales.
The mannequin also needs to be evaluated throughout segments. Quick-moving merchandise, slow-moving merchandise, seasonal merchandise, and new merchandise could behave in another way.
Commerce-offs
The primary trade-off is granularity versus noise. Forecasting at store-product-day stage is beneficial, however it may be noisy. Forecasting at category-region-week stage is extra secure, however much less detailed.
There may be additionally a trade-off between accuracy and explainability. Easy fashions are simpler for planners to belief. Complicated fashions could also be extra correct, however tougher to clarify.
One other problem is new merchandise. They don’t have sufficient historical past. The system can use related merchandise, class patterns, or launch plans to create a cold-start forecast.
Interview Tip
In an interview, point out stockout bias. Gross sales will not be at all times equal to demand. If stock was unavailable, the information is censored.
Additionally point out that enterprise metrics matter. A forecasting mannequin is beneficial provided that it improves stock choices.
9. Dynamic Pricing System
A dynamic pricing system recommends costs or reductions primarily based on demand, provide, stock, and enterprise objectives.
The purpose is to steadiness income, conversion, margin, stock, and buyer belief. Since pricing impacts person expertise, equity, model worth, and authorized danger, the system wants robust guardrails.
Downside Assertion
Design a system that dynamically recommends costs or reductions for services or products.
The system ought to use demand, provide, stock, competitor costs, buyer conduct, and enterprise constraints. It also needs to embrace guardrails in order that costs don’t change in unsafe or unfair methods.
How the System Works
The system will be damaged into three steps:
- Sign Assortment: Gather demand, inventory ranges, competitor costs, historic conversions, seasonality, and margin information.
- Worth Estimation: Estimate demand at totally different worth factors and generate doable costs or reductions.
- Guardrails and Suggestions: Apply enterprise, authorized, equity, and margin guardrails, present the ultimate worth, and log person actions for future coaching.
Dynamic Pricing Movement

Essential Alerts
The mannequin ought to use indicators that designate demand and willingness to purchase.
Helpful indicators embrace:
- Present demand
- Stock stage
- Competitor worth
- Historic conversion fee
- Worth and low cost historical past
These indicators assist the system perceive when a worth change could assist. For instance, if stock is excessive and demand is low, a reduction could enhance sell-through. If demand is already excessive and stock is restricted, a reduction is probably not wanted.
Mannequin Selection
A very good baseline is a supervised mannequin that predicts conversion or demand for a given worth. That is simpler to construct and safer than instantly letting a mannequin select costs.
As soon as the system is secure, contextual bandits can be utilized for managed exploration. They assist the system study which worth works greatest in several contexts.
Full reinforcement studying shouldn’t be the primary selection. It wants robust simulation, sufficient information, and strict security controls. With out these, it may possibly make dangerous pricing choices.
Analysis Metrics
Offline metrics embrace demand prediction error, conversion prediction error, and coverage simulation efficiency.
On-line metrics embrace income, margin, conversion fee, stock sell-through, buyer complaints, and worth volatility.
Additionally it is helpful to trace equity and trust-related metrics. If customers really feel costs are random or unfair, the system could damage long-term loyalty.
Commerce-offs
The primary trade-off is short-term income versus long-term belief. A excessive worth could enhance margin now, however it may possibly cut back repeat purchases if customers really feel handled unfairly.
There may be additionally a trade-off between exploration and danger. The system wants to check costs to study, however an excessive amount of experimentation can hurt person expertise.
One other trade-off is automation versus management. Absolutely automated pricing can react rapidly, however enterprise groups typically want guardrails and approval workflows.
Interview Tip
In an interview, at all times point out guardrails. Dynamic pricing isn’t just a prediction downside. It’s a determination system with enterprise, authorized, and equity constraints.
Additionally point out that the mannequin ought to begin by predicting demand or conversion earlier than shifting towards automated worth optimization.
10. RAG-Based mostly Buyer Help Assistant
A RAG-based buyer help assistant solutions person questions utilizing firm paperwork throughout assist facilities, SaaS merchandise, banking apps, and e-commerce platforms.
The purpose is to offer correct, grounded solutions fairly than relying solely on the LLM’s reminiscence. By retrieving related paperwork earlier than producing a response, the system turns into extra dependable and simpler to audit.
Downside Assertion
Design a buyer help assistant that may reply person questions utilizing product docs, FAQs, insurance policies, manuals, and previous help content material.
The system ought to retrieve related data, generate grounded solutions, cite sources, and escalate unsure circumstances to a human agent.
How the System Works
The system will be damaged into three steps:
- Doc Ingestion: Gather, clear, chunk, embed, and retailer paperwork with metadata akin to supply, replace date, product identify, and entry permissions.
- Question and Retrieval: Verify entry guidelines, clear the person question, and retrieve related chunks utilizing hybrid search with each key phrase and vector retrieval.
- Reply Technology: Cross retrieved chunks to the LLM, generate a solution from the offered context, and ask for clarification or escalate if the context is weak.
RAG Help Assistant Movement

Essential Alerts
The system ought to use indicators from the question, paperwork, and person context.
Helpful indicators embrace:
- Person query
- Product or account kind
- Doc title
- Doc freshness
- Chunk relevance rating
Freshness is vital. A help assistant can provide mistaken solutions if it retrieves outdated coverage paperwork.
Mannequin Selection
The system wants three primary mannequin elements.
- Embedding mannequin: It converts doc chunks and person queries into vectors.
- Reranker: It improves the order of retrieved chunks earlier than they’re despatched to the LLM.
- LLM: It generates the ultimate reply from the retrieved context.
A easy baseline can use key phrase search plus an LLM. A stronger system can add vector search, reranking, higher chunking, and grounding checks.
Analysis Metrics
Analysis ought to cowl each retrieval and era.
- Retrieval metrics embrace recall@Okay, MRR, and hit fee. These present whether or not the best doc seems within the retrieved outcomes.
- Technology metrics embrace reply correctness, groundedness, quotation accuracy, hallucination fee, and refusal high quality.
- Product metrics embrace decision fee, escalation fee, common dealing with time, buyer satisfaction, and repeat contact fee.
Commerce-offs
The primary trade-off is reply high quality versus price. Extra context can enhance the reply, however it will increase token utilization and latency.
There may be additionally a trade-off between strict grounding and helpfulness. If the system is simply too strict, it could refuse too typically. Whether it is too unfastened, it could hallucinate.
One other problem is entry management. The assistant ought to solely retrieve and reply from paperwork the person is allowed to see.
Interview Tip
In an interview, say clearly that retrieval high quality is usually extra vital than the LLM itself. If the mistaken chunks are retrieved, even a robust LLM will produce a weak reply.
Additionally point out supply citations, entry management, doc freshness, and human escalation. These are key components of a manufacturing RAG system.
Remaining Interview Guidelines
Earlier than you finish any ML system design reply, rapidly verify whether or not you coated the complete system. This helps you keep away from giving a model-only reply.
- Outline the Objective: Clarify what determination the system makes and why it issues.
- Perceive the Information: Describe information sources, label creation, and label availability.
- Select the Mannequin: Begin with a easy baseline and focus on doable enhancements.
- Design the Serving Movement: Clarify characteristic lookup, inference, and the way predictions are used.
- Deal with Manufacturing Considerations: Cowl enterprise guidelines, latency, logging, and fallback mechanisms.
A brief guidelines can assist you construction the reply:
- Product purpose
- Purposeful and non-functional necessities
- Information sources and labels
- Characteristic engineering
- Baseline mannequin
This guidelines is beneficial for each downside. It really works for rating, classification, forecasting, pc imaginative and prescient, pricing, and RAG programs.
The primary thought is easy. Don’t cease after selecting a mannequin. Present how the mannequin matches into an entire manufacturing system.
Login to proceed studying and luxuriate in expert-curated content material.
