Weights & Biases: Experiment Tracking, Sweeps & Reports
W&B is the go-to ML experiment tracker for research teams. Log metrics, visualize training, run automated hyperparameter sweeps, version datasets, and share results — all from a single Python SDK call.
Related Products
on GumroadDeveloper Productivity Bundle
Stop rebuilding the same setup every project. 51 VSCode snippets, 40 Git aliases, 5 Docker Compose stacks, 5 GitHub Actions workflows, 5 README templates, and a dotfiles kit. Set up a professional dev environment in under an hour.
Buy on Gumroad →AI Prompt Engineering Toolkit
58 structured prompt templates for Claude, ChatGPT, and Gemini — organized by use case. Code Review, Debugging, Documentation, Architecture, and 10 model-specific tips. Stop writing prompts from scratch.
Buy on Gumroad →Developer Cheat Sheet Bundle
10 print-ready cheat sheets for the tools developers use every day: Git, Docker, Linux CLI, SQL, Regex, HTTP Status codes, VS Code shortcuts, Bash scripting, jq/JSON, and Markdown.
Buy on Gumroad →You Might Also Need
JSON Formatter & Validator
Format, beautify, and validate JSON online. Paste your JSON to instantly pretty-print it with 2-space, 4-space, or tab indentation. Minify JSON too. Free, runs in your browser.
Open free tool →
Regex Tester
Free regex tester. Test regular expressions against multiple strings with expected match/no-match assertions — see instant pass/fail results. Built-in presets for email, URL, IPv4, and phone. Pro: unl
Open free tool →
Base64 Encoder & Decoder
Free Base64 Encoder & Decoder. Convert text, images, and any file to Base64 and back. Supports URL-safe Base64, image data URIs, and file download from Base64. Runs 100% in your browser — no data sent
Open free tool →
More Free Tools
Related Articles
curl 深度使用手冊:API 測試從入門到進階
curl 是每位開發者必備的 CLI 工具。本文涵蓋 GET/POST/PUT/DELETE 請求、認證、header 設定、檔案上傳、除錯技巧,以及 REST API 測試的完整實戰範例。
Best AI Code Review Tools 2026: CodeRabbit, Sourcery, DeepCode & Bito Compared
Compare top AI code review tools for 2026: CodeRabbit, Sourcery, DeepCode, and Bito. Features, pricing, GitHub/GitLab integration, and choosing the right tool for your team.
AI Code Review Tools 2026: GitHub Copilot, CodeRabbit, Qodo Merge Ranked
Compare AI code review tools for 2026: GitHub Copilot code review, CodeRabbit, Qodo Merge, Sourcery, and PR-Agent. Pricing, accuracy, and GitHub integration.
AI Coding Tools Comparison 2026: GitHub Copilot vs Cursor vs Windsurf vs Cline
Comprehensive comparison of the best AI coding tools in 2026: GitHub Copilot, Cursor, Windsurf, and Cline. Pricing, features, model support, and real-world benchmarks.
AI Pair Programming in 2026: GitHub Copilot vs Cursor vs Claude Code
Master AI pair programming in 2026. Compare GitHub Copilot, Cursor, and Claude Code for autocomplete, chat, and agentic workflows. Includes setup guides and productivity tips.
Enjoying this tool? Get more like it.
Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.
Unlock AI-Powered Dev Tools
- ⚡ AI Code Review, Doc Generator & SQL Builder
- ⚡ All premium templates & early access
- ⚡ Member discounts on Gumroad products
$9/mo after trial · Cancel anytime
Want the full toolkit?
Get DevPlaybook Pro
Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.
MIT licensed · Instant download · No subscription
See what's included → Browse all deals →Getting Started: wandb.init() and Logging
Install with pip install wandb, authenticate with wandb login, then add three lines to any training script:
import wandb
import torch
# Initialize a run — creates a unique run in your project
run = wandb.init(
project="image-classifier",
name="resnet50-lr-0.001",
config={
"architecture": "ResNet50",
"learning_rate": 1e-3,
"batch_size": 64,
"epochs": 30,
"optimizer": "AdamW",
}
)
for epoch in range(config.epochs):
train_loss, val_loss, val_acc = train_epoch(model, ...)
# Log metrics — visible in real time on wandb.ai
wandb.log({
"epoch": epoch,
"train/loss": train_loss,
"val/loss": val_loss,
"val/accuracy": val_acc,
"lr": scheduler.get_last_lr()[0],
})
# Log images, confusion matrices, histograms
wandb.log({"predictions": wandb.Image(sample_img, caption="epoch " + str(epoch))})
# Save model as artifact
artifact = wandb.Artifact("resnet50-classifier", type="model")
artifact.add_file("model.pth")
run.log_artifact(artifact)
wandb.finish() W&B Sweeps: Automated Hyperparameter Search
Define a sweep config, then launch agents that automatically sample and run experiments:
import wandb
# Define the search space and strategy
sweep_config = {
"method": "bayes", # bayes | random | grid
"metric": {"name": "val/accuracy", "goal": "maximize"},
"parameters": {
"learning_rate": {"distribution": "log_uniform_values", "min": 1e-5, "max": 1e-1},
"batch_size": {"values": [16, 32, 64, 128]},
"dropout": {"distribution": "uniform", "min": 0.1, "max": 0.5},
"optimizer": {"values": ["adam", "adamw", "sgd"]},
},
"early_terminate": {"type": "hyperband", "min_iter": 3},
}
sweep_id = wandb.sweep(sweep_config, project="image-classifier")
def train_sweep():
with wandb.init() as run:
cfg = run.config
model = build_model(dropout=cfg.dropout)
optimizer = get_optimizer(cfg.optimizer, cfg.learning_rate)
# ... training loop
wandb.log({"val/accuracy": final_acc})
# Launch 10 parallel agents
wandb.agent(sweep_id, function=train_sweep, count=50) HuggingFace Transformers Integration
Zero-config logging with HuggingFace Trainer — just set report_to="wandb":
from transformers import TrainingArguments, Trainer
import wandb
wandb.init(project="llm-finetuning", name="llama3-8b-qlora")
training_args = TrainingArguments(
output_dir="./results",
num_train_epochs=3,
per_device_train_batch_size=4,
gradient_accumulation_steps=4,
warmup_ratio=0.03,
lr_scheduler_type="cosine",
learning_rate=2e-4,
report_to="wandb", # ← enable W&B logging
logging_steps=10,
evaluation_strategy="steps",
eval_steps=100,
save_strategy="steps",
save_steps=500,
load_best_model_at_end=True,
metric_for_best_model="eval_loss",
)
# W&B auto-logs: loss curves, learning rate, GPU util, eval metrics, model checkpoints W&B vs MLflow vs Comet vs Neptune
| Feature | W&B | MLflow | Comet ML | Neptune.ai |
|---|---|---|---|---|
| Hyperparameter sweeps | Excellent (Bayesian) | Plugin (Optuna) | Optimizer | Grid/random |
| Collaboration reports | W&B Reports (best) | Basic UI | Panels | Dashboards |
| Data/model versioning | Artifacts + lineage | MLflow Models | Model registry | Artifact store |
| Self-hostable | Enterprise only | Yes (open-source) | Enterprise only | Enterprise only |
| Free storage | 100 GB | Unlimited (local) | Limited | 200 GB |
| HuggingFace integration | Native (report_to) | Manual | Callback | Callback |
| Best for | Research, DL teams | MLOps, self-hosted | Mid-size teams | Scientific logs |
Frequently Asked Questions
What is Weights & Biases (W&B)?▼
Weights & Biases (W&B, pronounced 'wandb') is a cloud-based MLOps platform for experiment tracking, hyperparameter optimization, and team collaboration. It provides a Python SDK that logs training metrics, model weights, datasets, and media (images, audio, tables) to a central dashboard. W&B is especially popular in research settings where sweep-based hyperparameter search and rich run comparison are essential.
How do W&B Sweeps work for hyperparameter optimization?▼
W&B Sweeps automates hyperparameter search. You define a sweep config (search space, strategy, metric to optimize), then launch agents that pick hyperparameter combinations from the controller and run your training function. Strategies include grid, random, and Bayesian optimization. Multiple agents can run in parallel on different machines, all reporting to the same sweep dashboard.
What are W&B Artifacts and when should I use them?▼
W&B Artifacts are versioned datasets, models, or other files tracked through the ML pipeline. Use them to version your training datasets alongside experiments so you always know which data produced which model. Artifacts have lineage tracking: you can see the DAG from raw data → preprocessed dataset → trained model → evaluation results. This is critical for compliance and reproducibility.
How do W&B Reports differ from regular run comparisons?▼
W&B Reports are shareable, richly formatted documents that embed live run charts, text annotations, and media. You can write a report explaining your experimental findings with embedded plots that auto-update as new runs come in. Reports are ideal for communicating results to stakeholders, writing internal research memos, or producing ablation study summaries.
Does W&B work with HuggingFace Transformers?▼
Yes, W&B integrates natively with HuggingFace Transformers via the report_to parameter. Set report_to='wandb' in your TrainingArguments and W&B automatically logs loss curves, learning rate schedules, GPU utilization, and model checkpoints as artifacts. This zero-config integration covers both Trainer and Seq2SeqTrainer.
Is W&B free for individual use?▼
W&B offers a free tier for individuals with unlimited logged data, 100 GB of artifact storage, and access to Sweeps and Reports. Teams beyond a certain size require paid plans. An on-premise/self-hosted deployment (W&B Server) is available on Enterprise plans, which is relevant for organizations with strict data residency requirements.