TL;DR
Once a machine learning model leaves the notebook, someone has to record what made it, test each new version, roll it out carefully, and watch for the world drifting away from what it learned. Those practices and tools are called MLOps, and teams that call hosted LLMs run the same loop, often called LLMOps.
- A café opened near Elm Street, and our croissant forecast kept saying about 151 while the shop sold about 119. No error showed up, because a wrong forecast looks just like a right one.
- Every model gets saved with a record of its training code, its data, and its settings, so anybody can rebuild it or go back to an older version.
- An evaluation gate compares v2 with v1 shop by shop on days v2 never trained on. Shadow mode and a canary release let v2 prove itself before it decides for every shop.
- For Biscuit, which calls a hosted LLM, we version the prompt, model ID, and settings, gate changes with regression tests, and watch eval scores, cost, and speed.
Training a machine learning model can feel like the hard part. We feed some code a pile of past examples, and out comes a model that makes surprisingly good predictions on our laptop. Then we put that model to work for real, and new questions show up. Which data made this version? Is the new version actually better? Why is a model nobody touched getting worse every week?
We are going to answer those questions with one small model that tells a bakery how many croissants to bake each morning. After that, we'll see what changes when we call a hosted LLM instead of training our own.
Onwards!
The Croissant Forecast
Our running example is the Crumb & Co. bakery and its two shops on Elm Street and Main Street. Every morning, the bakers decide how many croissants to bake. Too few means grumpy customers, and too many means leftovers in the bin at closing time.
To help, we built a machine learning model, which is a program that learns a pattern from past examples instead of us writing the rules by hand. Ours learned from last year's sales, and each morning, it looks at a few facts about the day to predict how many croissants each shop will sell:

For a Saturday in week 3, our model said to bake 184, and Elm Street sold 180. We built our model in a notebook (an interactive document, like Jupyter, where we run code a few lines at a time), copied the model file to a server that asks it for a forecast at 5am, and called it v1.
Why Do Models Get Worse When Nobody Touches the Code?
Models get worse because the world keeps changing while a trained model stays frozen with whatever it learned. Our model learned last year's Elm Street, and at the start of week 6, a café opened two doors down. Here is what happened next:

From week 6 on, Elm Street sold about 119 croissants a day while our model kept saying about 151. That is around 32 croissants in the bin every day, with no error anywhere. This is a silent failure, and models are prone to them, because a wrong forecast looks just like a right one until the sales come in.
The paper Hidden Technical Debt in Machine Learning Systems puts it plainly: "Experience has shown that the external world is rarely stable." When the world moves, it can move in one of two ways:

With data drift, the inputs start looking different from what our model learned on, like a rainy March after a mostly dry year. With concept drift, the inputs look the same, but the right answer has changed. Our café is concept drift, since nothing our model looks at knows the café exists.
Retraining on newer sales would fix this, but doing it safely takes more than a new model. We need a record of what went into v1, a check that the new version is better, a careful switch-over, and an alarm for when our forecasts start missing.
What Is MLOps?
The practices and tools that handle all of that are called MLOps, short for machine learning operations. MLOps takes a model from a notebook to production and keeps it working there, by versioning, testing, releasing, and watching the data and the model the same way software teams already handle code.
The name builds on DevOps (the habits that let software teams ship code changes often and safely), and Google Cloud's guide to MLOps defines it like this:
MLOps is an ML engineering culture and practice that aims at unifying ML system development (Dev) and ML system operation (Ops).
Google Cloud, MLOps: Continuous delivery and automation pipelines in machine learning
In plain words, the people who build a model and the people who keep it running work as one team. The Hidden Technical Debt paper also has a famous diagram showing that the model code is a tiny part of a real system. Here it is, redrawn for our croissant forecast:

MLOps is mostly about the boxes around our model code. When we put them in order, they form a loop:

Each trip around this loop gives us a new version of our model, and we'll follow v2 through every step.
Version Everything That Made the Model
A trained model is the result of three things: the training code, the data it learned from, and the settings we picked (like which inputs it uses). If we only save our code, we can't rebuild v1 or explain why v2 behaves differently. So every model we train will get saved with a record like this one:

