Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

reliability-lab

Status: alpha (0.1.0a1). The API may still change between releases.

reliability-lab is a study-design library for measuring the reliability of LLM and human judgments. It is built on Krippendorff's alpha. Alpha implementations already exist in Python. This package adds the workflow around the coefficient:

  • a validated long-form ratings schema in which every rating has an explicit status (observed, abstained, inapplicable, parse_error, provider_error);
  • declared measurement semantics: level, value domain, coder definition and design label;
  • white-box output: observed and expected disagreement, coincidence matrices and per-unit contributions;
  • explicit missing-data policies, because LLM failures are rarely unrelated to the item;
  • bootstrap intervals by a scheme you name: whole units or groups resampled (scheme="units"), or Krippendorff's KALPHA algorithm (scheme="kalpha");
  • paired comparisons of two configurations on the same units, with the interval on the difference;
  • group-safe train/test splits that work with any scikit-learn splitter, with a saved manifest that reproduces the split;
  • versioned JSON and Parquet reports with provenance.

LLM-specific workflows (a trace sidecar, repeatability and order-swap checks) are next on the roadmap (design document).

Reliability is not validity. Coders can agree consistently and still be wrong in the same way, for example because of a flawed rubric or a bias they share. When results come from different designs (repeatability, inter-model agreement, human panels), they are reported as different quantities and are never pooled.

Install

pip install --pre "reliability-lab[sklearn,parquet]"

The extras are optional. sklearn provides the splitters, although any object with a scikit-learn style split method works; parquet enables to_parquet. For development, run uv sync and then uv run pytest.

Example

import pandas as pd
from reliability_lab import CoderSpec, RatingFrame, ReliabilityStudy

df = pd.DataFrame(
    {
        "item": ["u1", "u1", "u2", "u2", "u3", "u3"],
        "annotator": ["ann", "bob", "ann", "bob", "ann", "bob"],
        "label": ["pos", "pos", "neg", "pos", "neg", "neg"],
    }
)

ratings = RatingFrame.from_long(df, unit="item", rater="annotator", value="label")
study = ReliabilityStudy(
    ratings,
    measurement="nominal",
    values=["neg", "pos"],
    coders=CoderSpec(by="rater_id"),
    design="human_panel",
)
result = study.alpha()
print(result.summary())

Intervals and comparisons

Every interval names its scheme, because the two schemes answer different questions. scheme is a required argument.

boot = result.bootstrap(scheme="units", n_resamples=2000, random_state=7)
print(boot.summary())  # 95% percentile intervals for every missing-data policy
  • scheme="units" resamples whole units, and whole groups when a group column is declared. It can also resample within declared strata (strata=True), and it recomputes the expected disagreement in every replicate. method="bca" is available as an experimental option.
  • scheme="kalpha" reproduces Krippendorff's KALPHA algorithm. It resamples pairs of values and holds the expected disagreement fixed.

To compare two configurations of a judge, for example two prompts, select each one's rows. Both must cover the same units. Every replicate resamples the same units for both, and the interval is on the difference:

diff = study.compare(
    a={"condition_id": "prompt_v1"},
    b={"condition_id": "prompt_v2"},
    n_resamples=2000,
    random_state=7,
)
print(diff.summary())  # alpha_b - alpha_a with a paired interval

Splits and reports

Teams tune the judge (prompt, few-shot examples, rubric) and should report reliability on units the tuning never saw. So split before tuning, freeze the judge, then estimate on the test partition.

When groups are declared, the splitter sees one sample per group (a conversation, say), so groups and repeated LLM calls never cross partitions:

from sklearn.model_selection import StratifiedGroupKFold

dev, test = study.holdout(
    StratifiedGroupKFold(n_splits=4, shuffle=True, random_state=7),
    group_stratum="majority",  # needed only when a group's units span several strata
)
test.save_manifest("split.json")  # the ids of every partition, not just the seed

# ... tune and freeze the judge on dev ...

result = test.alpha()
result.to_json("alpha_test.json")  # strict JSON with provenance
result.to_parquet("alpha_test/")  # tidy tables

dev2, test2 = later_study.apply_manifest("split.json")  # same units, new judge runs
test.manifest.assert_no_leakage(few_shot_units)  # raises LeakageError

See examples/splits.py for a full run. Releases are described in docs/releasing.md.

Licence

BSD-3-Clause. Alpha is implemented independently from Krippendorff's papers. The GPL-licensed krippendorff package is used only in the test suite, as a parity check.

Metadata

Release files for reliability-lab 0.1.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reliability-lab 0.1.0a1
File Size Uploaded Provenance
reliability_lab-0.1.0a1.tar.gz 179.5 kB With provenance Details

Built distribution (wheel)

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

Total release size: 226.3 kB

Release files / reliability_lab-0.1.0a1.tar.gz

Download URL reliability_lab-0.1.0a1.tar.gz
Size 179.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a98d1bfe3fea2299fe386e0b6730fa9abaf0b801264121ff2a27a11c8b526ced
BLAKE2b-256 checksum
How to use checksums
3140f2f9319651b5c86b60269ca2aed0a3a3cb53e991ad74363faf24e74d6b83
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 Oct 27, 2026.

Transparency log

Release files / reliability_lab-0.1.0a1-py3-none-any.whl

Download URL reliability_lab-0.1.0a1-py3-none-any.whl
Size 46.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08f5cc5d594e135066face05910576e5444f9c37aa10ab0754bedffd7450c61a
BLAKE2b-256 checksum
How to use checksums
c25a8391b73dfde5440e6ac500c7b67804371da7941d5e22aae4f0e2c33dd36e
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 Oct 27, 2026.

Transparency log

Security for reliability-lab 0.1.0a1

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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for reliability_lab-0.1.0a1.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 Oct 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.

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