W&B Artifacts for Model and Prompt Versioning
What you'll learn: How to use Weights & Biases Artifacts to version control prompts, datasets, and model checkpoints for full reproducibility and traceability.
The Challenge of Reproducibility
When you're iterating on LLM applications, you often change prompts, swap datasets, or update model checkpoints. Without versioning, it becomes impossible to know exactly which combination of assets produced a specific result. Was it prompt v3 with dataset v2? Or prompt v4 with the old checkpoint?
What Are W&B Artifacts?
Think of Artifacts as Git for your ML assets. They're immutable, versioned snapshots of files or directories. Each time you log an artifact (a prompt template, evaluation dataset, or model checkpoint), W&B assigns it a unique version. You can track lineage—which artifacts were used to create others—and roll back to any previous version instantly.
Core Concepts
Logging an Artifact:
import wandb
run = wandb.init(project="llm-app")
# Version a prompt template
prompt_artifact = wandb.Artifact("system-prompt", type="prompt")
prompt_artifact.add_file("prompts/v5_system.txt")
run.log_artifact(prompt_artifact)
Using an Artifact:
# Later, retrieve exact version
artifact = run.use_artifact("system-prompt:v5")
artifact_dir = artifact.download()
Versioning Datasets:
eval_data = wandb.Artifact("eval-dataset", type="dataset")
eval_data.add_file("eval_cases.jsonl")
run.log_artifact(eval_data)
This creates an audit trail: every experiment is linked to specific versions of prompts, data, and models. You can compare across versions, reproduce past results, and understand what changed between iterations.
Key Takeaway: W&B Artifacts provide Git-like version control for prompts, datasets, and models, enabling full reproducibility and a traceable lineage of your LLM experiments.