Lesson 3 of 5 MLOps Orchestration and Model Versioning

Versioning Models with SageMaker Model Registry and MLflow

This lesson explains how model versioning records which model is deployed, how it was produced and who approved it, using the SageMaker Model Registry and MLflow on SageMaker AI.

Learning outcomes

After completing this lesson, you will be able to:

  • Organize versions in model package groups with approval status.
  • Use the MLflow model registry with aliases.
  • Record what audits need for each version.

SageMaker Model Registry

The registry organises models into model package groups, one per use case, each holding numbered model package versions. A version records the inference image, model artefacts, evaluation metrics, bias and explainability reports, data and drift baselines, a model card and an approval status: PendingManualApproval, Approved or Rejected. Changing the status emits an EventBridge event, which commonly triggers a deployment pipeline. Lineage tracking links each version to the pipeline execution, training job and data that produced it.

True or false

Model Registry

Exam skills 3.3.6

Check how SageMaker Model Registry tracks model versions.

Log in to try this activity Interactive activities are free with an account.

MLflow model registry

Managed MLflow on SageMaker AI includes the MLflow model registry, where registered models have versions, aliases such as champion, and tags, each version linked to the MLflow run that created it, with its parameters and metrics. Data scientists who already use MLflow can work with familiar tools.

MLflow registrations can be synchronised to the SageMaker Model Registry. Experimentation then happens in MLflow, while governed deployment happens through the SageMaker registry and its approval workflow, which CI/CD pipelines use to decide what to deploy.

Versioning for audits

Audits and incident investigations need to know exactly how a deployed model was built. For every model version, the registry should record the code commit, the container image digest, the location and version of the training data, the hyperparameters, the evaluation metrics and the person who approved it.

Old versions and their artefacts are kept for the required retention period, so an earlier model can be restored or examined. Model cards document each model's intended use, risks and evaluation results. The following table summarises the registry features.

FeaturePurpose
Model package groupAll versions of one model
Model package versionArtifacts, image, metrics, baselines
Approval statusGate for deployment; emits EventBridge events
Model cardDocumentation of intended use, risks and evaluations
Lineage trackingLinks model to data, jobs and pipeline execution
MLflow registry aliasesExperiment-side version pointers

The following diagram shows the records a team follows to tell a regulator, within minutes, how the model behind a production endpoint was trained and approved.

Answering the regulator in minutes. The production endpoint's configuration references model package credit-models/14; the version's lineage leads to the pipeline execution, the training job and the S3 data version; and the approval event in CloudTrail and the model card show who approved it and on what evidence.
The scenario is illustrative.
Select all that apply

Answer the auditor

Exam skills 3.3.6 · 4.3.4

Identify what must be recorded to show an auditor how a deployed model was produced.

Log in to try this activity Interactive activities are free with an account.
Worked example

An audit request

A regulator asks which data trained the credit model in production on 1 March and who approved it.

  • The endpoint's configuration references model package credit-models/14.
  • The version's lineage shows pipeline execution ID, training job and the S3 data version.
  • The approval change event in CloudTrail and the model card show the approver and the evaluation report.

The answer takes minutes. Without a registry, the team would have to reconstruct the history from notebooks and buckets, possibly without a definitive answer.

Check yourself

What can a model package's approval status change trigger?

Show answer

A deployment, through the EventBridge event it emits.

Exam Tips

Remember for the exam

  • One model package group per use case; versions inside it.
  • Approval status change emits an EventBridge event that can trigger deployment.
  • Lineage links model versions to data, jobs and pipeline executions.
  • Document intended use and risks in model cards.
  • MLflow for experiments; SageMaker Model Registry for governed deployment.