Sub topic 5
Comparing Runs and Sharing Results with a Team
This chapter assumes you know the run data model from the earlier chapters: experiments, runs, parameters, metrics, tags, and artifacts. It also assumes you can run a tracking server or have a W&B account. Logging runs is the easy part. A tracker pays off when someone can ask "which run was best, and why?" and get an answer other people can check. This chapter covers how MLflow and Weights & Biases (W&B) support comparing runs and sharing the result, and where each approach breaks down.
What comparison needs from your data
Every comparison view is a query over the data you logged. Four properties of that data decide how useful the views are.
- Consistent names.
val_aucin one run andvalidation_aucin another will never appear on the same chart. - Consistent steps. Curves line up only if the x-axis means the same thing in each run. Mixing epochs in one run with batch counts in another produces curves that are not comparable.
- Tags for context. Parameters say what you changed in the model. Tags such as
data_version,git_sha, orownersay what else differed. Without them you can compare two runs and wrongly credit a hyperparameter for a gain that came from new data. - A defined summary value. A run has a metric history and a single summary number. You need to know which one the table shows. Both tools show the latest logged value by default, not the best one.
Comparing runs in MLflow
The MLflow UI opens on an experiment page. Each row is a run, and each column is a parameter, metric, or tag. You can:
- sort by any metric column;
- filter with a query string such as
metrics.val_auc > 0.9 AND params.max_depth = "6"; - hide columns to keep the table readable.
Select two or more rows and click Compare to open a comparison view. Newer versions also offer a chart view directly on the experiment page. The comparison view shows:
- a table of parameter and metric differences;
- a parallel coordinates plot, where each line is a run passing through its parameter values to its metric;
- a scatter plot of one parameter or metric against another;
- a contour plot for two parameters against one metric;
- a box plot.
Opening a single run shows its metric history as line charts, with several runs overlaid on one chart.
Two details cause confusion. First, parameters are stored as strings, so a filter on params.max_depth compares text and you must quote the value. Second, the table shows the latest logged value of a metric. If a run peaked at step 40 and degraded by step 50, the table shows the step-50 number. Log an extra metric such as best_val_auc at the end of training if you want the table to rank by peak performance.
Comparing runs in W&B
W&B organizes comparison around a workspace. A workspace is a page of panels for one project. By default W&B creates line plots for every metric you logged, with all runs overlaid. A run table sits beside the charts. You can:
- group runs by a config value (for example, group by
max_depthto see averaged curves with a variance band); - filter and sort the table;
- toggle runs on and off with the eye icon;
- add panels such as scatter plots, parallel coordinates, and bar charts.
Panel layouts are saved as views, so a teammate can open the same arrangement.
For tuning work, W&B Sweeps adds a parameter importance panel. It estimates how strongly each hyperparameter correlates with the target metric. Treat it as a hint, not a causal result. With few runs, or with hyperparameters that were varied together, the ranking is unreliable.
W&B line charts apply smoothing and downsampling for display. A curve that looks smooth on screen may hide a spike. When a chart looks suspicious, turn smoothing off before drawing conclusions.
Comparing runs in code
UI comparison is good for exploration. A decision you need to defend should come from a query you can rerun. Both tools expose runs as data.
The MLflow client returns a pandas DataFrame. This script reads runs from the experiment created in the earlier examples:
import mlflow
mlflow.set_tracking_uri("http://127.0.0.1:5000")
runs = mlflow.search_runs(
experiment_names=["churn-model"],
filter_string="metrics.val_auc > 0.8",
order_by=["metrics.val_auc DESC"],
max_results=20,
)
columns = [
"tags.mlflow.runName",
"params.max_depth",
"params.learning_rate",
"metrics.val_auc",
"tags.data_version",
]
available = [c for c in columns if c in runs.columns]
print(runs[available].to_string(index=False))The column check matters. If no run ever set the data_version tag, that column does not exist and a direct lookup raises a KeyError.
The W&B public API works the same way. Replace my-team with your entity, which is your username or team name:
import wandb
api = wandb.Api()
runs = api.runs("my-team/churn-model")
rows = []
for run in runs:
rows.append(
{
"name": run.name,
"max_depth": run.config.get("max_depth"),
"learning_rate": run.config.get("learning_rate"),
"val_auc": run.summary.get("val_auc"),
}
)
rows = [r for r in rows if r["val_auc"] is not None]
rows.sort(key=lambda r: r["val_auc"], reverse=True)
for r in rows[:10]:
print(r)Here run.summary holds the last logged value of each metric. To read the full curve, call run.history(keys=["val_auc"]), which returns a DataFrame.
Sharing results with a team
Comparison is private until someone else can see it. The two tools differ most in this respect.
| Aspect | MLflow (self-hosted open source) | Weights & Biases |
|---|---|---|
| Where results live | Your tracking server | W&B cloud, dedicated cloud, or self-managed server |
| Sharing a view | Send the run or compare-page URL | Share a workspace link or publish a report |
| Narrative documents | None built in. Link runs from a wiki or notebook | Reports combine text, charts, and tables, and stay linked to live runs |
| Access control | None by default. A basic-auth app exists, or you place a reverse proxy in front | Teams, projects with visibility settings, and roles, depending on plan |
| Who can reach it | Anyone on the network that can reach the server | Anyone invited to the team or given a link, subject to project privacy |
| Comments and discussion | Not built in | Comments on reports and panels |
MLflow's strength is that the data stays in your infrastructure and a URL is enough to share it. Its weakness is that an unauthenticated server lets anyone who can reach it read and delete runs. Before you share an MLflow server beyond your own machine, decide how you will authenticate users. Options are the built-in basic-auth app (mlflow server --app-name basic-auth), an authenticating reverse proxy, or a managed MLflow offering. The next chapters on hosting and governance cover these choices in more detail.
W&B reports are the feature that most changes team habits. A report is a document that embeds live panels. A reviewer who reads "the deeper trees overfit" can click through to the exact runs. MLflow teams often reproduce this with a notebook that calls search_runs and renders charts, which is more work but is versioned in git like any other code.
Common errors when comparing runs
- Comparing runs on different data. If runs differ in training data or validation split, the metric difference may have nothing to do with the parameters. Log
data_versionand a split identifier as tags on every run. Filter on them before comparing. - Ranking by the last value. Both tools default to the latest value. For a metric that peaks and then degrades, log the best value explicitly, or compute it from the history.
- Reading one run as a result. Seed noise can move a metric by a point or more. Run each configuration several times and compare the spread. In W&B, grouping runs shows this directly. In MLflow, aggregate with pandas.
- Mismatched steps. If one run logs per epoch and another per batch, overlaid curves are misleading. Pick one convention per project and write it down.
- Unreadable run names. MLflow generates names such as
loud-owl-123, and W&B does similar. Set meaningful names and aownertag, or nobody can tell whose run is whose. - Deleted or moved runs. A link to a run breaks if the run is deleted or the server URL changes. In a decision note, record the run ID and the tracking server address, not only the link.
- Overwriting a shared view. In W&B, a saved workspace view is shared. Edits by one person change what others see. Treat an important view as a published artifact, and copy it before changing it.
What this means for your choice
Weigh these points against your team's working style:
- If reviewers mostly read results in meetings and documents, W&B reports and saved views cover that without extra tooling.
- If the team works mainly in notebooks and code review, MLflow's
search_runsplus versioned analysis code can fit better. The UI is plainer, but your analysis stays in git. - If many people with different roles need access, check the access control model first. An open MLflow server and a W&B team with project-level privacy have very different risk profiles.
- If you need both, the thin interface from a later chapter lets you log to either tool without changing training code.
Exercise
Your MLflow experiment table shows run A with val_auc 0.89 and run B with 0.91, so you pick B. A colleague notes that B's curve peaked at 0.93 at step 30 and then declined. What is the problem with the table, and how do you fix it for future runs?
Show answer
The table shows the latest logged value of the metric, not the best one, so it understates peak performance and says nothing about overfitting after step 30. Before you compare the runs, check whether A has the same pattern by reading each run's full metric history. For future runs, log an explicit summary metric such as best_val_auc (and the step where it occurred), or compute the best value from the history with the client API. Then rank by that metric, and decide whether to use early stopping or checkpoint the best step.
Exercise
Two teammates compare 12 runs in a shared W&B project and conclude that a higher learning rate improves AUC. List two checks you would make before accepting this, using data the tracker already holds.
Show answer
First, check that the runs share the same data_version and validation split tags, so the difference is not from the data. Second, group runs by learning rate and look at the spread across seeds, since a single run per setting can be noise. You could also confirm that the other hyperparameters did not vary together with learning rate, because parameter importance and scatter plots cannot separate parameters that changed at the same time.