Building a model leaderboard in Weights & Biases (W&B) isn’t just about displaying results; it’s about creating a dynamic, reproducible system for comparing model performance and driving iterative improvement. The most surprising thing is how little explicit "leaderboard" configuration you actually do; the system emerges from well-structured experiment tracking and simple dashboard components.

Let’s see this in action. Imagine you’re training a series of image classification models. Each model run logs metrics like accuracy, loss, and F1-score to W&B.

import wandb

# Initialize a W&B run
run = wandb.init(project="image-classification-leaderboard", 
                 name="resnet50-v1",
                 config={
                     "model_architecture": "ResNet50",
                     "learning_rate": 0.001,
                     "epochs": 50,
                     "dataset": "CIFAR-10"
                 })

# Simulate training and logging metrics
for epoch in range(50):
    # ... model training ...
    accuracy = 0.85 + (epoch / 50.0) * 0.1  # Example increasing accuracy
    loss = 1.0 - (epoch / 50.0) * 0.8       # Example decreasing loss
    
    wandb.log({"epoch": epoch, "accuracy": accuracy, "loss": loss})

# Finish the run
run.finish()

You’d repeat this for different model architectures, hyperparameters, or even datasets.

# Another run for a different model
run_vit = wandb.init(project="image-classification-leaderboard", 
                     name="vit-base-patch16-v1",
                     config={
                         "model_architecture": "VisionTransformer",
                         "learning_rate": 0.0005,
                         "epochs": 50,
                         "dataset": "CIFAR-10"
                     })

for epoch in range(50):
    # ... model training ...
    accuracy = 0.88 + (epoch / 50.0) * 0.08
    loss = 0.95 - (epoch / 50.0) * 0.7
    
    wandb.log({"epoch": epoch, "accuracy": accuracy, "loss": loss})

run_vit.finish()

Now, to build the leaderboard, you navigate to your W&B project page. You’ll see a list of all your runs. The magic happens when you add a "Table" panel to your project dashboard.

In the panel configuration, you select "Runs" as the data source. Then, you choose the columns you want to display. Crucially, you select key metrics like accuracy and loss, and important configuration parameters like config.model_architecture and config.learning_rate. You can also add custom columns, like run.name or run.id.

The "Sort by" option is where the leaderboard truly takes shape. You can sort by accuracy in descending order, making the highest accuracy models appear at the top. You can add secondary sort criteria, for example, sorting by loss in ascending order if accuracies are tied, or by run.name to maintain a consistent order.

This "Table" panel is your dynamic leaderboard. It automatically updates as new runs are logged. You can filter it by dataset, model type, or any other logged parameter. For instance, if you want to see only ResNet models, you apply a filter for config.model_architecture equals "ResNet50".

The mental model is that W&B is fundamentally a structured database of your experiments. Each wandb.log call is an insertion or update, and each wandb.init with a project name groups these entries. The dashboard panels are just different ways of querying and visualizing this data. A "Table" panel is a SQL SELECT * FROM experiments WHERE project='...' ORDER BY ... statement rendered visually.

The real power comes from how W&B automatically associates logged metrics with the config dictionary and the run metadata. When you log accuracy, W&B understands it’s a metric to be displayed. When you log config={"learning_rate": 0.001}, W&B makes config.learning_rate a filterable and sortable column. You don’t need to explicitly tell W&B "this is a leaderboard column"; you just log the data, and the dashboard panel lets you define how to present it as a leaderboard.

A common misconception is that you need to manually aggregate results or write custom scripts to generate leaderboards. W&B’s dashboard is designed to do this out-of-the-box. The "Table" panel is versatile enough to act as a leaderboard, a hyperparameter grid search summary, or a detailed run log viewer, depending on how you configure its columns and sorting.

Once you have your primary leaderboard set up, the next logical step is to visualize the training curves for the top-performing models directly within the dashboard.

Want structured learning?

Take the full Wandb course →