Model Registry Workflow
This document outlines a comprehensive Model Registry Workflow for managing ML models in a production MLOps pipeline. It incorporates versioning, lineage tracking, approvals, and promotion paths to ensure reproducibility, governance, and safe deployment. The workflow assumes integration with tools like MLflow, Weights & Biases, or a custom registry (e.g., built on S3, DVC, or Kubeflow).
Key Concepts
- Model Registry: Centralized repository storing model artifacts (weights, metadata), versions, lineage graphs, and stage tags (e.g.,
None, Staging, Production).
- Versioning: Semantic versioning (
MAJOR.MINOR.PATCH) with auto-increment on registration.
- Lineage: Directed Acyclic Graph (DAG) tracking inputs (data, code, params), experiments, and outputs.
- Approvals: Multi-stage gates with roles (Data Scientist, MLOps Engineer, Reviewer).
- Promotion Paths: Linear progression:
Development → Staging → Production (with rollback support).
High-Level Workflow Diagram (Text-Based)
[Training/Experiment]
↓ (Register Model)
[Model Registry: v1.0.0 | Lineage Captured | Stage: Development]
↓ (Request Approval)
[Approval Gate 1: Peer Review]
↓ (Approved?)
[Yes] → Promote to Staging (v1.0.1 | Update Lineage)
↓ (Request Approval)
[Approval Gate 2: QA/Perf Tests]
↓ (Approved?)
[Yes] → Promote to Production (v1.0.2 | Prod Lineage)
↓ (Monitor & Rollback if needed)
[No] → Rejected (Log Reasons | Iterate)
Detailed Workflow Steps
1. Model Training & Registration (Versioning + Lineage)
- Trigger: End of training job (e.g., via orchestrator like Kubeflow Pipelines or Airflow).
- Steps:
- Compute key metrics (accuracy, F1, drift scores) and serialize model artifact.
- Capture Lineage (immutable metadata):
| Field | Description | Example/Source |
|---|
run_id | Experiment ID | MLflow run UUID |
data_version | Training dataset version | DVC/Data Catalog hash |
code_version | Training script/commit | Git SHA |
hyperparams | Full config (JSON) | YAML/CLI args |
metrics | Eval scores | Dict (e.g., {"auc": 0.95}) |
parents | Upstream models/data lineage | List of prior run_ids |
- Register Model:
- Query registry for latest version in namespace/project (e.g.,
my_project/credit_model).
- Assign version:
MAJOR.MINOR.PATCH
PATCH: +1 for any new registration.
MINOR: +1 on metric improvement (e.g., >5% better AUC).
MAJOR: Breaking changes (e.g., architecture shift).
- Tag stage:
Development.
- Store: Artifact URI + metadata JSON + lineage DAG (e.g., as Protobuf or Neo4j graph).
- Output: New model version logged (e.g.,
model://my_project/credit_model/1.2.3).
2. Approval Process
- Gates: Role-based, configurable per stage.
| Stage | Reviewers | Criteria/Checklist | Tools |
|---|
| Dev → Staging | Data Scientist + Peer | - Metrics > threshold- Lineage complete- No data drift | Jupyter + Custom UI |
| Staging → Prod | MLOps + Security + SME | - A/B test pass- Security scan- Bias/fairness OK- Lineage audit | CI/CD (GitHub Actions) + Prometheus |
- Steps:
- Submitter (e.g., DS) requests approval via UI/API with comments.
- Notifiers ping reviewers (Slack/Email).
- Reviewers vote: Approve/Reject/Request Changes (with reasons logged).
- On approval: Auto-promote + update lineage (add
promoted_from edge).
- On reject: Tag
Archived + notify + suggest iterations.
- Timeouts: 48h default; auto-reject if expired.
3. Promotion Paths
4. Monitoring & Maintenance
- Continuous Checks: Drift detection, perf monitoring → trigger re-approvals if thresholds breached.
- Archival: Versions >1y old or < threshold metrics → auto-archive.
- Querying: API/UI for lineage viz (e.g., "Show all models trained on data_v2.1").
- Auditing: All actions logged (who, when, why) for compliance (GDPR/SOX).
Implementation Recommendations
- Tech Stack:
| Component | Suggested Tools |
|---|
| Registry | MLflow Model Registry / Harbor |
| Lineage | MLflow + Marquez / OpenLineage |
| Approvals | Custom FastAPI UI / ZenML |
| Orchestration | Kubeflow / Flyte |
- API Endpoints (REST/gRPC):
POST /register: Train → Register.
POST /promote/{model_name}/{version}/{stage}: With approval payload.
GET /lineage/{model_name}/{version}: DAG JSON.
- Scalability: Backend on Postgres + S3; sharding by project.
This workflow ensures traceability (lineage), quality (approvals/versioning), and reliability (promotions). Customize thresholds/roles per org. For a proof-of-concept, start with MLflow Tracking Server. Questions? Let's iterate! 🕵️♂️