feat(eval): conformal judge intervals — distribution-free uncertainty bounds (v0.29.0) - #20
Merged
Merged
Conversation
… bounds (v0.29.0) New kairu/conformal.py adds split conformal prediction (Sheng et al., EMNLP 2025, arXiv:2509.18658) to the judge-eval stack. The reliability module ships only distribution-parametric estimators (Cronbach alpha, ICC, Fleiss kappa); conformal prediction adds a distribution-free coverage guarantee that holds regardless of the judge's score distribution. - conformal_quantile(residuals, alpha): finite-sample-corrected (1-alpha) quantile via conformal rank ceil((n+1)(1-alpha)); returns +inf (no finite bound) when the calibration set is too small rather than fabricating a number. - calibrate_interval -> ConformalInterval: symmetric interval with the paper's ordinal boundary clamp + lower-bias midpoint point estimate. - conformal_from_ensemble: bridges EnsembleResult.median_aggregate. reliability.py and EnsembleResult are untouched -- purely additive. New tests/test_conformal.py (17 tests, module 100%) including an empirical coverage test (~90% of held-out references fall within 90% intervals on synthetic exchangeable data). Suite: 763 passed, 4 HF-gated skipped. Version 0.28.0 -> 0.29.0. First sprint of a new Discovery cycle. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TmSqgYqcYfzPnkpDVR5vdw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Konjo sprint — v0.29.0
First sprint of a new Discovery cycle. The v0.24–v0.28 researched sweep shipped fully (#15–#19, all merged); a fresh researcher pass surfaced this as the High-impact / Low-complexity next step, rebalancing toward the judge-eval track after two inference sprints.
Why
kairu/reliability.pyships Cronbach α, ICC(2,1), and Fleiss κ — all retrospective, distribution-parametric estimators describing a judges × criteria matrix after the fact. None answers the deployment question: given this judge's score, what's a defensible interval around the true quality, with a coverage guarantee that holds regardless of the judge's score distribution?What
New module
kairu/conformal.py— split conformal prediction (Vovk; applied to LLM judges by Sheng et al., EMNLP 2025, arXiv:2509.18658), pure stdlib +kairu.ensemble:conformal_quantile(residuals, alpha)— finite-sample-corrected(1−α)quantile via the conformal rankceil((n+1)(1−α)). Returns+inf(no finite bound) when the calibration set is too small for the requested α — the honest answer, not a fabricated number.calibrate_interval(prediction, calibration_pairs, *, alpha, score_range)→ConformalInterval—[score−q, score+q]with the paper's two judge-specific refinements: ordinal boundary clamp (never claims impossible scores) and the lower-bias midpoint point estimate (pulled inside the range near a boundary). Covers the reference with probability ≥1−αfor any exchangeable new pair.conformal_from_ensemble(result, calibration_pairs, …)— bridgesEnsembleResult.median_aggregate.reliability.pyandEnsembleResultare untouched — this is purely additive, so all prior eval tests stay green.Quality gates
tests/test_conformal.pyat 100% module coverage — including an empirical coverage test verifying ~90% of held-out references fall within 90%-level intervals on synthetic exchangeable data (the actual conformal guarantee, not just self-consistency). Edge cases pinned: finite-sample rank arithmetic,+infon undersized calibration, full-range clamp, degenerate range / empty-calibration / bad-α rejection.Reuse note
The quantile follows kairu's existing sorted-list / nearest-rank percentile pattern. No HF/torch —
MockModel/ensemble_evaluateexercise every path offline. Backlog from the same Discovery sweep (logged in PLAN.md for future cycles): IRT judge discrimination, entropy-driven adaptive γ, dark-current datasheet, radix-tree KV dedup.🤖 Generated with Claude Code
https://claude.ai/code/session_01TmSqgYqcYfzPnkpDVR5vdw
Generated by Claude Code