Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.A library for models
A library keeps every edition of a book, records where each came from, and marks which edition is currently on the shelf. A model registry does the same for trained models. When a new model arrives, someone (or a rule) must decide whether it replaces the current one, and if it turns out badly, the previous one must come back quickly. Those decisions are surprisingly easy to get wrong: a test that is too strict blocks every improvement, and a test that checks the wrong thing lets broken models through.
McNemar's test finds a challenger significantly better in 1% (gain 0 pt), 17% (gain 1 pt), 66% (gain 2 pt), 100% (gain 5 pt) of trials.
N2-2, seed 0: monthly retraining as the world drifts; a quarter of candidates carry a pipeline bug. A frozen holdout blocks every update; only a signature check stops a model whose columns are in a different order.
In Exercise 2, judging candidates on a holdout set frozen at month 0 left a two-year-old model in service, with live accuracy 0.62; judging them on recent data and checking their input signature gave 0.83.
- 1. A model registry stores…
- 2. Serving should load…
- 3. Rollback means…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Version: an immutable model artifact with a number, metrics, lineage (data, code, parameters) and an input/output signature.
- Stages or aliases: None, Staging, Production, Archived (MLflow); newer registries use aliases such as “champion”.
- Promotion gate: the checks a candidate must pass to become Production: tests, signature, comparison with the champion, approvals.
- Champion and challenger: the current model and a candidate compared on the same examples.
- Paired tests: McNemar’s test on the examples where two classifiers disagree; paired bootstrap intervals for the difference.
- Shadow and canary deployment: the candidate scores live traffic without (shadow) or with (canary) affecting users before full promotion.
- Rollback: switching Production back to the previous version.
- Tools: MLflow Model Registry, SageMaker Model Registry, Vertex AI Model Registry, Weights & Biases Registry.
- 1. McNemar's test uses…
- 2. A shadow deployment…
- 3. A model signature describes…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.A registry with promotion and rollback
Exercise 1.
- Registry: register a version with metrics, lineage and signature; transition stages (promoting archives the old champion); look up Production; roll back to the previous champion.
- Signature check: inputs must have the registered columns in the registered order.
- Exact McNemar test and a paired bootstrap interval for the accuracy difference.
- A drifting world: logistic data whose true weight vector rotates by 0.12 radians a month.
Practice.
- Register every model with lineage and signature, automatically from the training pipeline.
- Compare challenger and champion on the same recent examples, with a paired test and a minimum gain that matters.
- Check the interface, not just the score: signatures, schemas and a shadow run on live traffic.
- Automate rollback and keep the previous champion ready.
- Record who or what promoted each version and why.
def promote(registry, cand, holdout):
champ = registry.production()
if not check_signature(cand.signature, SERVING_COLUMNS):
return False
a, b = correct(champ, holdout), correct(cand, holdout)
if b.mean() > a.mean(): # optionally: and mcnemar_p(a, b) < 0.05
registry.transition(cand, "Production")
return True
return False- 1. Challenger and champion should be compared…
- 2. A candidate that scores well in its own pipeline can still fail if…
- 3. Rollback should be…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Paired comparison. On n shared examples let b count those only the champion gets right and c those only the challenger gets right. The accuracy difference is (c − b)/n: examples both get right or both get wrong do not matter. If the two models are equally accurate, each discordant example is equally likely to favour either, so b is binomial with b + c trials and probability ½; McNemar’s exact test computes the two-sided tail probability. Detecting a gain g needs enough discordant examples: here, with 15% disagreement, a 2-point gain was detected in about two thirds of trials with 2,000 examples, and a 1-point gain in 60% with 8,000.
Stale benchmarks. A holdout set drawn once is a sample of one moment. When the world drifts, a model fitted to that moment wins on it, and every newer, better model loses; the registry then keeps an outdated champion. Holdouts for promotion should be recent, and long-lived benchmarks need refreshing.
Interface errors. A candidate evaluated by its own pipeline applies its own column order to both training and evaluation data, so its holdout score is exactly what a correctly wired model would get. Nothing in that computation depends on the order the serving system uses, so no offline score can reveal the mismatch; a signature check or scoring live, serving-built inputs (shadow mode) can.
Strict gates under drift. Requiring statistical significance protects against promoting noise but delays real improvements; under steady drift those delays cost accuracy, so the gate should balance the cost of a bad promotion against the cost of waiting.
- 1. The accuracy difference on paired examples equals…
- 2. Under drift, a holdout frozen in the past favours…
- 3. A column-order bug cannot be seen in…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Over two years of monthly retraining in a drifting world, with some candidates broken, which promotion policy keeps the best model in service?
History.
- Q. McNemar (1947) introduced the test for paired proportions; T. Dietterich (1998) recommended it for comparing classifiers on one test set; B. Efron (1979) introduced the bootstrap.
- Continuous delivery (J. Humble and D. Farley, 2010) made staged releases and rollback standard; champion-challenger testing comes from credit-risk modelling.
- E. Breck and colleagues (2017) included canarying and rollback in Google’s ML Test Score; MLflow’s Model Registry (2019) and the cloud platforms’ registries made stages and lineage part of the workflow.
Exercise 2.
- Month 0: a model trained on 4,000 examples is Production. Each month from 2 to 25 a candidate is trained on the two previous months; a quarter of candidates have a bug: columns in a different order (recorded in its signature), half of the positive labels lost by a join, or training stopped after 5 steps.
- Candidates are evaluated on 1,000 holdout examples by their own pipeline; the Production model then serves 5,000 live examples built in the serving system’s column order.
Seed 0:
| policy | mean live accuracy | months served by a buggy model | of which swapped columns | promotions |
|---|---|---|---|---|
| always promote the newest | 0.7966 | 7 | 3 | 24 |
| better on a holdout fixed at month 0 | 0.6239 | 0 | 0 | 1 |
| better on a recent holdout | 0.8143 | 5 | 2 | 19 |
| recent holdout + signature check | 0.8329 | 3 | 0 | 17 |
| signature + significantly better (McNemar p below 0.05) | 0.8258 | 3 | 0 | 8 |
Seeds 1 and 2: always newest 0.8247 and 0.7784; fixed holdout 0.6221 and 0.6083 (1 and 0 promotions); recent holdout 0.8337 and 0.8172; recent + signature 0.8337 and 0.8332 (never a swapped-column model); significantly better 0.8266 and 0.8255 with 10 and 8 promotions.
Findings.
- The frozen holdout kept the month-0 model (or one more) in service for two years, at 0.61 to 0.62 live accuracy, in every seed.
- Recent holdout plus a signature check gave the best or tied-best live accuracy in every seed (0.833 to 0.834) and never served a model with swapped columns; without the signature check, swapped-column models served 0 to 2 months.
- Requiring significance halved the promotions and cost 0.7 to 0.8 points of live accuracy under this steady drift.
Model registries in practice
- Workflow: training pipelines register versions automatically; CI runs tests and evaluations; promotion is a pull-request-like approval or an automated gate; serving resolves an alias such as “production” at load time (topic N3-1).
- Regulated domains (finance, medicine) require the registry’s audit trail: who approved which version, on what evidence.
- Space and science missions version onboard models with the same discipline: every uploaded model is traceable to its data, code and tests, and the previous one can be restored.
References
- Q. McNemar (1947). “Note on the sampling error of the difference between correlated proportions or percentages.” Psychometrika.
- T. G. Dietterich (1998). “Approximate statistical tests for comparing supervised classification learning algorithms.” Neural Computation.
- B. Efron (1979). “Bootstrap methods: another look at the jackknife.” Annals of Statistics.
- J. Humble and D. Farley (2010). “Continuous Delivery.” Addison-Wesley.
- E. Breck, S. Cai, E. Nielsen, M. Salib and D. Sculley (2017). “The ML test score: a rubric for ML production readiness and technical debt reduction.” IEEE Big Data.
- MLflow (2019–). “MLflow Model Registry.” mlflow.org documentation.