Skip to main content

Benchmark suite for HeavyBall optimizers

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lightbench-0.1.1.tar.gz (1.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lightbench-0.1.1-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file lightbench-0.1.1.tar.gz.

File metadata

  • Download URL: lightbench-0.1.1.tar.gz
  • Upload date:
  • Size: 1.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for lightbench-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3eb4a0658b08fb351680eb7c930b05a91f26ca53dd86d3e55e05508f27f48079
MD5 3a5d479c7b70f341ff4f64f102bea66b
BLAKE2b-256 6f2ad069c6b40996ff60434f2d7ac3e95b48945514ca4dfbccdb00c19d2f0cdd

See more details on using hashes here.

File details

Details for the file lightbench-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: lightbench-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for lightbench-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 53fa7df0809ed44c69bf10ae8eebba16ff7c6bc10368aaa61075fcc91b736458
MD5 8e501806834cc7e5603aa15f819362b1
BLAKE2b-256 2c0979077f4da65df52d7d492795b0682749a42a3b9ed70622e70240ff4dff8f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page