How to Version ML Datasets and Models With W&B Artifacts

October 12, 2026

Tracking metrics is half the job. The other half is knowing which dataset and which weights produced those metrics. Weights & Biases calls these versioned files artifacts, and they turn an experiment log into a reproducible record.

Quick answer: Log files with run.log_artifact(path, type="dataset"), consume them with run.use_artifact("...:latest"), and W&B gives each version a hash and a lineage graph linking data to model.

Most teams adopt artifacts only after a painful incident — a model that cannot be retrained because the exact training split is gone. Setting it up beforehand is cheap; reconstructing it afterward is not.

How do you log a dataset as an artifact?

import wandb

run = wandb.init(project="churn-model", job_type="data-prep")
art = wandb.Artifact("training-data", type="dataset",
                     description="Churn data through 2026-09")
art.add_file("data/train.parquet")
run.log_artifact(art)
run.finish()

W&B hashes the contents and gives you a version like v0, v1. Change one byte and the next version is distinct — no manual numbering.

How do you consume an artifact in training?

run = wandb.init(project="churn-model", job_type="train")
data = run.use_artifact("training-data:latest")
path = data.download()

# train...
model = wandb.Artifact("churn-classifier", type="model")
model.add_file("model.pt")
run.log_artifact(model)
run.finish()

Because training calls use_artifact, W&B records the exact dataset version in the run’s lineage. Months later you can trace a model back to the data it saw.

What do the version aliases mean?

Alias Meaning
v0, v1 Immutable version numbers
latest Newest version of that artifact
best Whatever you alias as best
production Alias for the deployed version

Aliases move; versions do not. Point your deployment at production and promote a new version to that alias when you are ready — the old one stays available for rollback.

How do you promote and roll back a model?

# promote\nart = run.use_artifact("churn-classifier:v3")
art.aliases.append("production")
art.save()

Rolling back is the same call with the previous version. Because every version persists, you are never stuck with a bad deploy once you catch it.

What are the storage and cost limits?

Artifact storage counts against your plan’s quota. The free tier covers personal projects with a few gigabytes; datasets of images or video blow through that quickly and push you to a paid team plan. Model checkpoints are the usual culprit — log the final weights, not every epoch.

What trips people up?

  • Logging large artifacts every step fills your quota fast; log at the end.
  • Forgetting to call run.finish() leaves the run open and the artifact pending.
  • Downloading to the same path each time overwrites local files silently.
  • Aliases are per-artifact, so best on one model is unrelated to best on another.

Who this suits: teams shipping models to production who need rollback and audit trails. Who should skip it: if you train locally on one dataset and never redeploy, a git repo for code plus a folder of weights is honestly sufficient.

Quick Summary

  • Artifacts version datasets and model weights with automatic content hashing.
  • Log with log_artifact, consume with use_artifact to build lineage.
  • Aliases like production enable one-call promotion and rollback.
  • Versions are immutable, so old models stay reproducible.
  • Storage counts against your plan — do not log every checkpoint.