Skip to main content

repeatability-evals

Consistency evals for non-deterministic systems: LLM generation, agentic retrieval, agent workflows.

Composable tools for measuring how consistent an LLM system is with itself: the same input run several times, or an input and its paraphrases, and how much the outputs agree.

Most eval libraries score one run for quality. A system can average 90% on quality and still give a customer a different answer every time they ask. This package measures that spread.

It is deliberately unaware of what you are comparing. It has no notion of "answers", "retrieval" or "agents": it compares items. You choose the items and the similarity:

You have N of ... Use a similarity such as
final answers (free text) LLMJudge, EmbeddingCosine, RougeL
retrieved chunk IDs JaccardSimilarity
retrieved chunk text NgramJaccard (robust to re-chunking)
ranked result lists RankBiasedOverlap
agent tool-call traces EditSimilarity / ExactMatch on a trace string
anything else subclass Similarity, or pass a plain function

Consistency is not correctness: a system that is consistently wrong scores 1.0. Pair this with an accuracy metric.

Install

pip install repeatability-evals   # pure standard library, no required dependencies

Quickstart

from repeatability_evals import (
    PairwiseConsistency, JaccardSimilarity, NgramJaccard, LLMJudge, evaluate_groups,
)

# 1. Retrieval: did the 5 runs fetch the same chunks?
ids = PairwiseConsistency(JaccardSimilarity())
print(ids.evaluate([["a", "b", "c"], ["a", "b", "d"], ["a", "b", "c"]]).score)

# 2. Same evidence, different chunk boundaries?
text = PairwiseConsistency(NgramJaccard(n=3))
print(text.evaluate([["backup jobs run nightly"], ["backup jobs", "run nightly"]]).score)

# 3. Answers: an LLM judge scores semantic equivalence. Bring any `str -> str` function.
def complete(prompt: str) -> str: ...            # your model call
answers = PairwiseConsistency(LLMJudge(complete), agreement_threshold=0.75)
r = answers.evaluate(["Retention is 30 days.", "30 days.", "Retention is 90 days."],
                     context={"query": "How long are backups retained?"})
print(r.score, r.details["agreement_rate"], [p.reason for p in r.pairs])

# 4. A whole dataset: one group per question, with a bootstrap confidence interval.
report = evaluate_groups({"q1": runs_q1, "q2": runs_q2}, ids)
print(report.score, report.ci, report.worst(3))

Design

Three small pieces, each replaceable:

  • Similarity: compare two items, return a score in [0, 1] (optionally with a raw value and a rationale). Built in: set overlap (Jaccard, Dice, OverlapCoefficient), text (ExactMatch, NgramJaccard, RougeL, EditSimilarity), ranking (RankBiasedOverlap), embeddings (EmbeddingCosine, bring your own embed function), and RubricJudge and LLMJudge.
  • PairSampler: which pairs of the N items to compare (see below).
  • ConsistencyMetric: combines them. PairwiseConsistency averages similarity over sampled pairs; ClusterConsistency groups items into "same answer" clusters and reports the largest cluster's share plus the entropy of the partition; TotalAgreement is the all-N-identical rate.

Everything has an async twin (aevaluate, aevaluate_groups) with bounded concurrency, which matters when the similarity is an LLM call.

Sampling instead of all pairs

All pairs cost N(N-1)/2 comparisons: 10 for 5 runs, 45 for 10. The default CycleSampler compares a random cycle through the runs, so N pairs, and every run is compared at least twice. It is seeded and reproducible. AllPairs() gives the exact value; RandomPairs(k) and AnchorPairs() (every run against one reference) are also available. benchmarks/sampling_error.py measures the error this introduces on synthetic data so you can see the trade-off for your N.

The LLM judges

RubricJudge is the recommended judge for free-text outputs. One call scores five dimensions of agreement (1-5 each): core_facts, specifics (names, numbers, dates), supporting_detail, stance (answer vs hedge vs refuse) and format. The headline score is their weighted mean (core facts count most), and PairwiseConsistency reports the mean per dimension in details["dimensions"], so you can see what varies between runs: a system whose facts are stable but whose formatting drifts looks very different from one that changes its answer. Pass your own Dimensions to add, remove or reweight (e.g. for agent traces).

from repeatability_evals import RubricJudge, PairwiseConsistency
m = PairwiseConsistency(RubricJudge(complete))
r = m.evaluate(runs, context={"query": question})
print(r.score, r.details["dimensions"])   # {'core_facts': 0.95, 'format': 0.4, ...}

LLMJudge is the single-score version (one 1-5 semantic-equivalence rating). Both take any completion function, so it works with any provider or a local model. The default rubrics (1-5, normalised to [0, 1]) are in repeatability_evals.prompts. symmetric=True judges both orderings to cancel position bias at twice the cost. Validate any judge against human ratings on your own data before relying on it; agreement depends on the domain and the judge model.

Writing your own similarity

from repeatability_evals import Similarity, PairwiseConsistency

class SameFirstSentence(Similarity):
    name = "same_first_sentence"
    def compute(self, a, b, *, context=None):
        return float(a.split(".")[0] == b.split(".")[0])

PairwiseConsistency(SameFirstSentence())

or just PairwiseConsistency(lambda a, b: ...).

Status

Early (0.1). The API may change before 1.0.

License

MIT

Metadata

Release files for repeatability-evals 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 repeatability-evals 0.1.0
File Size Uploaded Provenance Actions
repeatability_evals-0.1.0.tar.gz 24.5 kB With provenance Details for repeatability_evals-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 48.8 kB

Release files / repeatability_evals-0.1.0.tar.gz

Download URL repeatability_evals-0.1.0.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1b9f14a1a37db954bf580ecce41dd55d49ac3a6933d977fab1a028aa5b966495
BLAKE2b-256 checksum
How to use checksums
cf04cf79d0db965cca19131b4a53a61907fd1cd71f17515ef8c9c7bff170a67d
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 2, 2026.

Transparency log

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

Download URL repeatability_evals-0.1.0-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3151a4dcd3b134456b01008d4228db9f8dbe95f7186e5cb56dc1a10db077b1d3
BLAKE2b-256 checksum
How to use checksums
e60e040437237888c1738db3a878633588a7702e90bc3892712fdfbfef3037d5
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 2, 2026.

Transparency log

Security for repeatability-evals 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.

Select from 2 files

Attestation for repeatability_evals-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 2, 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.

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