Sub topic 6
Artifacts, Dataset Versions, and Model Registries
This chapter assumes you know Python, can run a training script, and understand hyperparameters, metrics, and train/validation splits. It also assumes you know that an experiment tracker stores information about a training run.
Artifacts are the files behind a run
A parameter is a small configuration value, such as learning_rate=0.1. A metric is a measured value, such as validation AUC at step 20. An artifact is a file or directory produced or consumed by a run.
Common artifacts include:
- Training and validation datasets
- Model files and serialized preprocessing pipelines
- Confusion matrices and plots
- Feature lists and data schemas
- Evaluation reports
- Logs and configuration files
A metric tells you that a model achieved an AUC of 0.91. A model artifact lets you load that model later. The metric and the artifact are useful together because the run records which model produced the result.
Artifacts are usually stored outside the tracking database. The tracker stores metadata, such as the artifact path, file name, size, and producing run. The artifact store holds the actual bytes. This separation allows large files without putting them into every database row.
Dataset versions make runs reproducible
A dataset version is an identifiable snapshot of the data used by a run. The snapshot might be a file, a table snapshot, or a reference to data in an external system.
Logging a dataset alone does not guarantee reproducibility. Also record:
- The dataset version or content hash
- The source location
- The schema version
- The time range covered
- The transformation code version
- Whether the data was sampled or filtered
For example, customers.parquet is a weak reference if it is overwritten every day. A stronger reference is s3://ml-data/customers/date=2026-11-01/, combined with a checksum and schema description.
MLflow can log a dataset as an artifact and record dataset metadata. W&B uses Artifacts as versioned objects. A W&B dataset artifact can have aliases such as latest or production, while each update creates a distinct version.
Model registries add lifecycle metadata
A model registry is a catalog of models that adds names, versions, ownership, descriptions, and lifecycle state to model artifacts.
An artifact store answers, “Where is this file?” A registry answers, “Which version should the serving system use, and why?”
A typical workflow is:
- Train a model and log its parameters, metrics, data reference, and model artifact.
- Register the model under a stable name.
- Compare candidate versions against an evaluation policy.
- Assign an alias or lifecycle label to an approved version.
- Deploy that version.
- Keep the older version available for rollback.
MLflow Model Registry gives each registered model version a number. Teams can attach tags and descriptions and use aliases such as champion or challenger. W&B provides model artifacts and registry collections with versioning and aliases. In both systems, the registry points to a versioned artifact; it does not replace deployment automation.
A small MLflow example
The following script logs a dataset file and registers a scikit-learn model. It uses a local SQLite tracking database and a local artifact directory.
from pathlib import Path
import mlflow
import mlflow.sklearn
from sklearn.datasets import load_iris
from sklearn.linear_model import LogisticRegression
mlflow.set_tracking_uri("sqlite:///mlruns.db")
mlflow.set_experiment("iris-classification")
data = load_iris()
dataset_path = Path("iris-data.txt")
dataset_path.write_text(
"\n".join(
f"{features.tolist()}\t{label}"
for features, label in zip(data.data, data.target)
)
)
model = LogisticRegression(max_iter=200)
model.fit(data.data, data.target)
with mlflow.start_run(run_name="registered-baseline") as run:
mlflow.log_param("max_iter", 200)
mlflow.log_metric("training_accuracy", model.score(data.data, data.target))
mlflow.log_artifact(str(dataset_path), artifact_path="dataset")
mlflow.set_tag("dataset_version", "iris-sklearn-1")
mlflow.sklearn.log_model(
model,
artifact_path="model",
registered_model_name="iris-classifier",
)
print("run_id:", run.info.run_id)The registered model name remains stable while new training runs create new model versions. A deployment process can select a version after checking its evaluation results.
Comparing the two systems
| Concern | MLflow | Weights & Biases |
|---|---|---|
| Model storage | Model artifacts plus Model Registry | Model artifacts plus Registry collections |
| Dataset versioning | Logged artifacts and dataset metadata | Versioned Artifacts with aliases and lineage |
| Registry selection | Model versions, tags, and aliases | Artifact versions, aliases, and collections |
| Main design choice | Operate or buy the tracking service | Use the hosted collaboration platform or an available managed option |
A registry should not be the only approval mechanism. Store evaluation results, test data references, code commit identifiers, and approval decisions with the candidate version. This gives reviewers enough context to understand what they are approving.
Exercise
Why should a production run record an immutable dataset version instead of only the alias latest?
Show answer
The alias can move to a different dataset later. An immutable version lets the team identify and reproduce the exact data used by the run.