Skip to main content

judgemeter

CI PyPI Python Dependencies License

Measure how far an LLM judge can be trusted before you rely on its scores.

LLM-as-a-judge is everywhere in evaluation pipelines, but the judge itself is rarely checked. judgemeter answers three questions about any judge, whatever framework or model it uses:

Check Question it answers
Human agreement Does the judge label things the way people do? (Cohen's kappa, with a confidence interval)
Position bias Does the judge's pick change when only the order of the answers changes?
Self-consistency Does the judge give the same answer when asked the same thing again?

It has no dependencies and works with any judge you can wrap in a Python function.

Install

pip install judgemeter

Quick start

Agreement with human labels

from judgemeter import agreement

judge = ["pass", "fail", "pass", "pass", "fail", "pass"]
human = ["pass", "fail", "fail", "pass", "fail", "pass"]

result = agreement(judge, human, bootstrap=1000)
print(result.kappa, result.kappa_ci, result.interpretation)
# 0.667 (0.0, 1.0) substantial

For ordinal scores (for example 1 to 5), use weighted kappa so near misses count less than big misses:

agreement(judge_scores, human_scores, weights="quadratic")
agreement(judge, human, labels=["bad", "ok", "good"], weights="linear")

result.disagreements lists the item indexes where the judge and the human differ, which is usually the most useful thing to read next.

Position bias

Wrap your judge as a function that takes the candidates in the order shown and returns the index of the one it picks:

from judgemeter import position_bias


def my_judge(candidates):
    prompt = build_prompt(question, candidates)  # your prompt
    reply = call_llm(prompt)  # your model
    return parse_choice(reply)  # 0, 1, ...


result = position_bias(my_judge, dataset_of_answer_pairs)
print(result.consistency)  # 1.0 = same winner in every ordering
print(result.first_position_win_rate)  # vs result.expected_first_position_rate
print(result.p_value)  # exact binomial test against chance

Each set of candidates is shown in every cyclic order (A-B and B-A for pairs), so every candidate appears once in each position. A judge that ignores order scores a consistency of 1.0. A judge that always picks the first answer scores 1/n and wins 100% of the time from the first position.

Self-consistency

from judgemeter import self_consistency_many

report = self_consistency_many(lambda item: my_grader(item), items, runs=5)
print(report.agreement, report.stable_share, report.unstable_items)

One report

from judgemeter import ReliabilityReport

report = ReliabilityReport(
    judge_name="my judge",
    agreement=agreement_result,
    position=position_result,
    consistency=consistency_report,
)
print(report.to_markdown())  # or report.to_json()
## Judge reliability: simulated judge

### Agreement with human labels

| Metric | Value |
| --- | --- |
| Items | 200 |
| Percent agreement | 92.0% |
| Cohen's kappa | 0.836 (95% CI 0.754 to 0.908) |
| Interpretation | almost perfect |

### Position bias

| Metric | Value |
| --- | --- |
| Items | 100 (200 comparisons) |
| Mean consistency across orderings | 82.5% |
| Items with the same winner in every ordering | 65.0% |
| First-position win rate | 67.5% (chance: 50.0%) |
| p-value vs chance | < 0.001 |

### Self-consistency

| Metric | Value |
| --- | --- |
| Items | 50 |
| Mean agreement across repeated runs | 92.8% |
| Items with identical answers every run | 76.0% |

That output comes from examples/demo.py, which simulates a judge that agrees with humans most of the time but picks the first answer on close calls. Run it with python examples/demo.py; no API key needed.

Use results from promptfoo or DeepEval

If your judge already runs inside promptfoo or DeepEval, you don't need to call it again. Load its verdicts, pair them with human labels by item id, and measure agreement.

import judgemeter as jm

# promptfoo: the file written by `promptfoo eval -o results.json`.
# Use one assertion (its metric name or type, e.g. your llm-rubric judge);
# items are keyed by the test description, or by a test variable via id_var.
records = jm.load_promptfoo("results.json", assertion="llm-rubric", id_var="id")

# DeepEval: the EvaluationResult from deepeval.evaluate(), or a saved test run.
# records = jm.from_deepeval(result, "Correctness [GEval]")

human = {"q1": "pass", "q2": "fail", "q3": "pass"}
pairs = jm.align(records, human)
print(jm.agreement(pairs.judge, pairs.human, bootstrap=1000))
print("No human label:", pairs.missing_human, "No judge verdict:", pairs.no_verdict)

The judge label is the tool's own pass/fail by default. To label by score instead, pass labeler=jm.threshold_labeler(0.7). For ordinal labels and weighted kappa, use labeler=jm.bin_labeler([0.4, 0.7], ["bad", "ok", "good"]). Items missing on either side, or without a verdict (for example a metric that errored), are listed rather than silently dropped.

The same works from the command line, with human labels in a CSV (id,label columns by default):

judgemeter promptfoo results.json --assertion llm-rubric --id-var id --human labels.csv
judgemeter deepeval test_run.json --metric "Correctness [GEval]" --human labels.csv --threshold 0.7

Command line

Check a labelled CSV, for example in CI:

judgemeter agreement examples/labels.csv --judge judge_label --human human_label
Items:             200
Percent agreement: 92.0%
Cohen's kappa:     0.836 (almost perfect), 95% CI 0.754 to 0.908
Option Description
--weights linear|quadratic Weighted kappa for ordinal labels
--labels bad,ok,good Label order for weighted kappa
--bootstrap N Resamples for the confidence interval (default 1000, 0 to skip)
--format text|markdown|json Output format
--min-kappa 0.6 Exit with status 1 if kappa is below the value

The promptfoo and deepeval commands take the same options, plus --human (labels CSV), --id-col, --label-col and --threshold. The promptfoo command also takes --assertion, --id-var, --prompt-idx and --provider, and the deepeval command takes --metric and --id-field.

Rows with an empty judge or human label are skipped and counted.

How the numbers are computed

  • Cohen's kappa is 1 - observed_disagreement / expected_disagreement, with disagreement weights of 0/1 (unweighted), |i-j|/(k-1) (linear) or its square (quadratic). Results match sklearn.metrics.cohen_kappa_score. Kappa is undefined (nan) when both raters used a single, identical label for every item.
  • Confidence interval is a percentile bootstrap over items. It is seeded, so results are reproducible.
  • Interpretation uses the Landis & Koch (1977) bands: slight, fair, moderate, substantial, almost perfect.
  • Position p-value is an exact two-sided binomial test of first-position wins against 1/n. It is only reported when every item has the same number of candidates.
  • Self-consistency entropy is normalised to 0 (always the same answer) to 1 (answers split evenly).

Development

git clone https://github.com/aman-singh01/judgemeter
cd judgemeter
pip install -e ".[dev]"
pytest --cov=judgemeter
ruff check . && ruff format --check .

Roadmap

  • Async judges, so orderings and repeats run concurrently
  • Krippendorff's alpha for more than two raters
  • Adapters for more eval frameworks (Ragas, Inspect, Opik)

License

MIT

Metadata

Release files for judgemeter 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 judgemeter 0.2.0
File Size Uploaded Provenance Actions
judgemeter-0.2.0.tar.gz 26.1 kB With provenance Details for judgemeter-0.2.0.tar.gz

Built distribution (wheel)

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

Total release size: 46.5 kB

Release files / judgemeter-0.2.0.tar.gz

Download URL judgemeter-0.2.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
65e0bfaf47f6f8abb4beb545c0ee5449b240d4a5d6ba0a27cf981742e1e42bb2
BLAKE2b-256 checksum
How to use checksums
a377de59b5edf0eaa07a82e2eb1ac58e1ed5f28d74e10e106f4341e837372b8a
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 27, 2026.

Transparency log

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

Download URL judgemeter-0.2.0-py3-none-any.whl
Size 20.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd7504f8f33f4e34c1c68b1794bcf264b9f124779dd254cec0032e44256ed6a2
BLAKE2b-256 checksum
How to use checksums
c7ab53fc606131104f3fbc4ccddc99ed7fab2afd30a5f6fa80840d1ae91ca1c4
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 27, 2026.

Transparency log

Security for judgemeter 0.2.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.

Select from 2 files

Attestation for judgemeter-0.2.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 27, 2026.

Transparency log

A 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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

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