Skip to main content

LeanHEBO

LeanHEBO implements the single-objective, exact-GP path of HEBO with Torch-backed numerical state and compute. It supports bounded floats (linear or logarithmic), integers (linear, stepped, logarithmic, or powers of a base), Boolean values, and categorical variables, including batched and contextual suggestions.

This is an independent alpha project, not a new optimization algorithm and not affiliated with Huawei. See NOTICE.md for provenance.

Install

LeanHEBO requires Python 3.11 or newer and is tested on Python 3.11–3.13.

python -m pip install leanhebo
# or
uv add leanhebo

Pandas and Polars support is optional:

python -m pip install "leanhebo[pandas,polars]"

CPU is the release-tested path. CUDA can be selected with RuntimeConfig(device="cuda"), but it is experimental and is not tested end to end in CI. It never silently falls back from the configured device.

Quick start

LeanHEBO minimizes the values passed to observe.

import numpy as np

from leanhebo import LeanHEBO
from leanhebo.config import GPConfig, LeanHEBOConfig, RuntimeConfig, SearchConfig
from leanhebo.space import Bool, Categorical, Float, Integer, Space


def loss(row: dict[str, object]) -> float:
    return (
        (float(row["x"]) - 0.3) ** 2
        + (int(row["depth"]) - 6) ** 2 / 25
        + (0.0 if row["activation"] == "gelu" else 0.25)
        + (0.0 if bool(row["use_bias"]) else 0.1)
    )


space = Space(
    Float("x", -2.0, 2.0),
    Integer("depth", 1, 12),
    Categorical("activation", ("relu", "gelu", "silu")),
    Bool("use_bias"),
)
config = LeanHEBOConfig(
    runtime=RuntimeConfig(seed=7),
    gp=GPConfig(initial_steps=15, update_steps=3),
    search=SearchConfig(population_size=32, generations=15),
)
optimizer = LeanHEBO(space, config=config)

for _ in range(3):
    candidates = optimizer.suggest(3)
    optimizer.observe(candidates, np.asarray([loss(row) for row in candidates.to_records()]))

print(optimizer.best_x.to_records()[0], optimizer.best_y)

The reduced fitting and search settings keep this example quick; the defaults do more work.

Pass the returned CandidateBatch directly to observe to avoid re-encoding. Records, NumPy arrays, Pandas DataFrames, and Polars DataFrames are also accepted at the boundary. Fix contextual values when suggesting with:

candidates = optimizer.suggest(8, fix_input={"use_bias": True})

Non-finite outcomes are dropped by default. Set nonfinite_policy="raise" in LeanHEBOConfig to reject them instead.

Runtime and checkpoints

Numerical observations, transformations, GP state, acquisition evaluation, random streams, and evolutionary populations use Torch. The exact GP persists across ordinary updates. Both float32 and float64 are supported.

LeanHEBO does not change process-wide Torch or BLAS thread counts on import.

Save and resume without pickling user functions:

optimizer.save("run.leanhebo")
restored = LeanHEBO.load("run.leanhebo", map_location="cpu")

The checkpoint restores observations, transformations, model and optimizer state, Sobol progress, and independent Torch generator states.

Scope

The LeanHEBO optimizer accepts one unconstrained objective and uses an exact Gaussian process, MACE, and mixed-variable NSGA-II. It does not provide user-facing multi-objective optimization, random forests, CatBoost, neural ensembles, or sparse GPs.

The supported public API is the top-level optimizer and configuration classes plus the types in leanhebo.space and leanhebo.data. Lower-level search, GP, acquisition, transform, and runtime modules are implementation details.

The repository does not yet claim general speed or optimization-quality superiority. See the benchmark README for the measurements that exist and the planned Bayesmark comparison.

Development

See CONTRIBUTING.md for setup and checks.

Metadata

Release files for leanhebo 0.2.0

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

Source distribution (sdist)

Source distribution for leanhebo 0.2.0
File Size Uploaded
leanhebo-0.2.0.tar.gz 59.4 kB Details

Built distribution (wheel)

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

Total release size: 136.1 kB

Release files / leanhebo-0.2.0.tar.gz

Download URL leanhebo-0.2.0.tar.gz
Size 59.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e18c15826f19720716ef22d0c5ff55bef6ef1fcd5670a9fc1587b80bcf8cf72e
BLAKE2b-256 checksum
How to use checksums
694302de493e3cd44dab9e55989726743adabc81b1c46a81b1c60254e7836106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release files / leanhebo-0.2.0-py3-none-any.whl

Download URL leanhebo-0.2.0-py3-none-any.whl
Size 76.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78e7639475083bb192f8ce8e333668fba59453d1127e78da9f475518cf2d4d31
BLAKE2b-256 checksum
How to use checksums
d5883c8de6f3a3b336cc3bd5b60101d642d8c94fc9094d5a078989c82ed4a9cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

This release

0.2.0 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