Quick Reference · ML experiment tracking & model lifecycle

mlflow cheat sheet

MLflow has four building blocks: Tracking (log params/metrics/artifacts per run), Projects (package reproducible runs), Models (standard packaging across frameworks), and the Model Registry (version, alias, and govern models on their way to production).

tracking (log) run / experiment model / registry serving / deploy watch out deprecated most common

Distilled & cross-checked across: mlflow.org/docs/latest/ml · grafdavid.com/cheatsheets/mlflow · github.com/aishwaryaprabhat/MLflow

The four components & how a model moves through them
Your Training Code any framework, any script mlflow.start_run() autolog() Tracking Server runs · params · metrics log_param / log_metric log_artifact Model Registry versions · aliases · tags register_model() set_registered_model_alias Serving REST endpoint / batch models serve -m pyfunc.load_model() logs to register @alias search_runs() / compare in UI rollback: reassign alias EXPERIMENT PRODUCTION
01Install & Connectpip + tracking URI
02Experiments & Runsthe unit of tracking
03Log Params, Metrics, Artifactsthe daily loop
04Autologgingzero-effort tracking
05Log a Model (Flavors)framework-agnostic packaging
06Model Registryversion, alias, govern
07Load & Serveinference time
08UI & CLIexplore & operate
09Query & Compare Runsfind the best run
10MLflow Projectspackage for reproducibility
11Organization & Performancegood habits
Model URI Formatsanywhere you see a model_uri

Model lifecycle & project anatomy

From a logged artifact to a governed, servable model — and how an MLflow Project folder is laid out. Diagrams render via Mermaid; based on the official MLflow Model Registry guide.

Registry lifecycle (current: aliases)

Stages (Staging/Production/Archived) are deprecated since MLflow 2.9. Aliases are flexible, mutable, and multiple can point at one version.

flowchart LR
  A["mlflow.<flavor>.log_model()"] --> B["register_model() → v1, v2, v3 …"]
  B --> C{"set_registered_model_alias"}
  C -->|"@champion"| D["serves prod traffic"]
  C -->|"@challenger"| E["A/B test candidate"]
  D -->|"reassign on rollback"| B
      

Stages vs. Aliases

Conceptually the same goal — label which version is "live" — but aliases drop the rigid 4-state machine.

flowchart TD
  subgraph Deprecated["Stages (deprecated 2.9+)"]
    direction LR
    N["None"] --> S["Staging"] --> P["Production"] --> Ar["Archived"]
  end
  subgraph Current["Aliases (current)"]
    direction LR
    V1["v1 @staging"]
    V2["v2 @champion"]
    V3["v3 @challenger"]
  end
      

MLflow Project folder structure

Two files make any script reproducible on another machine: the entry-point spec and the environment definition.

flowchart LR
  Root["MLflow_project/"] --> MLP["MLproject — entry points + params"]
  Root --> ENV["conda.yaml / python_env.yaml — dependencies"]
  Root --> SRC["train.py — your code"]
  MLP -. "mlflow run ." .-> RUN["Reproducible run, anywhere"]
      

Worth memorizing

stages → aliasesdeprecated since 2.9; use @champion/@challenger instead
log_artifact ≠ log_paramartifacts = files/blobs; params = scalar hyperparameters
runs: vs models:runs:/id/model = pre-registry; models:/name@alias = governed
autolog()one line captures params + metrics + model for most frameworks
nested=Truegroups hyperparameter-sweep child runs under one parent
mlruns/ missing?run `mlflow ui` from the directory that contains it
batch your loggingavoid log_metric() inside a tight per-step loop
tracking URIfile:./mlruns (local) or http(s)://server:5000 (remote)