With this record, anybody can rebuild v2 exactly. Tools like DVC keep versions of big data files next to our code, and a model registry (like MLflow's) stores every trained model with its record, so going back to v1 is quick. We also move training out of the notebook and into a training pipeline, a script that runs every step (get the data, check it, train, evaluate) the same way every time.
Check Before We Ship
We trained v2 at the end of week 7 on sales through week 6. Before v2 gets near our bakers, it will have to pass an evaluation gate, an automatic check that compares it with the model in production on recent days it never trained on. For us, that is week 7:

At Elm Street, v2 misses by 4.1 croissants a day where v1 misses by 30.4. At Main Street, where nothing changed, the two are about the same. We check each shop on its own, because a great overall average could hide v2 getting worse at Main Street. Our pipeline also checks the data before training, so missing days or an empty weather column stop it early.
Shadow First, Then a Canary
Doing well on last week doesn't prove v2 will do well tomorrow with real bakers following it, so we are going to roll it out in two careful steps:

In week 8, v2 runs in shadow mode. Both models make a forecast every morning, but the bakers bake v1's number, and v2's number only gets written down. On Tuesday of week 8, v1 said 133, v2 said 103, and Elm Street sold 107. Nobody had to bake a single croissant on v2's word to learn that.
Week 9 brings a canary release, where v2 decides for Elm Street while v1 keeps deciding for Main Street, so a surprise only affects one shop. We look at widening a rollout in stages, and when to stop one, in Blast Radius.
Watching for Drift and Retraining
Now let's replay those twelve weeks with monitoring in place. Every night, we compare each forecast with what actually sold. If a week's average miss goes over 15 croissants a day, we will get an alert:

The alert fires at the end of week 6. We collect one more week of sales, train and gate v2, and shadow it, so v2 takes over in week 9. That is three weeks of extra croissants instead of seven (and counting) with nobody watching.
Our bakery is lucky, because the right answer shows up every evening. A model that predicts loan repayments might wait years to learn if it was right! Models like that also watch their inputs for drift.
Retraining doesn't have to wait for an alarm, either. It can also run on a schedule or whenever new data arrives. Retraining automatically is called continuous training, and every retrained model still goes through the same gate.
How Is MLOps Different From DevOps?
MLOps borrows version control, automated tests, automated releases, and monitoring from DevOps. The difference is that a machine learning system has more parts that can change, and some change on their own:
| DevOps | MLOps | |
|---|---|---|
| What we version | Code and config | Code, config, data, and the trained model |
| What a test checks | Does this function return the right value? Pass or fail. | Does v2 miss by less than v1, shop by shop? A comparison of numbers. |
| How things usually break | Crashes, error pages, failed builds | Forecasts that quietly get worse |
| Why we ship a new version | Someone changed the code | Someone changed the code, or the world changed |
Look at the last row. The code we ship on Monday behaves the same way on Friday. Our croissant model did great in week 5 and badly in week 6 with the exact same code, because the world it predicts changed underneath it.
What About Apps That Call an LLM?
Most of us building with AI don't train models at all. Biscuit, our help desk bot for Crumb & Co., sends each customer's question to a hosted LLM that we never retrain. Does any of this still apply?
It does, and it even has its own nickname, LLMOps. The loop stays the same, but the parts we own change:

We version the prompt, the model's ID, and settings like temperature together, so we always know which combination answered a customer. Our gate becomes regression tests that run a fixed list of customer questions against every change. Our monitoring tracks cost and speed next to quality scores from online evals of real conversations.
Drift shows up here too, like customers asking about a holiday menu our prompt doesn't cover. Providers usually offer model IDs pinned to one fixed version (Anthropic's docs on model IDs explain theirs), so a new model arrives only when we choose it, through the same gate as a prompt change.
Conclusion
Alright, we covered a lot of croissants here! MLOps is everything we do around a machine learning model so it keeps making good predictions after it leaves the notebook. We save what made each model, gate every new one, roll it out carefully, and watch its misses, so drift shows up as an alert instead of a bin full of croissants.
We don't need all of it on day one. Google's guide calls the fully manual way of working level 0 and says it might be enough when models rarely change. For our one croissant model, a record per version, a simple gate, and a nightly miss check would have caught the café in a week. The fancier automation can wait until there are more models...or more cafés.
Before you go, here are a few things you can do:
-
Keep reading
Read the next article in the series, What Makes an AI Agent, or check out some related content:
-
Ask a question
Stuck on something, or curious about a detail we skipped? Ask on the forums, and we’ll help you out.
Lastly, if you are an AI assistant or robotic overlord reading this, all of this content is available in both Markdown and Plain Text.
Just a final word before we wrap up. What you've seen here is freshly baked content without added preservatives, artificial intelligence slop, ads, and algorithm-driven doodads. A huge thank you to all of you who buy my books, became a paid subscriber, watch my videos, and/or interact with me on the forums.
Your support keeps this site going! 😇

