MLflow basics: tracking, models, registry

Updated October 9, 2026

MLflow is an open-source framework that records how a machine learning model was built (tracking), packages it in a standard format (models) and manages its versions (registry). The decision rule for exams: if a scenario says compare training attempts, reproduce a result, or know which version is deployed, the answer is MLflow: tracking for experiments, the registry for lifecycle. The same MLflow API is used on Databricks, Amazon SageMaker AI and Azure Machine Learning, which is why it appears in exams from all three vendors.

The objects, in one table

ObjectWhat it isTypical call
ExperimentA named group of runs for one taskmlflow.set_experiment(...)
RunOne execution of training codemlflow.start_run()
ParameterAn input you chose, such as a hyperparametermlflow.log_param()
MetricA measured output; can be logged per stepmlflow.log_metric()
TagA free-form label used to search and filter runsmlflow.set_tag()
ArtifactAn output file from a run: plots, data samples, model filesmlflow.log_artifact()
ModelAn artifact in the MLflow Models format (an MLmodel file plus flavors)mlflow.<flavor>.log_model()
Registered modelA named container of model versions, aliases and tagsmlflow.register_model()
Model versionVersion 1 on first registration, then incrementedcreated by registering
AliasA mutable name such as champion that points to one versionset_registered_model_alias()

Nested (child) runs group related runs under one parent, for example one child per cross-validation fold or per hyperparameter trial. Autologging (mlflow.autolog()) records parameters, metrics and the model for supported libraries such as scikit-learn, XGBoost, PyTorch and Keras without explicit log calls.

Tracking: what a training script records

import mlflow
from mlflow.models import infer_signature
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error

mlflow.set_experiment("demand-forecast")

with mlflow.start_run(run_name="rf-depth-8") as run:
    model = RandomForestRegressor(max_depth=8).fit(X_train, y_train)
    rmse = mean_squared_error(y_test, model.predict(X_test)) ** 0.5

    mlflow.log_param("max_depth", 8)
    mlflow.log_metric("rmse", rmse)
    mlflow.sklearn.log_model(
        model,
        artifact_path="model",
        signature=infer_signature(X_train, model.predict(X_train)),
    )

Newer MLflow 3 releases name the model argument name; check the version your platform runs. By default runs are written to a local mlruns directory; a tracking server or a managed platform stores them centrally instead.

A logged model is a directory with an MLmodel YAML file listing its flavors. The python_function (pyfunc) flavor is the generic interface: any model logged with a built-in flavor can be loaded with mlflow.pyfunc.load_model() and called through one predict method, which is what lets serving tools host models from different libraries. The signature describes the input and output schema, and an input example is a sample of valid input. If you log an example without a signature, MLflow infers one.

From run to registered model

Registering turns a logged model into a managed asset. On Databricks the hosted registry lives in Unity Catalog:

from mlflow import MlflowClient

mlflow.set_registry_uri("databricks-uc")   # the default in MLflow 3
name = "main.ml_team.demand_forecast"       # catalog.schema.model

mv = mlflow.register_model(f"runs:/{run.info.run_id}/model", name)
MlflowClient().set_registered_model_alias(name, "champion", mv.version)

prod = mlflow.pyfunc.load_model(f"models:/{name}@champion")

Moving the champion alias to a new version changes what every job that loads models:/<name>@champion receives, with no code change. Per Databricks documentation, Unity Catalog does not support the old stages (Staging, Production); environments are expressed through the catalog or schema and promotion through aliases. Models in Unity Catalog need a signature, use a three-level name, and need CREATE MODEL on the schema. Benefits over the workspace registry include central access control, auditing, lineage and access from every workspace attached to the same metastore, which ties into Unity Catalog.

Finding the best run

best = mlflow.search_runs(
    experiment_names=["demand-forecast"],
    order_by=["metrics.rmse ASC"],
    max_results=1,
)
best_run_id = best.iloc[0]["run_id"]

search_runs returns a pandas DataFrame, one row per run. Without order_by, results are sorted by start time, newest first. MlflowClient offers the same search as a client method, which is the form some Databricks objectives name (“identify the best run using the MLflow Client API”).

