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 \
  --gen-approx-input-tokens 256 \
  --output-tokens 64 \
  --output-vary 0

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 wheel/sdist and publishes 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 Distribution

batchbench-0.2.0.tar.gz (46.7 kB view details)

Uploaded Source

Built Distribution

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

batchbench-0.2.0-cp39-abi3-manylinux_2_38_x86_64.whl (6.7 MB view details)

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

File details

Details for the file batchbench-0.2.0.tar.gz.

File metadata

  • Download URL: batchbench-0.2.0.tar.gz
  • Upload date:
  • Size: 46.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for batchbench-0.2.0.tar.gz
Algorithm Hash digest
SHA256 8140464cd826c9384c17cebff098c569fd6f826e465b67a82a53666f36887ff3
MD5 e07beed40009edd201157139c02da3a3
BLAKE2b-256 6e75e15a43e352ae6ba6f221910549f2f986173814677221328dc1873390a12a

See more details on using hashes here.

Provenance

The following attestation bundles were made for batchbench-0.2.0.tar.gz:

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.2.0-cp39-abi3-manylinux_2_38_x86_64.whl.

File metadata

File hashes

Hashes for batchbench-0.2.0-cp39-abi3-manylinux_2_38_x86_64.whl
Algorithm Hash digest
SHA256 ea1b6a8fc64d69cfb2f0e37dea9b6ae827e5b82df69c347448c639534a96fff4
MD5 7165908c75d5b489e76180a3216d9d4e
BLAKE2b-256 36d03f1414781a4a904b0456aef7e23628eed9d0dadb3d6d9697770ee9d013a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for batchbench-0.2.0-cp39-abi3-manylinux_2_38_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.

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