Designing model registry workflow
The user is looking for a model registry workflow that includes versioning, lineage, approvals, and promotion strategies like canary and batch processes. I need to create a concise but detailed document that covers definitions, stages, roles, metadata schema, state machines, CI/CD steps, governance, RBAC, audits, and reproducibility. I'll address artifacts, dataset snapshots, code commits, environments, and evaluations.
For promotions, I'll mention processes like champion/challenger methods, traffic splits, and rollbacks, ensuring it's clear and structured with step-by-step instructions and diagrams.Detailing promotion strategies
I'm outlining batch promotion, where I run a new model on a sample for comparison before executing a full run and tracking output versions. For online promotion, I’ll discuss blue/green or rolling methods while ensuring backward compatibility with the schema.
I want to include naming conventions, tagging, and GitOps integration, along with a model card. I'll mention typical tools like MLflow, SageMaker, or Vertex AI in a general way, and provide an example of metadata in JSON format.
1) Core concepts (what the registry stores)
Entities
Model : logical product name (e.g., fraud_scoring).
Model Version : immutable snapshot of a trained model + metadata (e.g., fraud_scoring@1.4.0).
Training Run : execution record that produced a version (links to pipeline run id).
Artifacts : serialized weights, tokenizer, calibration, thresholds, explainer, etc.
Environment : container image digest, dependencies lockfile, hardware/runtime constraints.
Data/Features : dataset snapshot ids, feature set version, feature definitions.
Evaluations : metrics, slices, fairness, robustness, latency, cost tests.
Approvals : sign-offs with role, timestamp, policy checks, and justification.
Deployments : batch job run ids, online endpoint revisions, canary configs.
Immutability rule
A model version is immutable. Only metadata additions (e.g., tags, approvals, deployment refs) are allowed; artifacts never change.
2) Versioning scheme
Use semantic versioning for the model version :
MAJOR.MINOR.PATCH
MAJOR : breaking changes (input/output schema change, feature set change, business rule change).
MINOR : new training data window, new algorithm, improved features, non-breaking behavior changes.
PATCH : bugfix in training code, calibration tweak, reproducibility fix with no intended behavior change (or trivial lift).
Additionally keep:
training_run_id (unique)
code_ref (git SHA + repo URL)
data_snapshot_id (immutable dataset version or query+snapshot hash)
feature_set_version
container_image_digest (sha256)
Naming
model_name: stable product identifier
version: semver
build_id: CI build identifier (optional)
3) Lineage (end-to-end traceability)
Every model version must store pointers sufficient to reproduce and audit:
Required lineage fields
Code lineage : repo_url, git_commit, training_pipeline_version
Data lineage : dataset_snapshot_ids (train/val/test), label_definition_version, data_extraction_query_hash
Feature lineage : feature_store_ref, feature_view_version, transforms_ref
Environment : container_digest, deps_lock_hash, python/r runtime version, GPU/CPU type
Parameters : hyperparameters, random seeds
Evaluation lineage : metrics + slice metrics + test artifacts (reports)
Compliance : PII usage declaration, retention policy, model card link
Lineage graph
Dataset/Feature versions → Training run → Model version → Deployment revision → Predictions (online/batch)
This enables:
“Which data and code produced the model in production last Tuesday?”
“Which endpoints served predictions from version X?”
“Which batch outputs were generated by version Y?”
4) Registry state machine (lifecycle stages)
A practical state model:
DRAFT
Created by training pipeline; internal use only.
CANDIDATE
Passed automated quality gates; ready for human review.
APPROVED
Formal sign-off recorded (risk/compliance/product).
STAGED
Deployed to pre-prod or shadow/canary environment; monitoring gates active.
PRODUCTION
Receiving real traffic or used for official batch scoring.
ARCHIVED
Retired; still queryable for audit.
Stage transitions are controlled by policy + RBAC (who can promote).
5) Quality gates (automated checks before approvals)
Typical gate set (customize per domain):
Reproducibility & integrity
Artifacts checksum validated
Training run is fully logged (no missing lineage fields)
Container digest pinned (no “latest” tags)
Functional
Input/output schema validation
Backward compatibility checks (for online APIs)
Unit tests for feature transforms
Model quality
Metric thresholds (e.g., AUC, RMSE)
Slice thresholds (e.g., key segments must not regress > X)
Calibration checks (if applicable)
Safety/compliance
PII/PHI policy checks
Fairness metrics thresholds (domain-dependent)
Robustness/adversarial tests (as needed)
Operational
Latency benchmark (p95/p99), memory footprint
Cost estimate and scaling profile
Passing gates promotes DRAFT → CANDIDATE automatically.
6) Approvals workflow (human-in-the-loop)
Roles (example)
ML owner : accountable for model quality
Service owner/SRE : operational readiness for online serving
Risk/Compliance : regulated constraints, fairness/PII
Product owner : business acceptance criteria
Approval record
Approver identity + role
Decision: approve/reject
Policy checklist results
Notes/exception ID (if overrides are allowed)
Timestamp + immutable audit log entry
Rule
Only versions in CANDIDATE can request approvals.
Only APPROVED versions can be deployed beyond staging.
7) Promotion paths (canary, batch, online)
A) Online promotion (real-time endpoints)
Recommended pattern : blue/green with progressive traffic (canary).
Steps
Create deployment revision referencing model@version (immutable).
Shadow deploy (optional) : mirror traffic; no user impact; compare predictions/latency.
Canary rollout :
Start at 1–5% traffic to new version.
Increase in steps (e.g., 5% → 25% → 50% → 100%).
Automated gates during rollout (SLO-based):
p95 latency, error rate, resource usage
business KPIs (conversion/fraud rate) if measurable quickly
prediction drift / feature missingness / out-of-range checks
Promote to PRODUCTION when at 100% and gates pass.
Rollback
Immediate traffic shift back to previous production version (champion).
Record rollback reason and incident link; version remains APPROVED but tagged regressed_in_prod=true.
Champion/Challenger
Registry stores production_alias -> model@version.
Challenger versions can be deployed as canaries without changing the alias until success.
B) Batch promotion (scheduled scoring jobs)
Batch has different risk: correctness + backfill consistency.
Steps
Staged batch run on a representative sample window.
Compare:
Output distribution drift vs current model
Business KPI proxy metrics
Data coverage/missingness
Downstream schema compatibility
Canary batch : run new model for a subset of partitions/customers/regions.
Full batch promotion :
Update batch job config to point to new version.
Record batch_run_id and output dataset version in registry.
Backfill policy
Decide whether to backfill historical scores with the new version.
If backfilling: store prediction_dataset_version and link to model@version for audit.
Rollback
Re-run affected partitions with previous version (if outputs are consumed downstream).
C) Canary vs “online” vs “batch” summary
Canary is a strategy (progressive exposure) used mainly in online, sometimes in batch (subset partitions).
Online focuses on latency/error SLOs + rapid rollback.
Batch focuses on output correctness, consistency, and downstream schema + partitioned rollback.
8) Registry policies & RBAC
Typical RBAC
ML engineers: create versions, view all, request approval
Approvers: approve/reject, add exceptions
SRE/platform: deploy to staging/prod, manage endpoints
Auditors: read-only access + export logs
Policy examples
No production deployment without:
required lineage fields present
passing gate suite
approvals from specified roles
No MAJOR version promotion without explicit downstream compatibility sign-off.
9) Minimal metadata schema (example)
json Copy code
{
"model_name": "fraud_scoring",
"version": "1.4.0",
"artifact_uri": "s3://models/fraud_scoring/1.4.0/model.onnx",
"checksums": {"model.onnx": "sha256:..."},
"lineage": {
"training_run_id": "run_2025_12_01_1234",
"repo_url": "https://git.example.com/ml/fraud",
"git_commit": "a1b2c3d4",
"pipeline_version": "train_fraud@2.7.1",
"dataset_snapshots": {
"train": "dsnap_2025_11_20",
"val": "dsnap_2025_11_27",
"test": "dsnap_2025_11_30"
},
"feature_set_version": "features_fraud@5.3.0",
"container_digest": "sha256:abcd..."
},
"schema": {
"inputs": {"user_id": "string", "amount": "float", "country": "string"},
"outputs": {"fraud_probability": "float"}
},
"evaluation": {
"metrics": {"auc": 0.941, "brier": 0.082},
"slice_metrics": [{"slice": "country=US", "auc": 0.935}]
},
"stage": "CANDIDATE",
"approvals": [],
"deployments": []
}
10) End-to-end workflow (operational sequence)
Train pipeline runs
Logs lineage + artifacts + evaluations.
Registers DRAFT version.
Automated gate suite
If pass: promote to CANDIDATE .
Approval request
Notifies approvers; collects sign-offs.
On success: stage becomes APPROVED .
Deploy to STAGED
Shadow/canary/batch-sample depending on target.
Promotion
Online: progressive traffic to 100%.
Batch: subset partitions → full schedule.
Set PRODUCTION alias
Registry marks which version is live (per environment/region).
Monitor & rollback
Drift, SLOs, KPIs; automated rollback if thresholds breached.
Archive
Retire old versions based on retention policy; keep audit trails.
If you tell me your serving mode(s) (online only vs online+batch), compliance level (regulated vs not), and whether you have a feature store, I can tailor the stage machine, required approvals, and the exact canary gating metrics to your setup.