Edit

Share via


MLflow and Azure Machine Learning

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

This article describes the capabilities of MLflow, an open-source framework that manages the complete machine learning lifecycle. MLflow uses a consistent set of tools to train and serve models on different platforms. Use MLflow whether your experiments run locally, on a remote compute target, a virtual machine, or an Azure Machine Learning compute instance.

Azure Machine Learning workspaces are MLflow-compatible, so you use an Azure Machine Learning workspace the same way you use an MLflow server. This compatibility offers these advantages:

  • Azure Machine Learning doesn't host MLflow server instances, but uses the MLflow APIs directly.
  • Use an Azure Machine Learning workspace as your tracking server for any MLflow code, whether or not it runs in Azure Machine Learning. Just configure MLflow to point to the workspace where tracking happens.
  • Run any training routine that uses MLflow in Azure Machine Learning without making changes.

Tip

Unlike the Azure Machine Learning SDK v1, the Azure Machine Learning v2 SDK doesn't include logging functionality. Use MLflow logging to keep your training routines cloud-agnostic, portable, and independent of Azure Machine Learning.

What is tracking

When you work with jobs, Azure Machine Learning automatically tracks information about experiments, like code, environment, and input and output data. But models, parameters, and metrics are specific to each scenario, so model builders need to set up their tracking.

The saved tracking metadata varies by experiment and can include:

  • Code
  • Environment details like OS version and Python packages
  • Input data
  • Parameter configurations
  • Models
  • Evaluation metrics
  • Evaluation visualizations like confusion matrices and importance plots
  • Evaluation results, including some evaluation predictions

Benefits of tracking experiments

Whether you train models with jobs in Azure Machine Learning or interactively in notebooks, experiment tracking helps you:

  • Organize all your machine learning experiments in one place. Then search and filter experiments, and drill down to see details about previous experiments.
  • Compare experiments, analyze results, and debug model training.
  • Reproduce or rerun experiments to validate results.
  • Collaborate more easily, because you see what other teammates are doing, share experiment results, and access experiment data programmatically.

Tracking with MLflow

Azure Machine Learning workspaces are MLflow-compatible. This compatibility means you use MLflow to track runs, metrics, parameters, and artifacts in workspaces without changing your training routines or adding any cloud-specific syntax. To learn how to use MLflow for tracking experiments and runs in Azure Machine Learning workspaces, see Track experiments and models with MLflow.

Azure Machine Learning uses MLflow tracking to log metrics and store artifacts for your experiments. When you're connected to Azure Machine Learning, all MLflow tracking appears in the workspace you use.

To learn how to enable logging to monitor real-time run metrics with MLflow, see Log metrics, parameters, and files with MLflow. You also query and compare experiments and runs with MLflow.

MLflow in Azure Machine Learning provides a way to centralize tracking. Connect MLflow to Azure Machine Learning workspaces even when you work locally or in a different cloud. The Azure Machine Learning workspace provides a centralized, secure, and scalable ___location to store training metrics and models.

MLflow in Azure Machine Learning lets you:

Tracking with MLflow in R

MLflow support in R has these limitations:

  • MLflow tracking is limited to tracking experiment metrics, parameters, and models on Azure Machine Learning jobs.
  • Interactive training on RStudio, Posit (formerly RStudio Workbench), or Jupyter notebooks with R kernels isn't supported.
  • Model management and registration aren't supported. Use the Azure Machine Learning CLI or Azure Machine Learning studio for model registration and management.

For examples of using the MLflow tracking client with R models in Azure Machine Learning, see Train R models using the Azure Machine Learning CLI (v2).

Tracking with MLflow in Java

MLflow support in Java has these limitations:

  • MLflow tracking is limited to tracking experiment metrics and parameters on Azure Machine Learning jobs.
  • Artifacts and models can't be tracked. Instead, use the mlflow.save_model method with the outputs folder in jobs to save models or artifacts that you want to capture.

For a Java example that uses the MLflow tracking client with the Azure Machine Learning tracking server, see azuremlflow-java.

Example notebooks for MLflow tracking

Model registration with MLflow

Azure Machine Learning supports MLflow for model management. If you're familiar with the MLflow client, you can use it to manage the entire model lifecycle. To learn more about managing models with the MLflow API in Azure Machine Learning, see Manage model registries in Azure Machine Learning with MLflow.

Example notebook for MLflow model registration

Model management with MLflow shows how to manage models in registries.

Model deployment with MLflow

Deploy MLflow models to Azure Machine Learning to get an improved experience. Azure Machine Learning supports deploying MLflow models to both real-time and batch endpoints without specifying an environment or a scoring script.

The MLflow SDK, Azure Machine Learning CLI, Azure Machine Learning SDK for Python, and Azure Machine Learning studio all support MLflow model deployment. For more information about deploying MLflow models to Azure Machine Learning for both real-time and batch inference, see Guidelines for deploying MLflow models.

Example notebooks for MLflow model deployment

Training with MLflow Projects (preview)

Warning

Support for MLproject files (MLflow Projects) in Azure Machine Learning will be fully retired in September 2026. MLflow is still fully supported and is still the recommended way to track machine learning workloads in Azure Machine Learning.

As you continue to use MLflow, we recommend that you transition from MLproject files to Azure Machine Learning Jobs, using either the Azure CLI or the Azure Machine Learning SDK for Python (v2). For more information on Azure Machine Learning jobs, see Track ML experiments and models with MLflow.

Important

This feature is currently in public preview. This preview version is provided without a service-level agreement, and we don't recommend it 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.

Submit training jobs to Azure Machine Learning by using MLflow Projects. Submit jobs locally with Azure Machine Learning tracking, or migrate your jobs to the cloud by using Azure Machine Learning compute.

Learn how to submit training jobs that use MLflow Projects to Azure Machine Learning workspaces for tracking in Train with MLflow Projects in Azure Machine Learning (preview).

Example notebooks for MLflow projects

MLflow vs Azure Machine Learning client tools capabilities

The following table shows machine learning lifecycle operations you can do with the MLflow SDK and Azure Machine Learning client tools.

Feature MLflow SDK Azure Machine Learning CLI/SDK v2 Azure Machine Learning studio
Track and log metrics, parameters, and models
Retrieve metrics, parameters, and models You can download only artifacts and models.
Submit training jobs You can use MLflow Projects (preview).
Submit training jobs with Azure Machine Learning data assets
Submit training jobs with machine learning pipelines
Manage experiments and runs
Manage MLflow models Some operations aren't supported.1
Manage non-MLflow models
Deploy MLflow models to Azure Machine Learning (online and batch) You can't deploy MLflow models for batch inference right now.2
Deploy non-MLflow models to Azure Machine Learning

1 For more information, see Manage model registries in Azure Machine Learning with MLflow.

2 For an alternative, see Deploy and run MLflow models in Spark jobs.