MLflow and Azure Machine Learning

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

MLflow is an open-source framework that's 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, on a virtual machine, or on an Azure Machine Learning compute instance.

Azure Machine Learning workspaces are MLflow-compatible, which means you can use Azure Machine Learning workspaces in the same way that you'd use an MLflow server. Such compatibility has the following advantages:

  • We don't host MLflow server instances under the hood. The workspace can talk the MLflow API language.
  • You can use Azure Machine Learning workspaces as your tracking server for any MLflow code, whether it runs 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 any change.

Tip

Unlike the Azure Machine Learning SDK v1, there's no logging functionality in the SDK v2 and we recommend using MLflow for logging. Such strategy allows your training routines to become cloud-agnostic and portable, removing any dependency in your code with Azure Machine Learning.

Tracking with MLflow

Azure Machine Learning uses MLflow Tracking for metric logging and artifact storage for your experiments. When connected to Azure Machine Learning, all tracking performed using MLflow is materialized in the workspace you are working on. To learn more about how to instrument your experiments for tracking experiments and training routines, see Log metrics, parameters, and files with MLflow. You can also use MLflow to Query & compare experiments and runs with MLflow.

Centralize tracking

You can connect MLflow to Azure Machine Learning workspaces even when you are running locally or in a different cloud. The workspace provides a centralized, secure, and scalable location to store training metrics and models.

Capabilities include:

Example notebooks

Important

  • MLflow in R support is limited to tracking experiment's metrics, parameters and models on Azure Machine Learning jobs. Interactive training on RStudio, Posit (formerly RStudio Workbench) or Jupyter Notebooks with R kernels is not supported. Model management and registration is not supported using the MLflow R SDK. As an alternative, use Azure Machine Learning CLI or Azure Machine Learning studio for model registration and management. View the following R example about using the MLflow tracking client with Azure Machine Learning.
  • MLflow in Java support is limited to tracking experiment's metrics and parameters on Azure Machine Learning jobs. Artifacts and models can't be tracked using the MLflow Java SDK. As an alternative, use the Outputs folder in jobs along with the method mlflow.save_model to save models (or artifacts) you want to capture. View the following Java example about using the MLflow tracking client with the Azure Machine Learning.

Model registries with MLflow

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

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

Example notebooks

Model deployment with MLflow

You can deploy MLflow models to Azure Machine Learning and take advantage of the improved experience when you use this type of models. Azure Machine Learning supports deploying MLflow models to both real-time and batch endpoints without having to indicate and environment or a scoring script. Deployment is supported using either MLflow SDK, Azure Machine Learning CLI, Azure Machine Learning SDK for Python, or the Azure Machine Learning studio portal.

Learn more at Guidelines for deploying MLflow models.

Example notebooks

Training MLflow projects (preview)

You can submit training jobs to Azure Machine Learning by using MLflow projects (preview). You can submit jobs locally with Azure Machine Learning tracking or migrate your jobs to the cloud via Azure Machine Learning compute.

Learn more at Train machine learning models with MLflow projects and Azure Machine Learning.

Important

Items marked (preview) in this article are currently in public preview. The 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.

Example notebooks

MLflow SDK, Azure Machine Learning v2, and Azure Machine Learning studio capabilities

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

Feature MLflow SDK Azure Machine Learning CLI/SDK Azure Machine Learning studio
Track and log metrics, parameters, and models
Retrieve metrics, parameters, and models 1
Submit training jobs 2
Submit training jobs with Azure Machine Learning data assets
Submit training jobs with machine learning pipelines
Manage experiments and runs
Manage MLflow models 3
Manage non-MLflow models
Deploy MLflow models to Azure Machine Learning (Online & Batch) 4
Deploy non-MLflow models to Azure Machine Learning

Note

Next steps