MLflow and Azure Machine Learning

APPLIES TO: Azure CLI ml extension v2 (current) Python SDK azure-ai-ml v2 (preview)

MLflow is an open-source framework, designed to manage the complete machine learning lifecycle. Its ability to train and serve models on different platforms allows you to use a consistent set of tools regardless of where your experiments are running: locally on your computer, on a remote compute target, a virtual machine or an Azure Machine Learning compute instance.

Tip

Azure Machine Learning workspaces are MLflow-compatible, meaning that you can use Azure Machine Learning workspaces in the same way you use an MLflow Tracking Server. Such compatibility has the following advantages:

  • You can use Azure Machine Learning workspaces as your tracking server for any experiment you are running with MLflow, regardless if they run on Azure Machine Learning or not. You only need to configure MLflow to point to the workspace where the tracking should happen.
  • You can run any training routine that uses MLflow in Azure Machine Learning without changes. Model mangagement and model deployment capabilities are also supported.

MLflow can manage the complete machine learning lifecycle using four core capabilities:

  • Tracking is a component of MLflow that logs and tracks your training job metrics, parameters and model artifacts; no matter your experiment's environment--locally on your computer, on a remote compute target, a virtual machine or an Azure Machine Learning compute instance.
  • Model Registries is a component of MLflow that manage model's versions in a centralized repository.
  • Model Deployments is a component of MLflow that deploys models registered using the MLflow format to different compute targets. Because of how MLflow models are stored, there's no need to provide scoring scripts for models in such format.
  • Projects is a format for packaging data science code in a reusable and reproducible way, based primarily on conventions. It's supported on preview on Azure Machine Learning.

Tracking with MLflow

Azure Machine Learning uses MLflow Tracking for metric logging and artifact storage for your experiments, whether you created the experiment via the Azure Machine Learning Python SDK, Azure Machine Learning CLI or the Azure Machine Learning studio. We recommend using MLflow for tracking experiments. To get you started, see Log & view metrics and log files with MLflow.

Note

Unlike the Azure Machine Learning SDK v1, there's no logging functionality in the SDK v2 (preview), and it is recommended to use MLflow for logging and tracking.

With MLflow Tracking you can connect Azure Machine Learning as the backend of your MLflow experiments. The workspace provides a centralized, secure, and scalable location to store training metrics and models. This includes:

Important

To learn how to use MLflow to query experiments and runs in Azure Machine Learning, see Manage experiments and runs with MLflow

Model Registries with MLflow

Azure Machine Learning supports MLflow for model management. This represents a convenient way to support the entire model lifecycle for users familiar with the MLFlow client.

To learn more about how you can manage models using the MLflow API in Azure Machine Learning, view Manage models registries in Azure Machine Learning with MLflow.

Model Deployments of MLflow models

You can deploy MLflow models to Azure Machine Learning, so you can leverage and apply Azure Machine Learning's model management capabilities and no-code deployment offering. We support deploying MLflow models to both real-time and batch endpoints. You can use the azureml-mlflow MLflow plugin, the Azure ML CLI v2, and using the user interface in Azure Machine Learning studio.

Learn more at Deploy MLflow models to Azure Machine Learning.

Train MLflow projects (preview)

Important

This feature is currently in public preview. This preview version is provided without a service-level agreement, and it's not recommended for production workloads. Certain features might not be supported or might have constrained capabilities. For more information, see Supplemental Terms of Use for Microsoft Azure Previews.

You can submit training jobs to Azure Machine Learning using MLflow Projects (preview). You can submit jobs locally with Azure Machine Learning tracking or migrate your jobs to the cloud like via an Azure Machine Learning Compute.

Learn more at Train ML models with MLflow projects and Azure Machine Learning (preview).

MLflow SDK, Azure ML v2 and Azure ML Studio capabilities

The following table shows which operations are supported by each of the tools available in the ML lifecycle.

Feature MLflow SDK Azure ML v2 (CLI/SDK) Azure ML Studio
Track and log metrics, parameters and models
Retrieve metrics, parameters and models 1 2
Submit training jobs with MLflow projects
Submit training jobs with inputs and outputs
Submit training pipelines
Manage experiments runs 1
Manage MLflow models 3
Manage non-MLflow models
Deploy MLflow models to Azure Machine Learning 4
Deploy non-MLflow models to Azure Machine Learning

Note

Example notebooks

If you are getting started with MLflow in Azure Machine Learning, we recommend you to explore the notebooks examples about how to user MLflow: