Tracking Reproducible Experiments with Managed MLflow
This lesson explains how recording enough about each experiment run, with managed MLflow on SageMaker AI, makes runs comparable and results reproducible.
Learning outcomes
After completing this lesson, you will be able to:
- Describe managed MLflow on SageMaker AI.
- Record parameters, metrics, artefacts and versions for each run.
- Compare runs fairly.
Managed MLflow on SageMaker AI
SageMaker AI provides managed MLflow, the open-source experiment tracking and model management tool, as serverless MLflow apps or as tracking servers. Training code calls the MLflow API with the app's ARN as the tracking URI; there is no server to patch, and access is controlled with IAM. MLflow is integrated with SageMaker Studio, and models in the MLflow registry can be registered automatically in the SageMaker Model Registry for deployment.
MLflow concepts
What to record
An MLflow experiment groups runs. Each run logs parameters (hyperparameters, feature list), metrics (per epoch and final), artefacts (plots, confusion matrices, the model file), tags and the dataset used. Autologging captures much of this automatically for scikit-learn, XGBoost, PyTorch and other libraries. For full reproducibility, also pin library versions (container image), record the code commit, version the training data (S3 versioning or dated prefixes) and fix random seeds.
import mlflow
mlflow.set_tracking_uri(mlflow_app_arn)
mlflow.set_experiment("churn-xgboost")
with mlflow.start_run(run_name="depth5-eta0.1"):
mlflow.log_params({"max_depth": 5, "eta": 0.1, "data": "s3://ml/churn/v2026-10-01/"})
model = train(...)
mlflow.log_metric("val_auc", 0.853)
mlflow.xgboost.log_model(model, "model", registered_model_name="churn")Reproducibility checklist
A training result is useful only if it can be repeated, for audits, debugging and fair comparison of experiments. Repeating a run requires knowing exactly what produced it: the code version, the data version, the hyperparameters, the random seeds, the library versions and the hardware. Managed MLflow on SageMaker AI records these with each run, together with the resulting metrics and artefacts. The following table lists what must be fixed or recorded for a run to be repeatable.
| Element | How to capture it |
|---|---|
| Code | Git commit hash logged as a tag |
| Environment | Container image URI and library versions |
| Data | Versioned S3 path or dataset hash |
| Parameters | mlflow.log_params |
| Randomness | Fixed seeds for splits, initialisation and sampling |
| Results | Metrics and artefacts logged to the run |
The following diagram shows an experiment-tracking run comparison that revealed data leakage behind an apparent model improvement.

Comparing runs fairly
Tracking makes runs comparable only if the comparisons are designed fairly. Two runs should differ in the change being tested and nothing else: the same training and validation data versions, the same evaluation code and the same metric definitions. A run that reports a better score on a different validation split, or with a metric computed differently, cannot be compared with its predecessor, and MLflow's comparison view makes such differences visible only when they are logged as parameters or tags.
Random variation also matters. Many training algorithms produce slightly different models from run to run, because of random initialisation, data shuffling and non-deterministic GPU operations. A difference of 0.002 AUC between two runs may be noise. Repeating promising configurations with several seeds and comparing the spread of results, or using cross-validation, shows whether an improvement is real before it is promoted.
Experiment tracking and model governance are linked but distinct. MLflow records the many experiments of development, most of which are discarded. The SageMaker Model Registry holds the few versions that are candidates for deployment, with approval status and lineage. Registering a chosen MLflow model in the Model Registry carries its run information forward, so an auditor can trace a deployed model back to the exact experiment, data and code that produced it.
A fair comparison
An unreproducible improvement
A data scientist reports AUC 0.91, up from 0.86, but a colleague rerunning "the same notebook" gets 0.85. Nothing was tracked.
After adopting MLflow autologging with data path, commit and seed tags, the team reruns both versions. The comparison view shows the 0.91 run used a dataset snapshot that accidentally included the label date column, a form of leakage. Without tracking, the team might have deployed a model whose reported improvement did not exist.
What must be recorded to reproduce an experiment?
Show answer
The code commit, container image, data version and random seeds, along with parameters and metrics.
Exam Tips
Remember for the exam
- Track parameters, metrics, artefacts and models: managed MLflow on SageMaker AI.
- Serverless MLflow apps remove tracking server management.
- Record code commit, image, data version and seeds for reproducibility.
- MLflow-registered models can flow into the SageMaker Model Registry.
- Compare runs side by side before promoting a model.