Sub topic 7
Comparing Runs in the MLflow UI
This chapter assumes that you know basic Python, can train a scikit-learn model, and understand parameters, metrics, and train/test splits. It also assumes that you have started an MLflow Tracking Server and logged at least two runs to the same experiment.
When you train several models, the terminal output is not enough for reliable comparison. You may forget which data split a run used, which value of C produced a score, or whether a metric came from training or test data. MLflow stores these details with each run and presents them in one searchable interface.
Open the MLflow UI
Start the tracking server if it is not already running:
mlflow server \
--backend-store-uri sqlite:///mlflow.db \
--default-artifact-root ./mlartifacts \
--host 127.0.0.1 \
--port 5000Open http://127.0.0.1:5000 in a browser. The left side lists experiments. An experiment is a named container for related runs, such as iris-baseline or fraud-model-search.
Select an experiment to see its runs. A run is one execution of a training script. The run table commonly includes:
- Run name and run ID
- Start time and duration
- Parameters such as
C,max_depth, orrandom_state - Metrics such as
test_accuracyorvalidation_loss - Tags such as
stage,owner, ordataset_version
The UI shows a limited set of columns at first. Use the column selector to add parameters, metrics, or tags that matter to your comparison.
Select and compare runs
Select the checkboxes beside two or more runs, then choose the comparison action. MLflow opens a comparison view with charts and parallel coordinates.
The comparison view helps answer questions such as:
- Which parameter values produced the best validation metric?
- Did a larger model improve accuracy enough to justify its cost?
- Do runs with one dataset version behave differently?
- Is a result caused by a parameter change or by a different random seed?
A table can show that one run scored higher. A chart can show whether the difference is consistent across several runs. Use both views rather than treating the highest metric as automatically best.
For example, a model with test_accuracy of 0.96 might be preferable to one with 0.97 if the first model is smaller, faster, or easier to explain. Record those concerns as metrics or tags so they remain visible during comparison.
Filter and sort the run table
Use the filter box to restrict the displayed runs. MLflow filters can reference metrics, parameters, and tags. For example:
metrics.test_accuracy > 0.9 and tags.stage = 'baseline'This filter keeps runs whose test_accuracy is above 0.9 and whose stage tag is baseline. You can also sort by a metric column to place the strongest runs first.
Filtering is useful when an experiment contains many trials. Tags make filtering more meaningful. A tag such as dataset_version=2026-01 can separate runs that used different data. A tag such as status=failed can identify incomplete or unusable runs.
Read the run details
Open a run to inspect its complete record. The details page separates information into sections:
- Parameters describe selected inputs to training.
- Metrics describe numeric results and may include their history.
- Tags describe labels and metadata.
- Artifacts contain files such as plots, reports, configuration files, and saved models.
- System information can include runtime details collected by MLflow.
A metric history is important for iterative training. If your script logs train_loss with a step number, the UI can draw loss against epoch or iteration. A curve that rises or stops improving may reveal overfitting or a learning problem that a final score hides.
Use a repeatable comparison process
A practical review process is:
- Filter out failed or incomplete runs.
- Restrict the table to one dataset and evaluation procedure.
- Sort by the primary validation metric.
- Select the best few runs.
- Compare secondary metrics, parameters, tags, and artifacts.
- Open the candidate run and inspect its configuration and model files.
- Record why one run was chosen.
The UI records evidence, but it does not decide whether a model is suitable for production. Your comparison criteria must include the model’s intended use, constraints, and evaluation risks.
Exercise
Why should you filter runs by dataset version and evaluation procedure before selecting the highest metric?
Show answer
Because metrics produced from different data or evaluation methods may not be comparable. Filtering makes the ranking meaningful.