pairbench
Is one side really faster than another on this workload, on this machine, or is the difference noise? pairbench runs both in paired, alternating rounds, measures the noise in the same rounds, and gives a verdict per case with its noise bar and an exact p-value.
The documentation is at eugo.io/docs/pairbench.
The headline command
pairbench run --side new=image:myorg/app:2.0 --side old=image:myorg/app:1.9 -- python bench.py
Example output (made-up numbers):
new against old (baseline)
case new old change noise p verdict
matmul 1.92 s 2.41 s 1.26x faster ±1.8% 0.0010* FASTER
fft 0.88 s 0.89 s 1.01x faster ±2.1% 1.0* TIE
Exact two-sided sign test over 16 paired rounds.
* corrected for testing 2 cases at once.
Rule: strict.
Machine state: quiet.
Baseline: old.
Positive control old~twice: ok.
FASTER needs two things at once: the gap is wider than the noise the run measured between
each side and an identical copy of itself, and the direction is significant after the
correction for testing several cases. TIE needs the same evidence the other way round.
Anything else is UNRESOLVED or NO VERDICT, with the reason in plain words.
Four problems it solves
Real or noise
One command gives a verdict for every case of a benchmark, with the noise and the p-value beside it. Here two Python environments run the same script, which prints its own timings:
pairbench run --side new=venv:.venv-new --side old=venv:.venv-old --driver lines -- python bench.py
Example output (made-up numbers):
case new old change noise p verdict
parse 0.310 s 0.402 s 1.30x faster ±1.2% 0.0016* FASTER
encode 1.020 s 1.010 s 1.01x slower ±1.4% 0.21* TIE
resize 0.555 s 0.571 s 1.03x faster ±3.9% 0.0084* UNRESOLVED (the difference is significant but lies inside the noise)
Comparing whole environments
A side can be a container image, a Python environment or any command. Before a run,
pairbench plan prints what will run and checks that the sides are not the same thing:
pairbench plan --side pip=image:myorg/numpy-pip:1 --side conda=image:myorg/numpy-conda:1 -- python bench.py
Example output (made-up identities, shortened):
# lineup: pip, pip~same, conda, conda~same
# positive control: conda~twice, last in every round at position 5
# rounds: requested auto, planned 16
# launches: 82 (16 rounds of 5, and 2 warm-up launches)
# balance pip / conda: pip first in 8, conda first in 8, positions differ by 0 in sum
# verdict: reachable; 13 of 16 rounds must agree for one primary case when none tie (a tie is not counted)
# side pip: identified (image_id=sha256:aaaa..., digests=sha256:bbbb...)
# side conda: identified (image_id=sha256:cccc..., digests=sha256:dddd...)
Each side is identified before the run and again after it; two sides with the same identity are refused, and so is a side whose identity changed during the run.
A busy shared machine
On a machine other people use, pairbench can wait for quiet, pin the workload to a CPU set, take a lock, and watch every launch for load that is not the run's own:
pairbench run --side new=cmd:./bench-new --side old=cmd:./bench-old --cpus 4-7 --wait-quiet --lock /tmp/bench.lock
Example footer (made-up numbers):
Machine state: busy.
Without disturbed rounds 3, 11, matmul (new against old): 0.80x FASTER, agrees.
A round is set aside by a witness that never looks at the timings, and the analysis is repeated without it. Setting rounds aside can only downgrade a verdict, never create one.
Numbers into documents
Every number in a report can come from a results file instead of being typed by hand. A template holds tokens such as {{fig:matmul.new_vs_old.ratio}}, and:
pairbench fill report.in.md --results results.json -o report.md
writes the document with each token replaced by its figure, for example 0.80x (a made-up
value). A missing figure stops the command with exit code 7 and lists every missing key.
--check proves in an automated pipeline that a document still matches its results.
Install and quick start
pip install pairbench
pairbench doctor
pairbench selftest
doctor says what this machine supports and which external tools it found. selftest
runs the known answers and controls of the statistics. Optional extras: pairbench[plot]
draws charts, pairbench[mcp] adds the tool server for AI agents, pairbench[gpu] reads
GPU power, pairbench[llm] and pairbench[micro] install load and benchmark tools.
Then print a plan, and run it:
pairbench plan --side new=venv:.venv-new --side old=venv:.venv-old -- python bench.py
pairbench run --side new=venv:.venv-new --side old=venv:.venv-old -- python bench.py
The quick start walks through a first run and what each part of the output means.
How it decides
- Every side runs once per round, in an order that rotates and reverses from round to round, so no side keeps running before another (paired rounds).
- Every side has a twin, an identical copy in the same rounds, and the gap between them is the measured noise floor (noise floor).
- The values of a side and the baseline are paired round by round, and their ratio per round is summarised by its median.
- An exact sign test counts the rounds in which the subject was lower and those in which it was higher (sign test).
- The p-values are corrected for testing several cases at once (multiple comparisons).
- A verdict needs a gap wider than the sum of both noise floors and a significant direction; a tie needs the opposite, and everything else says why it has no verdict (verdicts).
What a run tells you besides the verdict
- The positive control. One more entry in every round runs the baseline's workload twice
in one start. It must read as twice the value. If it does not, something other than the
work is inside the measurement, and every comparison of the run gets
NO VERDICT(positive control). - The cost of a launch. For command and Python environment sides, every run times an empty command through the same launch path and reports it, with a note on any timed value that the cost could noticeably move (launch cost).
- The diagnostics. After the measured rounds, each side is launched again under instruments, untimed: resource figures, counters and sampled stacks, with findings that describe a difference and never name a cause (diagnostics).
- The charts and the report page. With the
plotextra a run draws its charts, and every run writes one self-containedreport.htmlwith the verdicts, the controls and the flame graphs.
Why pairbench is not written in native code
The figures for this section come from one run of
tools/launch_cost.py
on one
c4a-standard-4
machine, kept as
docs/figures/launch-cost/results.json.
The script waits for a quiet machine on the host before the run starts; inside the container
the run records only what its own checks can see from there. The launch-cost results are kept
without their sidecar because the results hide the two side commands; the commands are the
constants of tools/launch_cost.py, so a reader runs that script to repeat the run rather than
recomputing the hashes.
- Between the clock reads that start and stop a launch, pairbench does nothing it can avoid: it starts no sampler, writes no record and reads no output until the second read (how a launch is timed).
- Every run measures the cost of a launch and reports it. On that machine an empty launch cost 0.000375 s in the median, with 5.55e-05 s between the first and third quartiles.
- That cost is the same on every side. An image side is timed by the container engine, so the tool is outside its time altogether.
- In a run, the start of a process and the workload dominate; the tool's own part is small
beside them. The run's workload, a few lines of Python, took 0.0136 s in
the median with the interpreter's default start-up and 0.0115 s without
its
sitemodule, against 0.000375 s for an empty launch. - A core in pure Python on the standard library installs anywhere with no compiler, and is easy to read and to audit.
- A native launcher can be added as a plug-in if a real case needs one.
The tools it launches and reads
pairbench does not replace benchmark tools. It launches them, one launch per side per round, and reads what they produce. Each has a guide:
| Driver | Reads |
|---|---|
wall |
the run time of each launch |
lines |
::pairbench:: lines a workload prints |
gbench |
Google Benchmark JSON output |
nvbench |
NVBench JSON output |
pytest-benchmark |
pytest-benchmark JSON output |
hyperfine |
hyperfine JSON output |
perf |
perf stat counters |
llama-bench |
llama-bench JSON output |
guidellm |
GuideLLM reports for a serving side |
aiperf |
AIPerf reports for a serving side |
vllm-bench |
vllm bench serve results for a serving side |
Container images run under docker or podman. perf, and GPU profilers you have installed
yourself, can be called for counters, sampled stacks and profiles; pairbench does not include,
download or redistribute any of them. See
THIRD_PARTY_NOTICES.md.
Showcases
Each showcase is a folder with a config, a one-command run.sh, images pinned by digest and
its workload. No approved result is published for any of them yet.
| Showcase | Compares |
|---|---|
| numpy-pip-vs-conda | NumPy from pip against NumPy from conda |
| noisy-neighbour | one image against itself, quiet and beside a load generator |
| pipeline-slowdown-check | two revisions of a small library, as a check in a pipeline |
| python-versions | two Python versions |
| inference-server-versions | two versions of an inference server |
| gpu-kernel | a GPU kernel in two CUDA development images |
| vendor-container-vs-pip | a vendor framework container against a pip install |
For AI agents
- For AI agents: the loop, the exit codes and how to report a result.
- llms.txt: a short map of the documentation.
- skills/pairbench:
a skill, installed with
pairbench skill install --dir PATH. pairbench mcp: a tool server over standard input and output, with themcpextra (tool server reference).pairbench schema results: the JSON Schema of the results; programs readcomparisons[].outcomeandcomparisons[].reason.
How it relates to other tools
Most of these pieces exist in other tools. pairbench combines paired alternating rounds, a measured same-against-same noise floor, an exact sign test and a correction for testing several cases, with container images as first-class sides and built-in readers for several benchmark tools. If you know a tool that does the same, tell us.
The comparison page describes other tools by what their own documentation says, with a link and the version read.
Limits
- One baseline: every side is compared with it, not every side with every other.
- One machine: sides alternate on one host; there is no launcher for cluster schedulers yet.
- Energy is GPU energy only; CPU and wall-socket power are not measured.
- An endpoint that is already running cannot be a side.
- Linux and macOS; no Windows.
- No history of results over time, and no re-running of a published results file on another machine.
- A verdict holds for the machine, the load and the rounds it was measured on.
- A serving round is long, so the default round count is small:
--rounds autogives 8 rounds for a serving experiment, and 8 rounds miss many small real differences. With a board of 4 primary metrics and the new side truly slower by twice the noise, 8 rounds give SLOWER for only about a third of the metrics (33 to 39 percent on the error-rate page); 16 rounds, with--rounds 16, give it for about 85 percent (83 to 88 percent). A difference of four times the noise is caught at 8 rounds 92 to 98 percent of the time. A miss at 8 rounds reads UNRESOLVED or TIE, not a wrong verdict. Verdicts in the wrong direction across the 162 settings of that page with a real difference: none in the simulated experiments. With no real difference, the largest share of experiments with any verdict is 1.3 percent, under the rule's alpha of 5 percent.
Cite, licence, contributing, security
- Cite it with CITATION.cff.
- Licensed under the Apache License 2.0: LICENSE and NOTICE.
- CONTRIBUTING.md says what the repository may hold and how to add a driver or a showcase.
- SECURITY.md says how to report a vulnerability privately.
Metadata
Release files for pairbench 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pairbench-0.1.0.tar.gz | 615.2 kB | With provenance | Details for pairbench-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pairbench-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for pairbench-0.1.0-py3-none-any.whl |
Total release size: 1.3 MB
Release files / pairbench-0.1.0.tar.gz
| Download URL | pairbench-0.1.0.tar.gz |
|---|---|
| Size | 615.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab3fbd126286d7f396ae94cc31ac78de822932092e0c307c69af49a09e348a86
|
|
BLAKE2b-256 checksum How to use checksums |
80bcf5fa7755f377c9fc5c5ffb4279b9c5afb0e1774ad2b7e98de1c304f6e704
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 22, 2026.
Transparency logRelease files / pairbench-0.1.0-py3-none-any.whl
| Download URL | pairbench-0.1.0-py3-none-any.whl |
|---|---|
| Size | 694.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
24cc8714a5279b192e4c3ac0fd0dfcb7d3c8f73a2ebcd520b7717897981bb247
|
|
BLAKE2b-256 checksum How to use checksums |
52bb611f1e0766dd2b438d5ba4bebb727a2cfa55b5251d96a1514fa2862c3b41
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 22, 2026.
Transparency logSecurity for pairbench 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pairbench-0.1.0.tar.gz
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 Nov 22, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.