Sub topic 2
The data model every tracker shares
This chapter assumes you can write a Python training script, you know what hyperparameters and validation metrics are, and you have a rough idea of how a client talks to a server over HTTP. By the end you will be able to name the six core objects every experiment tracker stores, map them onto MLflow and Weights & Biases (W&B) calls, and spot the errors that most often corrupt tracked data.
Why a shared model exists
MLflow, W&B, Comet, ClearML, Aim and TensorBoard differ in hosting, interface and price. They all answer the same question: given a result, what produced it? To answer it, each tool stores the same small set of objects. Once you know them, switching tools means learning new function names, not a new way of thinking. Later chapters compare the tools, and the comparison only makes sense if you can see which features are shared and which are unique.
The six shared objects are:
- Experiment (or project)
- Run
- Parameters (or config)
- Metrics
- Tags
- Artifacts
The objects
Experiment or project
An experiment is a named group of runs that attack the same problem, such as churn-model. MLflow calls it an experiment. W&B calls it a project. Its purpose is organization: the comparison table and the charts are scoped to one group, so runs that are not comparable should not live together.
A common mistake is to use one experiment for the whole team and every model. The list becomes noisy, and comparisons mix runs that used different data or different metrics.
Run
A run is one execution of your training code. It is the central unit. Everything else hangs off a run. A run has a unique ID, a start and end time, a status (running, finished, failed), and optionally a human-readable name such as baseline.
Treat a run as immutable evidence. If you change the learning rate and retrain, start a new run. Do not reuse the old one. Otherwise you lose the record of what produced the earlier numbers.
Parameters
Parameters are the inputs you chose before training: max_depth, learning_rate, batch size, random seed. They are single values, logged once per run. MLflow calls them params. W&B calls them config.
Parameters are write-once in MLflow. Logging the same key twice with a different value raises an error. W&B config is more permissive, and it lets you update values, which is convenient but makes it easier to overwrite a record by accident.
Metrics
Metrics are numbers that measure the outcome, such as loss or AUC (area under the ROC curve). Unlike parameters, a metric is usually a series. You log it repeatedly with a step number, and the tracker draws a curve. Each logged point is a triple: name, value, step. Most trackers also store a timestamp.
The step is an integer you supply, usually the epoch or the batch count. If you omit it, the tracker assigns its own counter, and the x-axis on your chart may not mean what you think.
Tags
Tags are free-form labels on a run, such as data_version=2026-11-01 or owner=amira. They are not hyperparameters and not outcomes. They describe context, and you use them to filter. MLflow has tags directly. W&B has tags as a list of strings, and you can also keep key-value context in config or in a run's summary and notes.
Artifacts
Artifacts are files a run reads or writes: a trained model, a plot, a confusion matrix image, a sample of predictions, a dataset snapshot. The tracker stores the file in an artifact store, which is usually separate from the place where it stores the numbers. Chapter content on registries comes later. For now, remember that an artifact is a file attached to a run, and a good tracker records its location and, in some tools, a content hash and a version.
How the objects relate
The diagram shows the core rule: all data is keyed by run. A metric point has no meaning without the run that logged it. This is also why the run ID is the thing you should store in your own systems, for example in a deployment record, when you need to trace a model back to its origin.
Naming across tools
The concepts match, but the vocabulary differs. This table maps them.
| Concept | MLflow | Weights & Biases | TensorBoard |
|---|---|---|---|
| Group of runs | Experiment | Project | Log directory (folder of runs) |
| One execution | Run | Run | Run (subfolder) |
| Inputs | Params | Config | HParams plugin |
| Outcome series | Metrics | History (`run.log`) | Scalars |
| Final values | Latest metric value | Summary | Last scalar value |
| Context labels | Tags | Tags, notes | None built in |
| Files | Artifacts | Artifacts | Images, embeddings (limited) |
TensorBoard is the odd one out. It reads event files from a directory, so it has no server-side concept of a run ID, and it has no real tag or parameter store unless you use the HParams plugin. Chapter 8 covers where that is enough.
The data model in code
The next script logs one run to MLflow. Start a local server first.
pip install mlflow
mlflow server --host 127.0.0.1 --port 5000Then run the training script.
import mlflow
mlflow.set_tracking_uri("http://127.0.0.1:5000")
mlflow.set_experiment("churn-model")
with mlflow.start_run(run_name="baseline"):
mlflow.log_param("max_depth", 6)
mlflow.log_param("learning_rate", 0.1)
for step, auc in enumerate([0.84, 0.88, 0.91]):
mlflow.log_metric("val_auc", auc, step=step)
mlflow.set_tag("data_version", "2026-11-01")Each call maps to one object:
set_experimentselects, and creates if needed, the experiment.start_runcreates the run. Leaving thewithblock ends it and sets its status to finished. If the block raises an exception, MLflow marks the run as failed.log_paramwrites two parameters.log_metricwrites three points to theval_aucseries.set_tagwrites one tag.
The same run in W&B looks like this:
import wandb
run = wandb.init(
project="churn-model",
name="baseline",
config={"max_depth": 6, "learning_rate": 0.1},
)
for step, auc in enumerate([0.84, 0.88, 0.91]):
run.log({"val_auc": auc}, step=step)
run.finish()Here project is the experiment, config holds the parameters, and run.log writes metric points. There is no separate call for parameters, because they are passed when the run starts. Note that this script has no tag. W&B accepts tags=["data-2026-11-01"] in wandb.init, but it stores a list of strings, not a key and a value.
The next two chapters cover the architecture behind these calls. The point here is that both scripts create the same logical record.
What a run looks like over time
A run moves through a small set of states. Knowing them explains several common errors.
If a job is killed with SIGKILL, or the machine loses power, no code runs to close the run. MLflow then leaves the run in the RUNNING state until someone fixes it. W&B detects a missing heartbeat and eventually marks the run as crashed. Either way, a "running" run that has not logged for hours is almost certainly dead. Filter it out before you compare results.
Common errors
These problems account for most bad tracking data.
- Overwriting parameters. In MLflow,
log_param("lr", 0.1)followed bylog_param("lr", 0.2)in the same run raises an exception. Choose the value first, then log it once. - Logging metrics without a step. Without
step, each point still gets a counter, but resumed or repeated logging can give you a chart whose x-axis does not match your epochs. Always pass the step. - Mixing up final and best. A metric series has many values. The "latest" value is not the "best" value. If you want the best validation AUC, log it as its own metric, or compute it from the series.
- Logging a parameter that changes. A value that changes during training, such as the current learning rate under a scheduler, is a metric, not a parameter. Log the initial value and the schedule name as parameters, and the current value as a metric series.
- Putting data in tags that belongs in parameters. If you plan to sort or plot by a value, store it as a parameter. Tags are for filtering and context. MLflow stores tag and parameter values as strings, but its search and charts treat parameters as first-class inputs.
- Forgetting to end the run. In notebooks, a run started without a
withblock stays open. The nextstart_runraises an error, or the new data lands in the old run. Use the context manager. - Logging code and data versions nowhere. A run with parameters but no record of the data version or code revision cannot be reproduced. Log a tag for the Git commit and one for the data version. MLflow records the Git commit automatically when it runs inside a repository, but only when it can detect it.
What the model does not capture
The shared model covers what you choose to log. It does not guarantee reproducibility. Four gaps matter:
- Environment. Library versions, CUDA version and hardware are not logged unless the tool collects them or you log them. W&B and MLflow collect some of this for you, but the amount varies by tool and configuration.
- Randomness. A seed is a parameter only if you log it, and some operations on GPUs are not deterministic even with a seed.
- Data. A tag with a date is a pointer, not a copy. If the underlying table changes, the pointer lies. Artifacts and dataset versioning, covered in a later chapter, address this.
- Code. A Git commit hash is only useful if the working tree was clean when you ran the job.
Mapping the model to storage
Knowing where each object lives helps with the architecture chapters ahead. In most trackers, the small structured objects (experiments, runs, parameters, metrics, tags) go into a database, because you query and filter them. Artifacts are large and opaque, so they go to file or object storage, with the database holding only a pointer.
| Object | Typical storage | Why |
|---|---|---|
| Experiment, run, param, tag | Relational database | Small rows, filtered and sorted often |
| Metric points | Database or time-series store | Many rows per run, read as series |
| Artifacts | File system or object store such as S3 | Large files, read rarely |
This split has a practical effect. You can lose access to an artifact store, for example from an expired credential, while the run table still loads. The chart will show, but the model download will fail.
Putting it together
When you evaluate any tracker, ask the same five questions in the same order. What is its name for each of the six objects? Where does it store structured data, and where does it store files? Can it record the code and data version, or must you do that yourself? How does a run end, and what happens when it dies? Can you query runs through an API, not only a web page? The remaining chapters answer these for specific tools.
Exercise
A teammate's script calls mlflow.log_param("learning_rate", 0.1) before training and mlflow.log_param("learning_rate", current_lr) at the end of every epoch, where a scheduler lowers the rate over time. The second call raises an error. Explain the cause and give the correct way to log this information.
Show answer
MLflow parameters are write-once per run, so a second log_param with a different value for the same key fails. The learning rate under a scheduler changes during training, so the current value is a metric, not a parameter. Log the starting value and the scheduler name once as parameters, for example log_param("learning_rate", 0.1) and log_param("lr_schedule", "cosine"). Then log the current value each epoch as a metric series with mlflow.log_metric("lr", current_lr, step=epoch).
Exercise
You have two runs of the same experiment. Run A has the tag data_version=2026-10-01 and run B has data_version=2026-11-01. Both report a val_auc of 0.91. Name two things the shared data model does not tell you that you need before you decide the models are equivalent.
Show answer
Any two of these: the code revision (Git commit) and whether the working tree was clean; the environment (library, CUDA and hardware versions); the random seed, if it was not logged; whether the underlying data behind each date tag is still unchanged, since a tag is only a pointer; and whether both runs computed val_auc on the same validation split. The data model records only what was logged, so each of these must be logged as a parameter, tag or artifact to be comparable.