0Pricing
Learn AI with Python · Lesson

Model Registry and Versioning

Registering models, staging (Staging/Production), model aliases, loading by version.

Model Registry and Versioning is a free Learn AI with Python lesson on CoddyKit — lesson 2 of 4. You can read the complete lesson below for free — then practise it hands-on in the browser with a built-in code editor and a 24/7 AI tutor. It is part of the Learn AI with Python learning path, one of 4 lessons in the course, and your progress syncs across the web and the CoddyKit app.

What Is the Model Registry?

The MLflow Model Registry is a central store for your models. It tracks named models, their versions, and lifecycle stages so a team always knows which model is in production and how it got there.

Why Versioning Matters

Models are retrained constantly. Versioning gives every retrain a number, lets you roll back instantly if a new model misbehaves, and ties each version to the run that produced it for full lineage.

Registering a Model

mlflow.register_model takes a logged model URI and a name, creating version 1 (or the next version) in the registry.

import mlflow

result = mlflow.register_model(
    model_uri="runs:/<run_id>/model",
    name="churn_classifier"
)
print("Version:", result.version)

Registering at Log Time

You can also register directly when logging the model by passing registered_model_name, which auto-creates a new version each run.

mlflow.sklearn.log_model(
    model,
    artifact_path="model",
    registered_model_name="churn_classifier"
)

Lifecycle Stages

Each version moves through stages: None -> Staging (testing) -> Production (live) -> Archived. Stages decouple "which version" from "which is serving," so promotion is a metadata change, not a redeploy.

The MlflowClient

Programmatic registry operations go through MlflowClient.

from mlflow.tracking import MlflowClient

client = MlflowClient()

Transitioning Stages

transition_model_version_stage promotes a version. Move it to Staging for QA, then Production once validated.

client.transition_model_version_stage(
    name="churn_classifier",
    version=3,
    stage="Production"
)

Loading by Stage

Serving code can load "whatever is in Production" without hardcoding a version number, so promoting a new version instantly updates what gets served.

import mlflow.pyfunc

model = mlflow.pyfunc.load_model(
    "models:/churn_classifier/Production"
)

Model Aliases (MLflow 2.x)

MLflow 2.x introduced aliases: mutable named pointers like @champion or @challenger attached to a version. They are more flexible than the fixed stage names and are the recommended modern approach.

client.set_registered_model_alias(
    name="churn_classifier",
    alias="champion",
    version=3
)

Loading by Alias

Reference a model by its alias with the @ syntax, so reassigning the alias to a new version instantly redirects all consumers.

model = mlflow.pyfunc.load_model(
    "models:/churn_classifier@champion"
)

Stages vs Aliases

  • Stages: fixed set (Staging/Production/Archived), simple lifecycle.
  • Aliases: any custom name, multiple per model, recommended in MLflow 2.x.

New projects should prefer aliases for flexibility.

Quick Check

Test your model registry knowledge.

Recap

You used the MLflow Model Registry: register_model creates versions, MlflowClient.transition_model_version_stage moves them through Staging/Production, and you load by stage or by alias (MLflow 2.x) so serving updates without code changes. Next: building reproducible pipelines.

Frequently asked questions

Is the “Model Registry and Versioning” lesson free?

Yes — the full text of “Model Registry and Versioning” is free to read here on the web, and the Learn AI with Python course includes 4 lessons in total. To practise it interactively (a built-in code editor and a 24/7 AI tutor) and unlock the rest of the Learn AI with Python course, upgrade to CoddyKit PRO.

What will I learn in “Model Registry and Versioning”?

Registering models, staging (Staging/Production), model aliases, loading by version. You practise Learn AI with Python with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start Learn AI with Python?

No prior experience is required. Learn AI with Python on CoddyKit is structured for beginners through advanced learners; this is — lesson 2 of 4, so you can start here or from the beginning and move at your own pace.

How long does the “Model Registry and Versioning” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this Learn AI with Python lesson?

Yes. Every Learn AI with Python lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Experiment Tracking with MLflow
  2. Model Registry and Versioning
  3. Building Reproducible ML Pipelines
  4. Monitoring Model Performance in Production
← Back to Learn AI with Python