Model Registry: Staging, Production, and Archiving
Learners will register a model version in MLflow Model Registry, transition it through Staging to Production, and script a promotion workflow with the Python API.
What Is a Model Registry?
A model registry is a centralised catalogue that stores versioned trained models with their metadata. Instead of managing model files scattered across file systems, a registry provides a single source of truth with named versions, lifecycle stages (Staging, Production, Archived), and searchable annotations. The MLflow Model Registry is the most widely used open-source solution and integrates directly with the MLflow tracking server.
Registering a Model from a Run
After training, register the model by linking it to an existing MLflow run artifact. You can register directly during logging using the registered_model_name argument, or after the fact using the MLflow client. The registry creates a named model entry (e.g., 'SentimentClassifier') and assigns it Version 1. Subsequent registrations of the same model name automatically increment the version number.
import mlflow
import mlflow.sklearn
from sklearn.ensemble import RandomForestClassifier
# Option 1: Register during logging
with mlflow.start_run():
clf = RandomForestClassifier(n_estimators=100, random_state=42)
# clf.fit(X_train, y_train)
mlflow.sklearn.log_model(
sk_model=clf,
artifact_path='model',
registered_model_name='SentimentClassifier' # auto-registers
)
print('Model registered as SentimentClassifier v1')All lessons in this course
- Experiment Tracking with MLflow: Log Params, Metrics, and Artifacts
- Reproducible Environments with Docker for ML
- Model Registry: Staging, Production, and Archiving
- Automated Retraining Pipelines with GitHub Actions