Skip to main content

evalci

Statistically sound comparisons between LLMs on benchmarks: confidence intervals on accuracy, paired significance tests, power analysis, clustered standard errors for multi-sample decoding, and multiple-comparison correction across many models/benchmarks — all validated against statsmodels/exact enumeration fixtures.

>>> import evalci
>>> result = evalci.compare(model_a_scores, model_b_scores, method="permutation")
>>> evalci.report(result)
'Δ=0.034, 95% CI [0.005, 0.063], paired permutation p=0.025*, n=1319'  # exact numbers depend on your data

Status

Core library (statistics, eval-shaped workflows, adapters, CLI) is implemented and tested. Not yet released to PyPI; no arXiv paper or DOI yet.

Install

Not yet on PyPI. Install from source:

git clone https://github.com/Shreyaskc/evalci.git
cd evalci
pip install -e ".[test]"   # add [test] to also get pytest/statsmodels for running the test suite

Requires Python ≥3.9. Runtime dependencies are numpy, scipy, and pandas only.

Usage

Confidence interval on a single model

import evalci

# binary (0/1) per-item correctness
evalci.ci(scores, method="wilson")           # Wilson score interval
evalci.ci(scores, method="clopper-pearson")  # exact interval

# continuous scores (e.g. a similarity metric)
evalci.ci(scores, method="bootstrap")        # percentile/BCa bootstrap on the mean

Comparing two models on the same items

result = evalci.compare(model_a_scores, model_b_scores, paired=True, method="permutation")
# result.delta, result.ci, result.p_value, result.n

evalci.compare(a, b, method="bootstrap")   # null-shifted bootstrap hypothesis test
evalci.compare(a, b, method="mcnemar")     # McNemar's test for paired binary outcomes
evalci.compare(a, b, paired=False, method="permutation")  # independent samples

Sample-size / power calculator

evalci.power(delta=0.03, power=0.8)          # required n to detect a 3-point gap at 80% power
evalci.power(delta=0.03, n=1500)             # achieved power at n=1500
evalci.power(delta=0.03, power=0.8, method="simulation", rho=0.3)  # correlated-items simulation

Many models × many benchmarks, with correction

import pandas as pd

# per-item schema: item_id, model, score, [subset], [sample_idx]
df = pd.DataFrame(...)
table = evalci.multi_compare(df, correction="holm")
print(evalci.report(table, format="markdown"))

Clustered standard errors (repeated decoding, grouped questions)

# clusters groups multiple samples of the same underlying item
evalci.cluster_ci(scores, clusters)

Loading results from eval harnesses

from evalci.adapters import load_lm_eval_harness, load_helm, load_csv

df_a = load_lm_eval_harness("results_a.json", model="model-a")
df_b = load_helm("per_instance_stats.json", model="model-b")

CLI

evalci compare results_a.json results_b.json --method permutation
evalci compare results_a.json results_b.json --format helm --method mcnemar

Auto-detects lm-evaluation-harness / HELM / CSV format from the file extension/content; pass --format to override, and --model-a/--model-b to label the two runs explicitly.

What's validated, and how

Statistical correctness is the point of this library, so the test suite cross-checks every routine against an independent reference rather than just re-testing its own math:

  • Wilson and Clopper-Pearson intervals against statsmodels.stats.proportion.proportion_confint
  • McNemar's test (exact and asymptotic) against statsmodels.stats.contingency_tables.mcnemar
  • Holm and Benjamini-Hochberg correction against statsmodels.stats.multitest.multipletests
  • The paired permutation test against brute-force exact enumeration of all sign flips (small n)
  • Bootstrap CIs via a coverage simulation (nominal 95% CIs should contain the true parameter ~95% of the time)

statsmodels is a test-only dependency (pip install -e ".[test]"), not a runtime dependency.

pytest tests/

API surface

evalci.ci, evalci.compare, evalci.power, evalci.multi_compare, evalci.cluster_ci, evalci.report, evalci.adapters.{load_lm_eval_harness, load_helm, load_csv}.

License

MIT — see LICENSE.

Metadata

Release files for evalci 0.1.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 evalci 0.1.0
File Size Uploaded
evalci-0.1.0.tar.gz 22.7 kB Details

Built distribution (wheel)

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

Total release size: 41.0 kB

Release files / evalci-0.1.0.tar.gz

Download URL evalci-0.1.0.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
dea79bb7a4cf184c2764fac9c12af9b2bf4001ffb1ee7ff7b1ec3c1f66a3ba06
BLAKE2b-256 checksum
How to use checksums
eaab4560c90a0ce67ac9d25ec4a9db9957d389e1b9fbab343bd3e7cb1990229f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / evalci-0.1.0-py3-none-any.whl

Download URL evalci-0.1.0-py3-none-any.whl
Size 18.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2338fc9d3fa52691735d2b9ba47a2ff179e0ebcec52e8620b804b945a894f39
BLAKE2b-256 checksum
How to use checksums
cde934cf10e5c22faaed5b088bc72997af9f3a388b5c07758bbd521c556fb8b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.1.0 This release

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