Skip to content

stats: pareto() collapses judge replications per answer and skips missing cost/tokens - #36

Open
ChrisW09 wants to merge 1 commit into
mainfrom
fix/pareto-aggregation
Open

stats: pareto() collapses judge replications per answer and skips missing cost/tokens#36
ChrisW09 wants to merge 1 commit into
mainfrom
fix/pareto-aggregation

Conversation

@ChrisW09

Copy link
Copy Markdown
Collaborator

Fixes #6.

Bug 1 — pseudo-replication. _quality_by_config appended one value per rating item, i.e. per judge repetition. _frame.py documents that judge reps must be collapsed per answer ("Treating them as independent observations would be pseudo-replication") and attribute() complies — so the same evaluation reported quality 3.0 in the descriptive layer and 4.0 in the Pareto table (verified with judge_replications=3 where one answer lost 2 verdicts to judge errors). Quality is now the mean over per-answer means, keyed by obs_key.

Bug 2 — missing-as-zero. _resources_by_config appended 0.0 for absent cost_usd/tokens metadata while correctly skipping absent latency two lines above. A config whose adapter failed to report cost on half its observations had its mean cost halved; a fully untracked config got cost 0.0 and could dominate everything on cost. Missing values are now skipped like latency; a genuinely reported 0.0 still counts, and all-missing objectives stay constant-0 and are dropped from the dominance test as before.

Both fixes come with regression tests pinning the exact scenarios from the issue.

Test: pytest packages/cafe-core/tests/test_pareto.py — 6 passed; full suite green apart from pre-existing #4.

🤖 Generated with Claude Code

- _quality_by_config averaged raw rating items, so answers with more
  surviving judge replications weighed more (pseudo-replication) — the
  Pareto quality could disagree with attribute() on identical data
  (verified: 4.0 vs 3.0) and flip dominance decisions. Judge reps are
  now collapsed to one value per answer first, the same rule the
  analysis frame documents and attribute() follows.
- _resources_by_config counted a missing cost_usd/tokens as 0.0,
  diluting the mean toward zero so a config with unreported costs looked
  spuriously cheap. Missing values are now skipped, exactly like the
  latency handling two lines above; a genuinely reported 0.0 still
  counts (and constant-0 objectives are dropped as before).

Fixes #6

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stats: pareto() pseudo-replicates judge repetitions and counts missing cost/tokens as 0.0

1 participant