The same API on three platforms

PlatformHow MLflow is providedExam-relevant detail
DatabricksManaged MLflow in the workspaceRegistry in Unity Catalog, aliases instead of stages
SageMaker AIManaged tracking server or MLflow AppArtifacts go to an S3 bucket in your account; IAM authorises MLflow APIs under the sagemaker-mlflow action prefix; models can be registered automatically in the SageMaker Model Registry
Azure Machine LearningThe workspace is MLflow-compatible and acts as the tracking serverAzure ML does not host MLflow server instances; MLflow models deploy to online and batch endpoints without a scoring script

Which exams test this

ExamHow it appearsOn this site
Databricks ML AssociateDatabricks Machine Learning (38%): find the best run with the MLflow Client API, log metrics, artifacts and models manually, read the MLflow UI, register a model in the Unity Catalog registry and explain its benefits over the workspace registryDatabricks Machine Learning explained
Databricks ML ProfessionalModel Development (44%): nested runs, custom metrics, parameters and artifacts, Optuna tuning integrated with MLflow; MLOps (44%): MLflow experiments and registered models as bundle assets; Model Deployment (12%): register a custom PyFunc model, deploy with the MLflow Deployments SDKModel development, MLOps
Databricks GenAI EngineerApplication Development (30%): MLflow with Agent Framework for agentic systems; Assembling and Deploying (22%): model flavor, signature and input example for a RAG app, register to Unity Catalog with MLflow; Evaluation and Monitoring (12%): evaluate agents with MLflow scoring and tracingAssembling and deploying, Governance, evaluation and monitoring
AI-300Model lifecycle and operations (25-30%): configure experiment tracking with MLflow, register an MLflow modelModel lifecycle
MLA-C02Domain 2 (24%): reproducible experiments, with MLflow on SageMaker AI named as an example; Domain 3 (24%): manage model versions for repeatability and audits (SageMaker Model Registry, MLflow on SageMaker AI)Model development

How exam questions are built around MLflow

  • Tracking versus registry. “Which settings produced the best model” is tracking (params, metrics, runs). “Which version serves production and how do we roll back” is the registry. Candidates mix them up.
  • Aliases versus stages. In Unity Catalog the answer is an alias; stages belong to the older workspace registry.
  • Artifact versus model. Any file is an artifact; a model in the MLflow format has flavors and a signature and can be served without custom code.
  • Governance words (who may use the model, lineage, cross-workspace access) point to the Unity Catalog registry rather than the workspace registry.
  • Platform words. “IAM policy for the tracking server” is SageMaker AI, “workspace as tracking server” is Azure ML.

For the surrounding practice see MLOps basics, LLM evaluation for MLflow tracing and scoring, and machine learning basics for the metrics you log.

Practice questions

Question 1. A data scientist ran forty training runs with different hyperparameters in one experiment and must programmatically select the run with the lowest validation RMSE. Which approach fits?

  • A. Register all forty models and pick the highest version number
  • B. Download each run’s artifacts and sort them by file size
  • C. Assign a champion alias to each run
  • D. Search the experiment’s runs ordered by the logged RMSE metric and take the first result
Show answer

Answer: D

Runs are searched and ordered by logged metrics, for example mlflow.search_runs with order_by set to the metric and max_results of 1. The registry holds model versions, not the comparison of training attempts. Sorting artifacts by file size says nothing about quality. Aliases are labels for model versions and are not assigned to runs.

Question 2. Inference jobs in a Databricks workspace load a model from the Unity Catalog registry. The team wants to promote a newly validated version to production without changing any job code. What should they do?

  • A. Reassign the alias that the jobs load, for example champion, to the new model version
  • B. Transition the version to the Production stage
  • C. Edit each job to reference the new version number
  • D. Overwrite the artifacts of the old run with the new model files
Show answer

Answer: A

Jobs that load models:/@champion follow the alias, so moving the alias to the new version changes what they load with no code change. Unity Catalog does not support the older Staging and Production stages. Editing every job to a fixed version number is exactly the code change to avoid. Overwriting artifacts in a run breaks the link between a version and the run that produced it.

Go deeper