Sub topic 1
Identify model versions and the known-good release
Prerequisites
This chapter assumes you know basic machine learning deployment, can read a model registry or release log, have command-line and version-control skills, and understand how a service exposes predictions through an API.
Model versions and the known-good release
A model version is a numbered, immutable release of a trained model artifact. The known-good release is the most recent version that passed validation and ran in production without regressions. Identify it before you need it.
For each release, record the version, its status, and the artifact digest (a hash that identifies the exact file). The following code selects the newest validated release that is not the current production release:
from dataclasses import dataclass
@dataclass(frozen=True)
class ModelRelease:
version: str
status: str
artifact_sha256: str
releases = [
ModelRelease("2026.03.01", "validated", "sha256:aaa"),
ModelRelease("2026.03.08", "validated", "sha256:bbb"),
ModelRelease("2026.03.15", "production", "sha256:ccc"),
]
known_good = next(
release for release in reversed(releases[:-1])
if release.status == "validated"
)
print(known_good.version, known_good.artifact_sha256)What must roll back with the model
A model rollback restores only the model artifact. A full application rollback also restores code, feature schemas, and dependencies. Check whether the known-good model needs a specific preprocessing code version or feature schema. If it does, roll those units back together.
Deployment strategies that support rollback
- Blue-green: Two full environments run side by side. Switching back is one routing change.
- Canary: A small share of traffic reaches the new version first.
- Shadow: The new model scores copies of requests, but users receive only the old model's answers.
Choose the strategy that lets you move traffic back fastest with the least risk.
Production signals that reveal regressions
Watch three kinds of signal. Model signals include the prediction distribution and accuracy on labeled samples. Service signals include error rate and p95 latency. Business signals include conversion and complaint rates.
Objective rollback triggers
Set thresholds before the deployment, not during an incident.
| Signal | Example threshold |
|---|---|
| Error rate | Above 2x the baseline |
| p95 latency | Above 250 ms |
| Drift detected | Any confirmed drift alert |
> Note: the rollback trigger should be written into the release plan, so the decision does not depend on who is on call.
Exercise:
Exercise
A canary serves 10% of traffic. Its error rate is 0.05 and the baseline is 0.02. The rollback threshold is 2x the baseline. Should you roll back?
Show answer
Yes. The threshold is 0.02 x 2 = 0.04, and 0.05 is higher, so the trigger fires.