feat: judge reliability - calibration, uncertainty, and bias debiasing (v0.3.0)#2
Merged
Merged
Conversation
Extract an un-cached single-shot score() from JudgeDimension.evaluate and refactor evaluate to reuse it (cache behavior unchanged). Add a SelfConsistencyJudge that samples a base judge N times via score() and reports the score distribution (mean, pstdev, normal-approx 95% CI). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Implements PairwiseJudge that runs A-vs-B comparisons in both orders and only trusts a verdict consistent across the swap, falling back to a tie otherwise. Adds parse_pairwise, position_bias_rate diagnostic, default prompt template, and an offline test suite. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Append pearson/spearman/mae to bench.metrics and add judge.calibration (CalibrationSample, CalibrationReport, calibrate_judge, verbosity_bias) measuring score-level and label-level agreement plus verbosity bias. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Top-level + judge/ + bench/ __init__ exports for SelfConsistencyJudge, ScoreDistribution, PairwiseJudge, PairwiseResult, position_bias_rate, calibrate_judge, CalibrationSample, CalibrationReport, verbosity_bias, and the pearson/spearman/mae stats. - examples/judge_calibration.py: offline demo of uncertainty, position-bias debiasing, calibration, and verbosity-bias. - README: "Judge reliability" section. - version 0.2.0 -> 0.3.0.
…sed) Reviewer follow-up (MINOR). Other reviewer suggestions deferred to v0.3.1: verbatim raw in PairwiseResult, and the evaluate/score double-render.
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.
Summary
An LLM judge is itself a model, with variance and bias. This release adds the tools to measure and correct for that, so a judge can be defended in a design review instead of trusted on faith. All three pieces use the existing
Dimensioninterface and stay offline-testable via injected callables.Uncertainty: self-consistency (
SelfConsistencyJudge)Samples a judge N times and reports the mean, spread, and a 95% confidence interval, so you know whether a score is solid or a coin flip.
JudgeDimension.score()was added as an un-cached single-shot scorer (the existingevaluatewas refactored to delegate to it; cache and graceful-failure behavior unchanged).Position-bias debiasing:
PairwiseJudgeRuns a pairwise comparison in both answer orders and only trusts a verdict that survives the swap; if the judge flips, it returns a tie with
consistent=False.position_bias_rate()quantifies how often a judge flips across a set of pairs.Calibration:
calibrate_judgeMeasures judge-vs-human agreement: Pearson/Spearman correlation and MAE against human scores, plus accuracy and Cohen's kappa against human pass/fail.
verbosity_bias()checks the failure mode where a judge just rewards length. Newpearson/spearman/maestats added tobench.metrics.Quality
examples/judge_calibration.pydemos all three tools).Deferred to v0.3.1 (reviewer follow-ups, non-blocking)
PairwiseResult.raw(currently reconstructed).JudgeDimension.evaluate.Packaging