Experiment Tracking
Intermediate 14 min read Experiment Tracking

MLflow Tracking

The open source backbone of the ML platform

MLflow Tracking is the de-facto open source layer that records runs, metrics and artifacts, and it underpins the rest of the platform — the registry, projects and model serving all hang off tracked runs.

MLflowexperimentruntracking serverlog_metriclog_param
Before we start

What you will learn

  • Log a run with parameters, metrics and artifacts in MLflow
  • Explain the client-server split in MLflow tracking
  • Query and compare runs programmatically
Introduction

What is this?

MLflow is an open source platform for the ML lifecycle. Its tracking component records experiments: each run captures parameters, metrics, tags, artifacts and environment context, usable through a Python client, a REST API and a UI. A remote tracking server lets a whole team see and query every run.

Motivation

Why do you need it?

  • It standardizes logging so any framework (sklearn, PyTorch, XGBoost) records the same shape.
  • A shared tracking server makes results team-wide instead of laptop-locked.
  • The registry and serving integrations use the same run IDs, keeping lineage intact.
  • It is free, widely deployed and works locally with zero infrastructure.
Think about it

Mental model

Imagine

Git for code, MLflow for experiments

Think of

Tracking runs like commits

Git stores the history of code so you can compare, branch and revert. MLflow stores the history of experiments — with their metrics and artifacts — so model development gets the same discipline.

Mechanics

How it works

  • A client connects to a tracking server (or a local file store).
  • mlflow.start_run() opens a run context; everything logged belongs to that run.
  • log_param records inputs; log_metric records outputs (with optional step for curves).
  • log_artifact stores files (model, plots, reports) in the artifact store.
  • Autologging hooks into common frameworks so params/metrics are captured without manual calls.
  • The UI and search API query runs by tags, params and metrics.

MLflow tracking client-server architecture.

Training code
MLflow client
Tracking server
Artifact store
UI & queries
Hands-on

Examples

The minimal tracked run

The minimal tracked run
import mlflow
with mlflow.start_run(run_name="iris-rbf"):
mlflow.log_param("kernel", "rbf")
mlflow.log_param("C", 1.0)
...
mlflow.log_metric("test_accuracy", 0.9333)
mlflow.sklearn.log_model(model, "model")

Four calls turn training into a first-class, queryable run. Autologging can do most of this for you when you enable it.

Real world

In production

  • A team points 10 laptops at one shared tracking server; a nightly retrain logs into production experiments.
  • Autologging captures everything so onboarding a new model family takes minutes.
  • Serving reads the artifact URI from the winning run, so deployment stays linked to the run that produced it.
Guidelines

Best practices

  • Set a tracking URI explicitly and share it with the team.
  • Use experiments per project line and tags per hypothesis.
  • Enable autologging as a default, then hand-log what autologging misses.
  • Keep artifact stores versioned and budgeted — artifacts grow fast.
Watch out

Common mistakes

  • Forgetting to share the tracking URI, so every engineer runs a private server.
  • Nesting start_run calls and logging to the wrong run.
  • Logging metrics inside a tight loop without a step, ballooning the metrics store.
When things break

Debugging tips

  • Run disappears? Check TRACKING_URI env var vs the --backend-store-uri flag.
  • Artifact missing? Confirm the artifact URI points where the server can read and the client can write.
  • UI slow? Prune or archive old experiments and cap autologged metrics.
Interviews

Interview checkpoint

Practice

Hands-on lab

Log Your First MLflow Run
30 min · intermediate
In progress
Objectives
  • Train a model with MLflow tracking enabled
  • Log parameters, metrics and a model artifact
  • Query the run back from the store to prove the artifact is intact

Log Your First MLflow Run

30 min · intermediate

0/4 steps
0%
sandbox · Linux sandbox
$
Try these commands
Test yourself

Quick quiz

0/2
1

Which MLflow client call records a training output?

2

MLflow tracking requires committing to a hosted cloud service.

Go deeper

Official documentation