feat(judges): continuous-value inter-rater agreement (ICC + weighted κ)#50
Merged
Conversation
The original calibrateJudge rounded scores to ints before computing Cohen's κ. For fine-grained [0,1] judges that's lossy — 0.78 vs 0.81 both round to "1" and the integer κ claims perfect agreement when the raters actually disagree by 3pp. This release adds continuous-value agreement metrics so calibration findings on continuous judges become quantitative. - continuousAgreement(scores, opts?): κ_w (quadratic or linear weights on raw scores), ICC(2,1) per Shrout & Fleiss (two-way random effects, absolute agreement, single rater), Pearson + Spearman averaged over rater pairs, bootstrap 95% percentile CIs on ICC and κ_w (default n=1000, seeded). - calibrateJudgeContinuous(golden, candidate, opts?): drop-in superset of calibrateJudge — preserves all legacy fields and adds the continuous metrics + CIs. - calibrateJudge is unchanged for backwards compat. ICC catches systematic bias Pearson misses: if judge B = 2× judge A, Pearson stays ≈ 1 while ICC drops. Tests assert this exact failure mode (identical raters → 1.0, independent uniform → ≈ 0, 2× scaling → high Pearson + lower ICC, bootstrap CI brackets truth on synthetic ground-truth data). Version bump to 0.26.0 (non-breaking add).
Contributor
Author
|
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
calibrateJudgerounded judge scores to ints before computing Cohen's κ. For fine-grained [0,1] judges that's lossy — 0.78 vs 0.81 both round to "1" and the integer κ claims perfect agreement when raters actually disagree by 3pp.continuousAgreement(scores, opts?)returning Cohen's κ_w (quadratic or linear weights on raw scores), ICC(2,1) per Shrout & Fleiss (two-way random effects, absolute agreement, single rater), Pearson + Spearman averaged over rater pairs, and bootstrap 95% percentile CIs on κ_w and ICC (default n=1000, seeded for reproducibility).calibrateJudgeContinuous(golden, candidate, opts?)as a drop-in superset ofcalibrateJudge— every legacy field is preserved, new fields (weightedKappaContinuous,icc,spearman,ci) layered on top.calibrateJudgeis unchanged.ICC catches the bug Pearson hides: if judge B = 2× judge A, Pearson stays ≈ 1 while ICC drops. The evolve scripts can now report κ_w + ICC per judge dimension with CIs — calibration findings become quantitative.
API
Test plan
pnpm typecheckclean.pnpm test— 1065 / 1065 pass (was 1051).pnpm buildsucceeds; new exports surface indist/index.d.ts.calibrateJudgeContinuouspreserves every legacy field (n,pearson,kappa,mae,worstItems) and flags the 2× scaling bias that integer-rounded κ misses.Files
src/judge-calibration.ts— new public API + internals (continuous κ_w, ICC(2,1), Spearman with tie-handling, seeded Mulberry32 bootstrap, percentile quantile).src/index.ts— re-exports.tests/judge-calibration.test.ts— extended with 11 new tests (no new file; one canonical suite).docs/concepts.md— new "Judge calibration" section.README.md— primitive table row.CHANGELOG.md,package.json,clients/python/{pyproject.toml,src/agent_eval_rpc/__init__.py}— version bump to 0.26.0.