MLOps Crash Course
All of MLOps on one page — serving, containers, orchestration, CI/CD, registries, monitoring, drift, caching, and the LLM-specific operational problems
MLOps Crash Course
Start here
This single page covers all of MLOps at working depth. Read it start to finish in about 30 minutes and you will understand the gap between a working notebook and a reliable production system, and the standard toolkit — serving, containers, orchestration, CI/CD, registries, monitoring, drift detection, caching, and LLM-specific gateway concerns — used to close it.
Every section ends with a Go deeper link to a full page on that topic. Read this first, then follow the links for whatever you need in detail.
| Property | Value |
|---|---|
| Level | Everyone — starts from zero, ends at production |
| Reading time | ~30 minutes |
| Prerequisites | None. Basic familiarity with APIs and the command line helps. |
| You will understand | The whole MLOps toolkit, well enough to take a model from notebook to a monitored, scaled production system |
1. The Gap MLOps Exists to Close
The one-sentence definition
MLOps is the discipline of making a model's behavior in production as reliable, observable, and controllable as its behavior in a notebook — because a model that works once, on a laptop, on a held-out test set, is not the same thing as a model serving real traffic reliably, month after month, as the world it's making predictions about keeps changing.
| Challenge | Without MLOps | With MLOps |
|---|---|---|
| Deployment | Manual, error-prone releases | Automated CI/CD with validation gates |
| Monitoring | Silent degradation, nobody notices until a complaint | Real-time drift detection and alerting |
| Scaling | Fixed resources — over-provisioned or falls over under load | Auto-scaling matched to actual demand |
| Versioning | "Wait, which model is actually in production?" | A registry with explicit stage management |
| Cost | Uncontrolled, surprising API/compute spend | Caching, routing, and active cost tracking |
Go deeper: What Is MLOps? — MLOps vs DevOps vs DataOps, and why ML systems fail in ways ordinary software doesn't.
2. Serving a Model
The simplest production shape: wrap the model in an API.
from fastapi import FastAPI
app = FastAPI()
@app.get("/health")
def health():
return {"status": "ok"}
@app.post("/predict")
def predict(payload: PredictRequest):
return {"prediction": model.predict(payload.features)}A /health endpoint that only checks "is the process running" is not a health check. A process can be alive while its model failed to load, its GPU is out of memory, or its dependency (a vector database, a cache) is unreachable. A real health check exercises the actual prediction path, or at minimum confirms the model and its dependencies are genuinely ready.
| Pattern | Use when |
|---|---|
| Synchronous REST | Latency-sensitive, one prediction per request |
| Batching | Throughput-sensitive — group several requests into one model call |
| Async/queue-based | Long-running inference, or traffic spikes you want to smooth out |
Go deeper: Model Serving Patterns.
3. Packaging It: Containers
A container bundles the model, its code, and every dependency into one reproducible artifact — "works on my machine" becomes "works everywhere this image runs."
FROM python:3.12-slim AS builder
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
FROM python:3.12-slim
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
COPY . /app
WORKDIR /app
CMD ["uvicorn", "main:app", "--host", "0.0.0.0"]Multi-stage builds exist because ML dependencies are large. Compiling and installing packages needs build tools that the final running image doesn't — a multi-stage build keeps those tools out of the image that actually ships, which can be the difference between a multi-gigabyte image and a few hundred megabytes.
Go deeper: Containerization & Packaging — GPU-enabled containers, image size discipline, Docker Compose for local multi-service setups.
4. Running It at Scale: Orchestration
One container is a demo. Production means many containers, started, stopped, and scaled automatically as load changes — that's orchestration, and Kubernetes is the standard.
A request under auto-scaling
| Tool | Scales on |
|---|---|
| HPA (Horizontal Pod Autoscaler) | CPU/memory utilization, or a custom metric |
| KEDA | Event-driven signals — queue depth, request rate — especially useful for bursty ML workloads |
| Request batching | Grouping concurrent requests into fewer, larger model calls, often combined with scaling rather than instead of it |
GPU workloads scale differently than CPU ones. A GPU-backed pod is expensive and slow to start (loading model weights takes real time), so naive CPU-style autoscaling that spins pods up and down aggressively can cost more in cold-start latency than it saves in idle compute. Scale GPU-backed services more conservatively than stateless CPU services.
Go deeper: Orchestration & Scaling.
5. Shipping Changes Safely: CI/CD for ML
Ordinary software CI/CD tests code. ML CI/CD has to test the model too — and a model can pass every code test while still being a worse model.
What an ML pipeline validates that ordinary CI doesn't
Code tests
Does the serving code run, handle malformed input, return the right shape of response? Standard software testing, still necessary.
Model validation gates
RecommendedDoes the new model beat the current one on the held-out evaluation set? Does it regress on any known-important slice of the data? These gates block a deploy the same way a failing unit test would — a model with a lower or unknown score has no business auto-deploying.
Blue-green and canary deploys extend this into the release itself: route a small fraction of real traffic to the new model first, watch its live metrics, and only shift the rest of traffic over once it's proven itself — the same discipline as any high-stakes software release, applied to a model swap.
Go deeper: CI/CD for ML.
6. Knowing Which Model Is Actually Running: The Registry
A model registry is the source of truth for every trained model version, its metadata (metrics, training data, who trained it), and its stage (staging, production, archived).
my-classifier
v12 → Staging (just trained, passed validation, not yet live)
v11 → Production (currently serving real traffic)
v10 → Archived (previous production version, kept for rollback)"Which model is in production" should be a query, not a Slack thread. Without a registry, that question gets answered by asking whoever deployed it last, if they remember, and if they're still on the team. A registry makes it an auditable fact.
Go deeper: Model Registry & Versioning — MLflow and equivalent tools, stage transitions, artifact storage.
7. Watching It Work: Monitoring and Observability
A model that silently gets worse is more dangerous than one that loudly fails — it keeps serving confidently wrong predictions while everything looks healthy.
| Layer | What to watch |
|---|---|
| System metrics | Latency, throughput, error rate, resource usage — standard software observability |
| Model quality metrics | Prediction confidence distribution, agreement with eventual ground truth, business-metric proxies |
| Data drift | Is the live input distribution still shaped like the training distribution? |
"The service is up" and "the model is still good" are different claims, checked by different signals. A model can return 200 OK on every request while its predictions have quietly become useless because the world it's predicting about changed. System monitoring alone will never catch that — only model-quality and drift monitoring will.
Go deeper: Monitoring & Observability — Prometheus/Grafana, structured logging, tracing.
8. When the World Changes Under the Model: Drift
Data drift is the live input distribution diverging from what the model was trained on. Concept drift is subtler: the relationship between inputs and the correct output changes, even if the inputs themselves look the same.
Data drift: "Customers now write shorter reviews" — inputs changed
Concept drift: "The same review wording now means something different"
(e.g. a word that used to signal complaint now signals sarcasm/praise)Concept drift is the harder one to catch, because the input distribution can look perfectly normal while the model's predictions quietly become wrong — statistical drift detection on the inputs alone won't see it. Catching it usually needs some feedback signal on actual outcomes, not just monitoring what comes in.
Go deeper: Data & Model Drift.
9. Controlling the Bill: Caching and Cost
For LLM-backed systems specifically, inference cost is often the largest and most volatile line item — and much of it is avoidable.
| Technique | Saves |
|---|---|
| Exact-match caching | Identical requests skip the model entirely |
| Semantic caching | Requests that mean the same thing, even if worded differently, hit a cached response |
| Routing to a cheaper model | Easy requests go to a small/cheap model; only hard ones reach an expensive one — the same escalation pattern covered in the Small Language Models track |
Semantic caching needs a similarity threshold tuned carefully, not just "close enough." "What's the refund window?" and "what's the return window?" should hit the same cache entry; "what's the refund window?" and "how do I cancel my refund request?" should not, even though they're superficially similar. A threshold that's too loose returns confidently wrong cached answers, which is worse than no caching at all.
Go deeper: Caching & Cost Optimization.
10. Knowing If a Change Actually Helped: A/B Testing
Deploying a new model isn't the end of the story — proving it's actually better is a separate, statistical exercise.
A/B testing a model change
Multi-armed bandits are the adaptive alternative to a fixed A/B split — they shift traffic toward the better-performing arm as evidence accumulates, rather than waiting for a fixed sample size before deciding. Worth it when the cost of serving the losing variant for the full test duration is high.
Go deeper: A/B Testing & Experimentation.
11. LLM-Specific Operations: The Gateway
LLM-backed systems have operational needs a traditional ML model doesn't: multiple providers, rate limits, streaming, and highly variable per-request cost. A gateway centralizes this instead of scattering it across every calling service.
What an LLM gateway centralizes
Routing
Reliability
Observability
This is the operational counterpart to Inference Providers from the HuggingFace track — a gateway is what a production system builds around a routed multi-provider API, adding the reliability and cost-control layer a raw API client doesn't give you for free.
Go deeper: LLM Gateway & Routing.
12. Feature Stores and Data Pipelines
For traditional ML (not pure LLM systems), the features fed to a model at training time and at serving time must match exactly — a mismatch here is one of the most common, and most silent, sources of production failure.
Training-serving skew is the classic ML production bug. If a feature is computed one way in an offline training pipeline and a subtly different way in the online serving path — different rounding, a different time window, a different null-handling rule — the model silently sees different inputs than it was trained on, and nobody notices until accuracy quietly drops. A feature store exists specifically to compute a feature once and serve the identical value both ways.
Go deeper: Feature Stores & Data Pipelines.
13. Security and Governance
| Area | What to get right |
|---|---|
| Access control | Who can deploy a model to production, and who can query which data |
| PII handling | What personal data enters prompts/features, and how it's scrubbed or protected |
| Audit trails | Who deployed what, when, and what it replaced — the registry's stage history is part of this |
| Model governance | Approval workflows for high-stakes model changes, not just automated gates |
Go deeper: Security & Governance.
14. When It Breaks
| Symptom | Usual cause |
|---|---|
| Service returns 200 but predictions are garbage | Model failed to load correctly, or a dependency (cache, vector store) silently degraded — a shallow health check missed it |
| Accuracy drops slowly over weeks | Data or concept drift — check the input distribution against training data |
| Costs spike unexpectedly | Cache hit rate dropped, or a routing rule sends more traffic to an expensive model than intended |
| "Works in staging, fails in production" | Training-serving skew, or an environment/config difference the CI pipeline didn't catch |
| A new model deploy regresses quality | Missing or too-loose a validation gate — the pipeline let a worse model through |
| Autoscaling doesn't respond to real load | Scaling on the wrong metric (CPU) for a workload that's actually GPU- or queue-bound |
Go deeper: Failure Modes & Debugging.
15. Vocabulary You Need
| Term | Meaning |
|---|---|
| Health check | An endpoint confirming the service — and ideally the model and its dependencies — is actually ready |
| Multi-stage build | A Docker pattern keeping build-time tools out of the final shipped image |
| HPA / KEDA | Kubernetes autoscalers, on resource metrics or event-driven signals respectively |
| Validation gate | A CI/CD check that blocks deployment unless a model meets a quality bar |
| Blue-green / canary deploy | Releasing a new version to a subset of traffic before a full rollout |
| Model registry | The versioned, staged source of truth for trained models |
| Data drift | The live input distribution diverging from the training distribution |
| Concept drift | The relationship between inputs and correct outputs changing |
| Semantic caching | Caching by meaning, not just exact request match |
| A/B test | Comparing two versions via a real, randomized traffic split |
| Multi-armed bandit | An adaptive alternative to a fixed A/B split |
| LLM gateway | A centralized layer for routing, reliability, and cost-tracking across LLM providers |
| Feature store | A system ensuring training and serving compute the same feature the same way |
| Training-serving skew | A mismatch between offline and online feature computation |
Go deeper: Glossary.
16. The Rules
| # | Rule |
|---|---|
| 1 | A working notebook is not a production system. MLOps is the gap between the two, not an afterthought. |
| 2 | A health check must exercise the real path, not just confirm the process is alive. |
| 3 | Validate the model, not just the code. A model can pass every code test and still be worse. |
| 4 | "Which model is in prod" should be a query, not a Slack thread. Use a registry. |
| 5 | "The service is up" and "the model is still good" are different claims. Monitor both. |
| 6 | Silent degradation is more dangerous than a loud failure. Drift monitoring exists for exactly this. |
| 7 | A loose semantic-cache threshold is worse than no cache. It returns confidently wrong answers. |
| 8 | Prove a change helped before rolling it out fully. A/B test, don't assume. |
| 9 | Centralize LLM provider logic in a gateway, not scattered across every calling service. |
| 10 | Training-serving skew is the classic silent ML bug. Compute each feature once, serve it identically both ways. |
| 11 | GPU workloads don't autoscale like CPU ones. Cold-start cost changes the right scaling policy. |
| 12 | Access control and audit trails aren't optional extras. They're what makes an incident answerable. |
17. Where To Go Next
Getting a model into production
| Page | Covers |
|---|---|
| What Is MLOps? | The prototype-to-production gap, MLOps vs DevOps |
| Model Serving Patterns | REST/gRPC, batching, async serving, real health checks |
| Containerization & Packaging | Multi-stage builds, GPU containers, image size |
| Orchestration & Scaling | Kubernetes, HPA/KEDA, request batching |
| CI/CD for ML | Validation gates, blue-green/canary deploys |
| Model Registry & Versioning | MLflow, stage management, artifact storage |
Keeping it healthy
| Page | Covers |
|---|---|
| Monitoring & Observability | Prometheus/Grafana, logging, tracing |
| Data & Model Drift | Detecting and responding to distribution and concept drift |
| Caching & Cost Optimization | Semantic caching, routing, LLM cost control |
| A/B Testing & Experimentation | Traffic splitting, significance, bandits |
Systems and governance
| Page | Covers |
|---|---|
| LLM Gateway & Routing | Centralized routing, reliability, and cost tracking for LLM providers |
| Feature Stores & Data Pipelines | Training-serving skew and how to prevent it |
| Security & Governance | Access control, PII, audit trails |
| Failure Modes & Debugging | Symptom to cause, across every stage |
| Designing an MLOps System | A full worked design with real numbers |
| Glossary | Every term and abbreviation |
Then build something
Reading takes you only so far. Project Ideas lays out one production-shaped project that ties serving, monitoring, and cost control together.