Weights & Biases Tutorial: Track ML Experiments Like a Pro (2026)
W&B changed experiment tracking by providing centralized logging for hyperparameters, metrics, checkpoints, and visualizations. It takes only two lines of code to integrate.
By 2026, W&B includes sweeps, artifact versioning, model registry, and team collaboration features.
Setting Up W&B
Install wandb, create an account, and add wandb.init() and wandb.log() to your script. W&B automatically captures environment and system metrics.
The real-time dashboard showing loss curves from any device is transformative.
pip install wandb\nimport wandb\nwandb.init(project="my-project", config={"lr": 0.001})\nwandb.log({"loss": loss})
Logging Metrics and Images
W&B supports histograms, images, matplotlib figures, 3D point clouds, and text outputs. wandb.Image and wandb.Table render interactively in the UI.
For a vision project, I logged prediction masks alongside ground truth at every validation step.
wandb.log({"accuracy": acc, "predictions": wandb.Image(img, caption="Sample")})
Hyperparameter Sweeps
W&B Sweeps automate hyperparameter search with grid, random, and Bayesian optimization. Bayesian methods learn from previous runs.
A Bayesian sweep found a config improving accuracy 3 percent in only 50 trials.
sweep_config = {"method": "bayes", "metric": {"goal": "minimize", "name": "val_loss"}, "parameters": {"lr": {"min": 1e-5, "max": 1e-2}}}
Artifact Versioning
W&B Artifacts provide version control for datasets and models. Each artifact has a unique hash and aliases like "latest" or "production".
Artifacts eliminated the "works on my machine" problem from our team workflow.
artifact = wandb.Artifact("my_dataset", type="dataset")\nartifact.add_dir("./data")\nwandb.log_artifact(artifact)
Model Registry
The registry adds governance with stage transitions from staging to production. Every promotion is logged with approval metadata.
For regulated clients, the registry provided the audit trail required by compliance.
wandb.link_model(model_artifact="project/model:v5", registered_model_name="fraud-detection", tags=["production"])
Reports and Collaboration
W&B Reports combine run results, visualizations, and markdown. They update automatically when new runs are added.
I create a report for every project as living documentation from problem statement to results.
api = wandb.Api()\nreport = api.create_report(project="my-project", title="Experiment Summary")
Frequently Asked Questions
Is W&B free?
Yes, free tier for individuals with unlimited runs. Team plans add RBAC, SSO, and dedicated storage.
Can I use W&B with any framework?
Yes, integrates with PyTorch, TensorFlow, Keras, JAX, Hugging Face, XGBoost, scikit-learn, and more.
How does W&B compare to MLflow?
W&B has richer experiment tracking UI. MLflow focuses on model registry and deployment. Many use both.
Is training data sent to W&B servers?
Only logged metrics are sent. Raw data stays on your machine. On-premise deployment is available.
Originally published on Ayodhyyya. Last updated June 1, 2026.