← Back to Index

18. FAQ

Q1: What is the difference between ML System Design and traditional system design?

Traditional system design focuses on deterministic behavior, request handling, data storage, and reliability. ML system design adds data pipelines, model training and serving, feature stores, drift detection, and the uncertainty that comes with probabilistic models. ML systems must handle silent degradation (model drifts) in addition to traditional failure modes (server crashes).

Q2: When should I use batch vs real-time serving?

Use batch when predictions can be pre-computed and the application can tolerate minutes/hours of staleness (e.g., daily recommendations, weekly churn scoring). Use real-time when the prediction depends on the latest data and users expect instant results (e.g., fraud detection, real-time search ranking, chatbots). Many systems use both — batch for cold-start, real-time for hot requests.

Q3: How do I handle training-serving skew?

Training-serving skew occurs when feature distributions differ between training and serving. Mitigations: use a feature store with shared computation logic, log features at serving time and compare distributions, validate that the same preprocessing code runs in both paths, and monitor feature drift in production.

Q4: What is a feature store and do I need one?

A feature store is a centralized repository for ML features shared across training and serving. You need one when: multiple models share features, you need low-latency online feature lookups, you want point-in-time correct training data (avoiding data leakage), or you want feature sharing across teams. Start with an offline feature store (Parquet files + SQL); add an online store (Redis) when latency requirements demand it.

Q5: How do I detect model degradation in production?

Through monitoring at two levels: (1) system metrics — latency, throughput, error rates, cache hit ratios; (2) model metrics — prediction distribution shifts (data drift), accuracy changes when ground truth arrives (concept drift), feature distribution changes, and business metrics (CTR, conversion, revenue). Use tools like Evidently AI, WhyLabs, or NannyML for automated drift detection.

Q6: Should I use a large LLM or a smaller specialized model?

FactorLarge LLMSmaller Specialized Model
AccuracyHigh on diverse tasksComparable or better on specific task
LatencyHigher (500ms—2s)Lower (10—100ms)
CostHigher (GPU, API fees)Lower (CPU, smaller instances)
MaintenancePrompt engineering, RAG setupStandard ML pipeline
Data needsPrompt examples, retrieval corpusLabeled training data

Use an LLM when you need generalization across many tasks. Use a smaller model for a specific, well-defined task with latency/cost constraints.

Q7: How do I A/B test ML models?

Route a portion of traffic to the new model (challenger) and the rest to the current model (champion). Measure business metrics (CTR, conversion, revenue) and model metrics (latency, error rate, prediction distribution). Use statistical significance tests before declaring the challenger the winner. Shadow deployments run the challenger silently before A/B testing.

Q8: What infrastructure do I need to start?

Start simple: feature store = S3 + Parquet, model registry = filesystem + metadata CSV, serving = Flask/FastAPI on a single instance. Add complexity only when needed: online feature store (Redis) when latency matters, model registry (MLflow) when you have multiple models, inference server (Triton) when GPU optimization is needed, monitoring (Prometheus) when you need alerts.

Exercise: Come up with 3 additional FAQ questions that were not covered in this chapter. For each: write the question, then write a concise answer. Share with a peer and see if they agree with your answers.