Skip to content

feat (gdpval): report coverage breakdown by sector and occupation (#12) - #20

Open
Vineetiitg wants to merge 2 commits into
google-deepmind:mainfrom
Vineetiitg:gdpval-coverage
Open

Vineetiitg wants to merge 2 commits into
google-deepmind:mainfrom
Vineetiitg:gdpval-coverage

Conversation

@Vineetiitg

Copy link
Copy Markdown

Closes #12

Overview

Following up on the suggestion in #12 regarding the task mix shift across sectors/occupations:

This PR adds a breakdown by sector and occupation so users can see how the task mix changes across stages and how that affects the final score.

Key Changes

  • Keep sector & occupation info: Saved sector and occupation from openai/gdpval onto each task trace.
  • Track tasks across 3 stages: Added a coverage report with counts by sector and occupation for:
    1. Starting stage: Total tasks loaded for the run or shard.
    2. Reference-eligibility stage: Tasks with valid text references vs. dropped tasks (no_deliverable_shipped vs no_text_rendering).
    3. Scored stage: Tasks actually evaluated by the judge, with comparison counts and win rates.
  • Macro rates for weighting transparency: Added unweighted sector and occupation win rates (macro_win_rate_by_sector_pct, macro_win_rate_by_occupation_pct) alongside the headline pooled score.
  • Canonical Sync Gate: Declared the code fingerprint in canonical_sync.py under VERDICT_PRESERVING as a reporting-only update so CI passes.
  • Tests & Docs: Added unit tests in tests/test_gdpval.py testing the real _make_scorer and run_gdpval pipeline, and updated docs/evals/gdpval.md.

@google-cla

google-cla Bot commented Nov 25, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@lucianommartins lucianommartins left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for picking up #12, @Vineetiitg. The three-stage coverage layout is clear, and the change is genuinely verdict-preserving (request payloads, sample_key, filtering, and scoring stay untouched, and the canonical_sync.py fingerprint matches).

Before we merge, there are four things to address (details inline):

  1. Remove the duplicated test block in tests/test_gdpval.py (lines 559-693 repeat lines 419-557 verbatim, triggering ruff F811) and the unused base import (F401).
  2. Add merge_shards(results) in gbench/third_party/eval_suites/gdpval.py so sharded gbench --merge runs recompute coverage and macro_win_rate_by_*_pct across the union of traces instead of moving them to merge_unreconciled_fields (or keeping a stale shard average). Refresh canonical_sync.py afterward.
  3. Update the 14 of 25 / 25 of 25 / 22 of 44 numbers in docs/evals/gdpval.md and weighting_note: those came from the 185-row deliverable_files metadata check in #12 rather than the final 181 text-renderable tasks. Either verify counts against the 181-task set or state the non-uniform drop behavior qualitatively.
  4. Expand tests/test_gdpval.py to cover macro-vs-pooled divergence, 0 scored tasks (None withheld, never 0.0), JUDGE_OUTAGE / failed generations, no_text_rendering, missing/None sector and occupation fallback to "Unknown", and merge_shards.

Minor title note: we can normalize the commit title to feat(gdpval): report coverage breakdown by sector and occupation (#12) (no space before () and squash on merge. Once updated, I will approve the CI workflow runs.

Comment thread tests/test_gdpval.py



# --------------------------------------------------------------------------- #

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All three new tests (test_loader_retains_sector_and_occupation_in_sample_metadata, test_make_scorer_computes_coverage_end_to_end, and test_run_gdpval_full_pipeline_coverage_reporting) are pasted twice back-to-back starting here (repeating lines 419-557).

Python overwrites the earlier definitions and ruff flags F811.

Please delete this second copy.

Comment thread tests/test_gdpval.py
"""Execute the real _make_scorer async pipeline with position-swapped judging,
verifying that coverage tracks starting, reference-eligible, and scored stages.
"""
from gbench.runners.eval_suites import base

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor/lint: base is imported here but unused in this test (ruff F401). Please remove this line.

Comment thread tests/test_gdpval.py
assert meta["occupation"] == "Software Developers"


def test_make_scorer_computes_coverage_end_to_end():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now the tie fixture gives 1.0 in both sectors, so macro == pooled == 1.0. Please add test cases covering:

  • Unequal sector/occupation sizes with different win rates so macro and pooled win rates diverge (including wins_only_rate / losses).
  • 0 scored tasks (all NO_REFERENCE, JUDGE_OUTAGE, or failed generation), confirming win_rate is None and macro_win_rate_by_*_pct is omitted/None (never 0.0, no division by zero).
  • no_text_rendering tracking (n_files > 0 with text=None).
  • Missing, None, or empty sector / occupation falling back to "Unknown".
  • Sharded merge_shards(results) reconciliation.



def compute_coverage(
sample_traces: List[Dict[str, Any]],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because gdpval.py does not define merge_shards, gbench --merge falls back to generic_merge (gbench/merge.py:580-585). Neither coverage nor macro_win_rate_by_*_pct is in its handled set, so:

  • coverage gets stripped from the merged result and dumped into merge_unreconciled_fields.
  • macro_win_rate_by_*_pct is either stripped or, if two shards happen to share the same rounded macro percentage over different denominators, silently kept with the wrong number (for example, shard 1 with 1/1 and 0/2 -> 50.0% and shard 2 with 1/9 and 8/9 -> 50.0%, while the true union macro is (2/10 + 8/11) / 2 = 46.36%).

Please add a merge_shards(results) function (following gbench/third_party/eval_suites/gpqa.py) that calls generic_merge, recomputes compute_coverage over the merged sample_traces, pops those three keys from merge_unreconciled_fields, and refreshes canonical_sync.py (python gbench/runners/eval_suites/canonical_sync.py --refresh-code-fp).

by_occupation = dict(sorted(by_occupation.items()))

sec_rates = [v["win_rate"] for v in by_sector.values() if v["win_rate"] is not None]
macro_sec = round(sum(sec_rates) / len(sec_rates), 4) if sec_rates else None

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional nit: averaging the already 4-decimal-rounded v["win_rate"] values can introduce slight double-rounding drift across 44 occupations. Computing macro_sec and macro_occ from the raw (wins + ties) / comparisons ratios and rounding at the end avoids that.

"weighting_note": (
"Headline win_rate is a pooled micro-average over all scored comparisons. "
"Because reference eligibility drops tasks non-uniformly across sectors "
"(e.g., Information retains 14 of 25 tasks while Manufacturing retains 25 of 25), "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #12, 14 of 25, 25 of 25, and 22 of 44 came from the 185-row deliverable_files metadata check rather than the final 181 text-renderable tasks (before the 4 no_text_rendering drops). Could you either verify the exact counts on the 181-task renderable set or phrase this qualitatively (for example, that reference eligibility drops tasks non-uniformly across sectors and occupations, so groups with higher retention carry more weight in the pooled score)?

Comment thread docs/evals/gdpval.md
Comment on lines +415 to +416
across sectors (e.g. at the pinned revision, Information retains 14 of 25 tasks while Manufacturing
retains 25 of 25; 22 of 44 occupations lose tasks), sectors with higher retention contribute more

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same note as in gdpval.py: 14 of 25, 25 of 25, and 22 of 44 came from the 185-row metadata check in #12 rather than the final 181 renderable tasks. Please either verify these counts against the 181-task set or state the non-uniform retention effect without fixed counts.

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.

Consider reporting GDPval coverage by sector and occupation

2 participants