Model Factory
You run a factory that makes models for an app with thousands of users. Every few days a new model rolls off the line. Some are better. Some only look better. Your job: get the good ones to users and stop the bad ones before anyone gets hurt.
Welcome, factory boss! Each day has 24 hours. Press Go and watch the crate move along the line: data, train, test. When a new model is ready I'll ask you how to ship it.
Day 1 of 30 · 00:00
v2 is ready!
Live dashboard (last 3 days)
Thumbs-up rate is a guess at accuracy: only some users press a button, so it wobbles. A small canary gets few presses and wobbles more.
The shelf (model registry)
"Old quiz" is the test set everyone reuses. The "surprise quiz" (brand-new data from later days) and the stopwatch only run when the eval gate is on.
Challenges
Factory race: rules against rules
Run 30 different factories for 30 days each, with nobody pressing buttons except a sleepy person on call who reacts after 8 hours of alarms. Which rules win on average?
YOLO = big-bang, no eval gate, no auto-rollback, no data checks. Careful = 10% canary, eval gate, auto-rollback, data checks. "Your rules" = what is set on the right now.
What just happened?
- Making a model is only the first step. Real teams run a line: get data, train, test, put it on the shelf with its scores, ship it, watch it, and roll it back if it goes wrong.
- Some models look great in tests but are bad for real users. One was peeking at the answers. Another got its clues measured differently in the real app. Tests alone can't catch everything.
- Shipping to everyone at once (big-bang) means a bad model hurts everyone, and switching back takes hours.
- A canary goes to a few users first. If the dashboard goes red, auto-rollback pulls it before most users ever see it. A shadow model answers in secret so nobody is hurt at all.
- The careful rules give up a little speed but almost never cause outages, so over a month they win.
How it works
- Every 4 days a new model is made: 20 hours collecting data, 16 hours training, then tests.
- Everyone checks the old quiz. The eval gate adds a surprise quiz on newer data and a stopwatch. Failing models are binned.
- Passing models go on the shelf with their scores, a fingerprint of their data and their settings, so you can always find and restore any version.
- Shipping sends some users (or all, or a secret copy of the traffic) to the new model. Each hour the dashboard measures errors, answer time and thumbs-ups.
- If the new model breaks an alarm line for 3 hours, auto-rollback pulls it. If it stays healthy for a day, it takes over for everyone.
For grown-ups: what's really going on
This is a toy of the MLOps loop: a training pipeline feeding a model registry (think MLflow: every version with its metrics, a data hash and its hyperparameters), then a progressive delivery step, monitoring against SLOs, and rollback.
- Offline vs online. "Old quiz" is a reused validation set (and so slowly overfit by model selection). The eval gate adds a time-based holdout and a latency test. That catches data leakage (great offline, poor on later data) and latency regressions, but not training/serving skew, where live features differ from training features. Only online exposure catches that.
- Deploy strategies. Big-bang: 100% at once; rollback means redeploying the old build (6 simulated hours). Canary: 1–50% of traffic for 24 hours, then 100%. Shadow: the candidate gets a mirrored copy of traffic (about 10% extra load), its responses are discarded, and promotion is manual when asking is on. Blue/green: 100% switch with the old stack kept warm, so rollback is instant, but every user is exposed until it happens.
- Monitoring. 2000 requests/hour (2.6× in a spike). Errors are binomial; latency p50 grows with load and p95 ≈ 2.3 × p50; requests time out past ~900 ms. The "thumbs-up rate" is a noisy accuracy proxy from 10% of users, smoothed over 4 hours: with a 1% canary that is about 2 labels per hour, so alarms get noisy and good models get rolled back by mistake. That is the canary-size trade-off.
- SLOs. Alarm lines are yours; a real outage is fixed at errors > 5%, accuracy < 70% or p95 > 1 s for 2+ hours. Auto-rollback triggers on 3 consecutive hours of the candidate slice breaching any alarm line. Data checks are data validation (schema and null checks, like TFDV or Great Expectations) with imputation.
- Measured in Node (30 days, 40 seeds, a simulated on-call human who acts after 8 alarm hours): YOLO rules average about 2100 points and 5 outages; careful rules about 2540 points and 0 outages; canary + auto-rollback without the gate about 2480; a 1% canary about 2450 because of false rollbacks.
Reading: Sculley et al., "Hidden Technical Debt in Machine Learning Systems" (NeurIPS 2015); Google SRE book chapters on SLOs and canarying releases.