Weights & Biases (W&B): Track Every Experiment Like a Pro — ML Experiment Platform 2026
Weights & Biases (wandb/wandb) is the AI developer platform for tracking, comparing, and deploying ML experiments. Supports PyTorch, TensorFlow, Hugging Face, and LLM fine-tuning. Covers experiment tracking, dataset versioning, model registry, and production monitoring.
- ⭐ 12000
- Updated 2026-06-09
Introduction #
Training a machine learning model without experiment tracking is like driving blindfolded. You might reach your destination eventually, but you’ll never know which turn was the right one. Weights & Biases (W&B) solves this by providing a unified platform that logs, visualizes, and compares every experiment — from hyperparameter sweeps to LLM fine-tuning runs. With 11,116 GitHub stars and integration with PyTorch, TensorFlow, Hugging Face, and major ML frameworks, W&B is widely used by ML teams for experiment tracking and model management.
What Is W&B? #
Weights & Biases is an end-to-end ML development platform that covers the entire experiment lifecycle. At its core is the logger — a lightweight library you add to your training script that automatically tracks metrics, configurations, artifacts, and even model checkpoints. Beyond logging, W&B provides a web dashboard for visualizing runs, comparing experiments side by side, sharing results with your team, and managing models from training to deployment.
┌───────────────────────────────────────────────┐
│ W&B Platform Architecture │
├───────────────────────────────────────────────┤
│ │
│ SDK (pip install wandb) │
│ ├─ Logger (metrics, params, tables) │
│ ├─ Artifact Tracker (datasets, models) │
│ ├─ Sweeps (hyperparameter tuning) │
│ ├─ Reports (visual dashboards) │
│ └─ Model Registry (production models) │
│ │
│ Cloud Dashboard │
│ ├─ Run comparison (up to 100 runs) │
│ ├─ Project-level statistics │
│ ├─ Artifact lineage graph │
│ └─ Team collaboration & sharing │
│ │
│ Integrations │
│ ├─ PyTorch, TensorFlow, JAX │
│ ├─ Hugging Face Transformers │
│ ├─ PyTorch Lightning, FastAI │
│ └─ Ray Tune, Optuna, Ax │
└───────────────────────────────────────────────┘
How W&B Works #
W&B works by instrumenting your training loop. You initialize a run, log metrics at each step, and W&B sends the data to the cloud dashboard in real time. The SDK is designed to have minimal overhead — logging a metric takes roughly 0.1ms, and the network calls are batched and compressed to reduce bandwidth usage.
import wandb
# Initialize a new run with your configuration
wandb.init(
project="my-nlp-finetune",
config={
"learning_rate": 2e-5,
"batch_size": 32,
"epochs": 3,
"model": "bert-base-uncased",
}
)
for epoch in range(config.epochs):
for batch in train_dataloader:
loss = model.train_step(batch)
# Log metrics — W&B handles the rest
wandb.log({"train_loss": loss, "lr": config.learning_rate})
The platform distinguishes between three types of tracked data: metrics (scalar values like loss and accuracy logged over time), artifacts (versioned files like datasets and model checkpoints), and media (images, audio, text samples visualized directly in the dashboard).
Installation & Setup #
Option 1: pip install (standard)
pip install wandb
Option 2: Authenticate with W&B
wandb login
# Paste your API key from https://wandb.ai/authorize
Option 3: Docker
docker pull wandb/launch
docker run -e WANDB_API_KEY=$WANDB_API_KEY \
-v /path/to/code:/app wandb/launch python train.py
Option 4: Hugging Face Integration
pip install wandb transformers
# W&B is pre-configured for Hugging Face Trainer
Integration with PyTorch, Hugging Face, and Ray Tune #
W&B integrates with virtually every popular ML framework. Here are the most common setups.
PyTorch Lightning
import pytorch_lightning as pl
from pytorch_lightning.callbacks import WandbCallback
class MyModel(pl.LightningModule):
def training_step(self, batch, batch_idx):
loss = self.forward(batch)
self.log("train_loss", loss)
return loss
# W&B callback auto-logs everything
trainer = pl.Trainer(callbacks=[WandbCallback()])
trainer.fit(model)
Hugging Face Transformers
from transformers import Trainer, TrainingArguments
import wandb
training_args = TrainingArguments(
output_dir="./results",
report_to="wandb", # Enable W&B reporting
num_train_epochs=3,
per_device_train_batch_size=16,
)
trainer = Trainer(
model=model,
args=training_args,
train_dataset=dataset,
)
trainer.train()
Ray Tune for Hyperparameter Sweeps
import ray
from ray import tune
import wandb
ray.init()
def train_model(config):
# W&B automatically captures the sweep config
wandb.init(config=config)
score = my_training_function(config)
wandb.log({"score": score})
sweep = tune.run(
train_model,
config={
"learning_rate": tune.choice([1e-4, 2e-5, 5e-5]),
"batch_size": tune.choice([16, 32, 64]),
},
metric="score",
mode="max",
)
Benchmarks / Real-World Use Cases #
W&B’s logging performance has been benchmarked across various training scales. At typical training workloads, the overhead is negligible:
| Scenario | Logging Overhead | Network Bandwidth | Dashboard Load Time | |
💬 Discussion