Skip to main content

Offline and online benchmarking utilities for large language model workloads

Project description

BatchBench

BatchBench ships a Rust benchmarking core with a thin Python wrapper.

You can install it with:

uv pip install batchbench

The Python package exposes Rust functionality for request generation and benchmark execution.

Python API

import batchbench

config = {
    "endpoint": "https://example.com/v1/chat/completions",
    "user_count": 1,
    "mode": batchbench.finite_mode(requests_per_user=1),
    "request_body": batchbench.request_entry(
        {
            "model": "gpt-4o-mini",
            "messages": [{"role": "user", "content": "ping"}],
        },
        line_idx=0,
        input_tokens=1,
    ),
    "requests": [
        batchbench.request_entry(
            {
                "model": "gpt-4o-mini",
                "messages": [{"role": "user", "content": "ping"}],
                "max_tokens": 4,
            },
            line_idx=0,
            input_tokens=1,
        )
    ],
    "dry_run": True,
}

report = batchbench.run_benchmark(config)
print(report)

Request generation:

requests = batchbench.generate_requests(
    {
        "count": 16,
        "prefix_overlap": 0.2,
        "target_tokens": 128,
        "tokenizer_model": "Qwen/Qwen3-VL-235B-A22B-Instruct-FP8",
        "dist_mode": "fixed",
    },
    model="Qwen/Qwen3-VL-235B-A22B-Instruct-FP8",
)

Python CLI

The package installs batchbench, which forwards directly to the Rust CLI implementation. Use the same flags as the Rust binary:

batchbench \
  --model gpt-4o-mini \
  --users 8 \
  --requests-per-user 2 \
  --input-tokens 256 \
  --output-tokens 64 \
  --output-vary 0

Use --sglang to apply output token constraints via min_new_tokens/max_new_tokens instead of min_tokens/max_tokens.

Press Ctrl+C during a run to cancel active requests and print a partial summary.

Rust CLI

The existing Rust CLI is unchanged:

cargo build --release --manifest-path rust/Cargo.toml --bin batchbench
./rust/target/release/batchbench --help

Releases and PyPI

  • CI (.github/workflows/ci.yaml) checks Rust build/test, builds a wheel, and runs smoke tests.
  • Release Please (.github/workflows/release-please.yaml) opens/updates release PRs and, on merge, creates v* tags/releases.
  • Python release workflow (.github/workflows/python-release.yaml) builds and publishes prebuilt platform wheels to PyPI on v* tag pushes.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

batchbench-0.3.0-cp39-abi3-win_amd64.whl (3.6 MB view details)

Uploaded CPython 3.9+Windows x86-64

batchbench-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9+manylinux: glibc 2.28+ x86-64

batchbench-0.3.0-cp39-abi3-macosx_11_0_arm64.whl (3.9 MB view details)

Uploaded CPython 3.9+macOS 11.0+ ARM64

File details

Details for the file batchbench-0.3.0-cp39-abi3-win_amd64.whl.

File metadata

  • Download URL: batchbench-0.3.0-cp39-abi3-win_amd64.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: CPython 3.9+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for batchbench-0.3.0-cp39-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 fe3ba51d63f560583cc7542a01e7c2e5689f573428414074935fc69113ed794a
MD5 fb013ea9a8bcc5c048fb78903e43a93d
BLAKE2b-256 601f94750015f47568499ea7d156f4fcc4c5fd3bd234e52c99efeed2552a7ce6

See more details on using hashes here.

Provenance

The following attestation bundles were made for batchbench-0.3.0-cp39-abi3-win_amd64.whl:

Publisher: python-release.yaml on doublewordai/batchbench

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file batchbench-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for batchbench-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 56811e180b72d8f890c15945bb69d5d47a8d90c9e14f89ad27f03ea696850fec
MD5 9b70ae9183b51950f5375c0fc7b93e72
BLAKE2b-256 e179fba17d4af75eb76435f54025b9aa78bc7db719a5a8a076a8b9f1ff5c4ef9

See more details on using hashes here.

Provenance

The following attestation bundles were made for batchbench-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl:

Publisher: python-release.yaml on doublewordai/batchbench

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file batchbench-0.3.0-cp39-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for batchbench-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d509dc23babed6a3445f2a4cde7bfff925ddb59f5af989b1e1386107c383c050
MD5 fdfcafec1baa3df29565e1b01b7f48ef
BLAKE2b-256 ab0fb4f02ce912a3aef9eea9d948b06bec726008f622fd140eb54ffe84ac4e3c

See more details on using hashes here.

Provenance

The following attestation bundles were made for batchbench-0.3.0-cp39-abi3-macosx_11_0_arm64.whl:

Publisher: python-release.yaml on doublewordai/batchbench

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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