Registering a model, and what a version keeps
Turn a finished run into a version that keeps its files, data, scores and reproducibility check. Then use stages and aliases so your work never names a version number.
You will be able to
- List what a registered version keeps, and what can still change
- Read the reproducibility check before you trust a version
- Use stages and aliases, so that rolling back means moving a pointer
- Write the intended-use section of a model card
A good score isn't a model yet
ReadA row on a leaderboard tells you that a run scored well. It doesn't tell a colleague next year which preprocessing it used, or let them score a new table.
Registering turns a finished run into a model versionModel registryThe record of every model version with its files, data, code, scores and stage, so you can tell what is in use.: a folder that keeps everything needed to use and question it.
| File | What it keeps |
|---|---|
The model file and design.json | The fitted model and its fitted preprocessing |
manifest.json | Method, engine and package versions, scores, split plan, and a checksum of every file |
reference_profile.json, reference_sample.parquet | The training rows, summarized and sampled, for drift checks |
| A model card | A readable summary, in Markdown and JSON |
What happens when the data changes?
PredictPredict first
You register a version today. Next week you fix an error in the training data. What happens to that version?
Reveal
It stays as it was. Its fitted files don't change, which is the point: you can always ask what produced a score. To learn from the fixed data, you train again and register a new version. A version's stage, aliases and intended-use text can still change, because they describe how you use the model and not what it is.
Register one
In the appTrain a model (the walkthrough's model predicts {{target}}), open it from the leaderboard, and press Register. This walkthrough takes you through it, and on to scoring, drift and a monitor. You can stop after registering and come back.
Then open Models in the sidebar and find your version in the table.
Does the saved model behave like the trained one?
ReadA model that scores differently after saving is a bug you want to find now. So registration re-scores the training input through the saved files, and compares the test rows with the predictions the run made.
The version table shows the answer in the Scoring column:
| Badge | Meaning |
|---|---|
| Reproduces exactly / Reproduces | The saved files give the run's predictions |
| Not checked | The check was skipped; there's no evidence either way |
| Differs / Check failed | Don't use this version until you know why |
Two scores, and which to believe
ExploreThe table also lists CV and Test. CV is the mean across folds on the training rows, and Test is the score on the locked hold-out.
DExplorable · Cross-validation folds
Which rows should be held out so the score predicts real performance?
Each scheme has a tempting shortcut: training error, plain random folds, or the best score from a search. Will the shortcut here look better than the true error on new data?
Scheme
Commit your prediction above to see the result
Make your prediction to see the result.
Try each scheme and compare its tempting shortcut with the true error on new data. When a version's CV and Test disagree badly, ask whether its folds matched how the data really arrives.
Stages say where it is; aliases say what it's for
ReadA stage records where a version is in its life: Draft, Candidate, Approved, Deprecated or Archived.
An alias names a job: championChampion modelThe version currently trusted for real use; a challenger is one being compared with it, a shadow scores without acting., challenger or shadow. Each alias points at one version at a time. A monitor or endpoint that follows champion moves with it, so nothing else needs to change when you promote.
This also makes rollback one step: point champion back at the previous version.
Write the part only you know
ReflectThe Model card tab is generated from the manifest: details, training data, scores, reproducibility and caveats. It can't know what the model is for.
Think of a model you know. Write three sentences for its intended use:
- What the model is for.
- Who uses its predictions.
- Which decisions it must not drive.
The third sentence is the one people skip, and it's the one that prevents misuse.
Check your understanding
CheckpointCheck yourself
A new version's Scoring column says Differs. What should you do?
Show the answer
Answer: b
The scores on the page came from the run. If the saved files behave differently, those scores don't describe what you'd deploy.
Check yourself
A nightly job scores data with "version 7". You promote version 8. What's the better setup?
Show the answer
Answer: a
Aliases separate "which model" from "what it's used for". Versions don't change, so overwriting one would destroy the record you rely on.
Check yourself · choose all that apply
Which of these can change after a version is registered?
Show the answer
Answer: a, b, c
Stage, aliases and intended use describe how you use the version. The fitted files describe what it is, so they stay fixed, and the manifest records a checksum for each one.
Check a version's files yourself
In the appOn a version's Overview tab, press Show in Finder to open its folder. The manifest lists every file with its SHA-256 checksum, so you can confirm that nothing has been altered.
import hashlib
import json
from pathlib import Path
folder = Path("models/churn/3") # <project>/models/<name>/<version>
manifest = json.loads((folder / "manifest.json").read_text())
for f in manifest["files"]:
digest = hashlib.sha256((folder / f["name"]).read_bytes()).hexdigest()
print("ok " if digest == f["sha256"] else "CHANGED", f["name"])library(jsonlite)
library(digest)
folder <- "models/churn/3" # <project>/models/<name>/<version>
manifest <- fromJSON(file.path(folder, "manifest.json"), simplifyVector = FALSE)
for (f in manifest$files) {
d <- digest(file.path(folder, f$name), algo = "sha256", file = TRUE)
cat(if (identical(d, f$sha256)) "ok " else "CHANGED", f$name, "\n")
}Recap
Recap- A version keeps the fitted model, its preprocessing, its scores and a checksum of every file.
- Check that scoring reproduces training before you trust a version.
- Stages record where a version is; aliases say what it's used for, and moving one is how you promote and roll back.
- Write the intended use yourself, including what the model must not decide.
Concepts in this lesson