Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Machine Learning Associate

Tracking runs with MLflow

Databricks Machine Learning Associate · Lesson 4 of 19 · 23:04

YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗

Learning with these videos? Subscribe for new courses and exam-style questions.

In this lesson

Prepare for the Databricks Certified Machine Learning Associate exam. In this lesson: MLflow experiments and runs, logging parameters, metrics, and artifacts by hand, the MLflow UI, and autologging, including how to turn it off. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

A spreadsheet of results

The data scientists at Juniper Rides compare their demand models in a shared spreadsheet, typed in by hand after each training, and half of the rows have no parameters. The team wants every training session recorded, with its settings, its results, and the model itself. This lesson covers MLflow tracking: experiments and runs, logging by hand, what the MLflow UI shows, and autologging.

Experiments and runs

MLflow tracking logs model development in experiments and runs. A run is a single execution of model code, and an experiment is a collection of related runs, which you can compare and filter. A notebook experiment is created automatically for a notebook when no experiment is active, while a workspace experiment is one that you create and share, and that any notebook can log to with set_experiment. With MLflow 3, a logged model is also its own object, with its own ID, linked to the runs that trained and evaluated it.

Logging by hand

To log by hand, open a run with mlflow dot start_run, in a with block that ends the run for you. Inside it, log_param and log_params save settings, like the maximum depth, and log_metric and log_metrics save results, like the RMSE, with an optional step for values that change during training. log_artifact saves any file, like a chart or a data sample, while log_figure and log_dict save a plot or a dictionary directly. set_tag adds a key and a value that you can search on later, like the version of the data. And the log_model function of the model's flavor, such as the one in mlflow dot sklearn, saves the model itself, with its dependencies, and ideally a signature and an input example.

The MLflow UI

In the workspace, the Experiments page lists the experiments you can access, and each experiment shows a table of its runs, which you can sort, filter, and compare. The page of a run shows its ID, its parameters, its metrics, with charts over the steps, and its tags. Its source links to the exact version of the notebook that created the run, and the Artifacts tab lists the files that it saved. For a logged model, you also get its files, like the requirements file, and code snippets to load the model and predict on Spark or pandas DataFrames. And in a notebook, the Experiment Runs sidebar shows the runs of the notebook without leaving it.

Autologging

Autologging captures parameters, metrics, and the model without logging calls in your code. On a cluster, Databricks Autologging calls mlflow dot autolog for interactive Python notebooks, so training a scikit-learn, XGBoost, or Spark ML model is tracked automatically, and the model gets a signature. On serverless compute, autologging is not on by default, so you call mlflow dot autolog yourself. It is also not applied inside a run that you open with start_run, unless you call mlflow dot autolog first. Its options control what it captures, like log_models, and setting disable to true turns it off, while an admin can turn it off for the whole workspace. For Spark ML, the PySpark ML autolog function also captures the tuning runs of CrossValidator and TrainValidationSplit.

Recap

Let's recap. A run is one execution of model code, an experiment groups related runs, and a notebook experiment is created when none is active. By hand, start_run opens a run, where you log parameters, metrics with steps, artifacts, tags, and the model with its flavor. The run page shows parameters, metrics, tags, artifacts, and the source, linked to the notebook version. Autologging captures all of this for you on clusters, but you call mlflow dot autolog yourself on serverless, or inside your own start_run. And setting disable to true turns autologging off.

Quick checks for this lesson

The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.

  1. A data scientist opens a run in a notebook, and no experiment is active, since none was set. Where are the parameters and metrics of the run logged?

    • Nowhere, until an experiment is created
    • In a default experiment owned by the admin
    • In a registered model in Unity Catalog
    • In a notebook experiment, created for it
    Show the answer

    In a notebook experiment, created for it

    When no experiment is active, Databricks creates a notebook experiment, with the name and the ID of the notebook. “Nowhere, until an experiment is created” is wrong, since the run is logged right away. “In a default experiment owned by the admin” describes an experiment that does not exist. And “In a registered model in Unity Catalog” confuses runs with registered models, which only hold model versions.

  2. A run from three weeks ago produced the best demand model, but the notebook has been edited many times since. How can the data scientist see the exact code that produced that run?

    • Open the Source link on the run’s page
    • Open the latest version of the notebook
    • Read the metric charts of the run
    • Read the requirements file in its artifacts
    Show the answer

    Open the Source link on the run’s page

    The source of a run links to the version of the notebook that created it, as it was at the time of the run. “Open the latest version of the notebook” would show today's code, after all the edits. “Read the metric charts of the run” would show results over the steps, but no code. And “Read the requirements file in its artifacts” lists the library versions, but not the training code.

  3. A training notebook moves from a classic ML cluster to serverless compute, and the runs no longer show any parameters or metrics, although the code has not changed. What is the fix?

    • Turn on Photon for the notebook
    • Register the model in Unity Catalog first
    • Call mlflow.autolog() at the start
    • Log the runs to a workspace experiment
    Show the answer

    Call mlflow.autolog() at the start

    Autologging is not turned on automatically on serverless compute, so the notebook must call mlflow dot autolog. “Turn on Photon for the notebook” would speed up some Spark work, but would not log anything. “Register the model in Unity Catalog first” would register a model, while runs still capture nothing. And “Log the runs to a workspace experiment” would only change where the runs go, and they would still be empty.