Skip to main content

LightBench

PyPI - Version

LightBench is the standalone benchmark suite for HeavyBall optimizers. It curates dozens of stiff, stochastic, and resource-intensive optimization workloads so you can benchmark new PyTorch optimizers with the same rigor used inside HeavyBall.

Highlights

  • 50+ ready-to-run tasks spanning convex, non-convex, multi-objective, and data-imbalanced regimes.
  • Typer-powered CLI apps with consistent flags for optimizers, schedules, logging, and hardware placement.
  • Reproducible harness that streams metrics to stdout and captures Markdown reports and CSV artifacts by default.
  • Ships with helper utilities and visualizations, from the original HeavyBall benchmark module.

Installation

LightBench targets Python 3.9+ and PyTorch 2.1 through 2.x. The suite currently depends on HeavyBall 2.0 or newer for optimizer implementations.

Stable release (PyPI)

pip install lightbench

The wheel publishes the lightbench console script and allows python -m lightbench entry points in any environment.

From source (preview channel)

python -m venv .venv
source .venv/bin/activate
pip install -e .

The editable install exposes the same console script while tracking the main branch.

Quick Start

Run the full benchmark harness after installation to reproduce the internal HeavyBall dashboards:

lightbench --opt ForeachSOAP --opt AdamW --steps 100000 --difficulties trivial medium

Every CLI entry supports --help. For the global runner:

lightbench --help

By default LightBench streams progress to stdout and stores aggregate results in benchmark_results.md in the working directory.

Running Individual Benchmarks

Each benchmark is a Python module under the lightbench namespace and can be executed directly:

python -m lightbench.beale --opt ForeachSOAP
python -m lightbench.class_imbalance_rare --opt Adam
python -m lightbench.xor_sequence --help

All modules expose consistent flags for optimizers (--opt), device placement (--device cuda:0), seeds, and termination criteria.

Benchmark Families

LightBench organizes tasks into thematic groups to help you target problem classes quickly:

  • Deterministic classics: Rosenbrock, Beale, Himmelblau, and other analytic surfaces for rapid optimizer sanity checks.
  • Stochastic data pipelines: Class imbalance, noisy regression, and streaming reinforcement learning probes stress variance handling and adaptive scheduling.
  • Multi-objective and constrained: Pareto, frontier, and penalty-based suites validate trade-off handling.
  • High-memory stressors: Sparse attention, sequence XOR, and large-batch language workloads surface allocator and checkpointing regressions.
  • AutoML integrations: Seamless Optuna/OptunaHub hooks enable hyperparameter sweeps and collaborative experiment sharing.

Use the Python API to enumerate available tasks and metadata:

import lightbench

print(lightbench.available())

Outputs & Artifacts

  • Markdown summaries: benchmark_results.md
  • Tabular metrics: */metrics.csv
  • Optional plots and GIFs from helper scripts in lightbench/tools

Pass --report-dir <path> to direct outputs elsewhere, or --no-write to rely solely on stdout.

Integrating With HeavyBall

LightBench imports optimizers, schedulers, and utilities from heavyball. Install HeavyBall from source or PyPI before running benchmarks against unreleased optimizer changes. When developing both packages locally, keep them in the same environment to ensure Typer entry points locate matching versions.

Historical HeavyBall benchmark docs now live in HeavyBall/docs/benchmark.md and link back to this project for deployment steps, dataset descriptions, and canonical results.

Repository Layout

  • lightbench/: Benchmarks, Typer CLIs, utilities, and helper scripts.
  • lightbench/data/: Bundled CSVs, Markdown reports, and supporting assets distributed with the wheel.
  • pyproject.toml: Project metadata, dependencies, and console-script definitions.
  • README.md: You are here.

Contributing & Support

  • File issues or feature requests in the HeavyBall repository while LightBench is in preview.
  • Use discussions to propose new benchmark families or share reproducibility reports.
  • Run pip install -e .[dev] for plotting extras when developing notebooks or visualizations.

License

LightBench is released under the BSD 3-Clause License, matching the HeavyBall optimizer library.

Metadata

Release files for lightbench 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lightbench 0.1.1
File Size Uploaded
lightbench-0.1.1.tar.gz 1.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for lightbench 0.1.1
File Interpreter ABI Platform
lightbench-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 2.2 MB

Release files / lightbench-0.1.1.tar.gz

Download URL lightbench-0.1.1.tar.gz
Size 1.1 MB
Tags Source
SHA-256 checksum
How to use checksums
3eb4a0658b08fb351680eb7c930b05a91f26ca53dd86d3e55e05508f27f48079
BLAKE2b-256 checksum
How to use checksums
6f2ad069c6b40996ff60434f2d7ac3e95b48945514ca4dfbccdb00c19d2f0cdd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release files / lightbench-0.1.1-py3-none-any.whl

Download URL lightbench-0.1.1-py3-none-any.whl
Size 1.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
53fa7df0809ed44c69bf10ae8eebba16ff7c6bc10368aaa61075fcc91b736458
BLAKE2b-256 checksum
How to use checksums
2c0979077f4da65df52d7d492795b0682749a42a3b9ed70622e70240ff4dff8f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page