Skip to content

fix(gdp-pdf): follow Artificial Analysis's document preparation, judge and denominator - #5524

Merged
yaoyu-33 merged 4 commits into
NVIDIA-NeMo:mainfrom
trintamaki:gdp-pdf-aa-parity
Nov 10, 2026
Merged

yaoyu-33 merged 4 commits into
NVIDIA-NeMo:mainfrom
trintamaki:gdp-pdf-aa-parity

Conversation

@trintamaki

@trintamaki trintamaki commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

GDP.pdf's document pipeline is built to follow Artificial Analysis's GDP.pdf method, but three settings drift from it:

  • Parser version. Artificial Analysis prepares every PDF with LiteParse 2.5.0 and English OCR. The resources server's pyproject.toml leaves LiteParse unpinned and its uv.lock resolves it to 2.16.0, whose text extraction differs. This PR pins liteparse==2.5.0 in pyproject.toml, updates uv.lock (only LiteParse changes) and sets ocr_language="eng" explicitly. LiteParse 2.5.0 has no extract_screenshots option, so pages are rendered through screenshot() (the fallback _page_screenshots() already had). Each manifest records the parser version, a manifest from another version is re-rendered, and prepare warns once when the installed version is not 2.5.0.
  • Judge budget. Artificial Analysis grades with GPT-5.6 Luna at medium reasoning effort. The default max_tokens: 1024 covers the judge's reasoning too, so the judge can run out before writing its verdict. A criterion that does so fails the whole row, which then leaves the denominator. The judge now runs at reasoning_effort: medium with max_completion_tokens: 16384.
  • Denominator. Artificial Analysis divides by all 500 attempts (100 tasks x 5), scores errors and missing attempts as zero, and accepts a grading only when every criterion has a verdict. Gym's aggregate leaves rows in <rollouts_stem>_failures.jsonl out. benchmarks/gdp_pdf/report_aa.py scores a run over every task and attempt from the saved verdicts (it calls no model), reports all-pass, Mean Pass and Mean Pass by domain, and sets judging_complete: false while any attempt is missing, failed or lacks a verdict. It reads a gym eval run through its rollout store, so a re-judged or re-verified result replaces the one it settles, and it accepts any decimal score the verifier saves. The benchmark README describes the steps (re-judge with gym eval reverify --judge-failed-only, then report).

The agent's delivery logic (images first, single text block, reactive DPI backoff and compositing) is unchanged.

Scores move (parser version, judge budget), so benchmarks/gdp_pdf/manifest.yaml goes from 0.1.0 to 0.2.0.

Validation

  • pytest resources_servers/gdp_pdf/tests in the environment from uv sync --locked (LiteParse 2.5.0), with the example manifests rendered locally: 89 passed. Includes the new test_aa_parity.py (LiteParse settings and provenance, re-render on a version change, the one-time warning, and the report's handling of decimal scores, judge failures, masked verification failures, missing attempts, empty answers, terminal input failures, retries, duplicates, failures of a task with no successful rollout, and a managed run whose masked result was re-verified) and example-fetch tests that re-render manifests from another LiteParse version.
  • pytest responses_api_agents/gdp_pdf_agent/tests (agent unchanged): 75 passed.
  • prepare_document() with the real LiteParse 2.5.0 on a two-page test PDF: OCR text and 150 DPI page images for both pages; the manifest records parser_version: 2.5.0 and ocr_language: eng.
  • gym env validate --config resources_servers/gdp_pdf/configs/gdp_pdf.yaml --config resources_servers/gdp_pdf/configs/judge_model_openai.yaml: config is valid; the judge parameters parse as NeMoGymChatCompletionCreateParamsNonStreaming.
  • pre-commit run --files <changed files>: all hooks pass.

Rollouts

Not attached yet. The agent and the verifier's grading logic are unchanged; the change is to document preparation (parser version) and judge parameters, covered by the unit tests and the real LiteParse 2.5.0 prepare above. A full benchmark run on this branch (prepare with LiteParse 2.5.0, a vision model, the Luna judge, report_aa.py output and the judge-failure count against max_tokens: 1024) can follow if reviewers want it.

Compatibility and benchmark impact

  • GDP.pdf scores change: documents are re-rendered with LiteParse 2.5.0, and fewer rows are lost to judge failures. Prepared corpora from earlier versions are re-rendered on the next prepare.
  • Configs that override judge_chat_create_params.max_tokens should drop that override, since max_completion_tokens now sets the budget.
  • report_aa.py is optional; Gym's own aggregate is unchanged.

Proposed labels: bug, area:evaluation.

Checklist

  • I have read the contributing guidelines.
  • The change is focused; unrelated "drive-by" edits are tracked as separate issues/PRs.
  • Tests added or updated and pass locally.
  • Documentation added or updated (benchmark and resources server READMEs).
  • Pre-commit checks pass locally on the changed files.
  • New source files include the required Apache-2.0 SPDX header.
  • All commits have DCO sign-off (git commit -s).

🤖 Generated with Claude Code

…e and denominator

Pin LiteParse 2.5.0, the version Artificial Analysis prepares GDP.pdf with,
and set English OCR explicitly. LiteParse 2.5.0 has no extract_screenshots
option, so pages are rendered through screenshot(). Each manifest records the
parser version; a manifest from another version is re-rendered, and prepare
warns once when the installed version is not 2.5.0.

Judge at medium reasoning effort with a 16,384-token budget. At max_tokens
1024 the judge ran out before writing its verdict, and each such criterion
failed the whole row.

Add benchmarks/gdp_pdf/report_aa.py, which scores a run over every task and
attempt as Artificial Analysis does: missing and failed attempts count as
zero, and attempts without a verdict for every criterion are flagged. The
benchmark README describes the method and the steps.

Scores change (parser version, judge budget), so the benchmark manifest moves to 0.2.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tuomas Rintamaki <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 3, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@trintamaki
trintamaki marked this pull request as ready for review November 3, 2026 19:14
@hsiehjackson

Copy link
Copy Markdown
Contributor

/ok to test 8135b59

Resolve the conflict with the component pyproject.toml and uv.lock move
(NVIDIA-NeMo#4837): the LiteParse 2.5.0 pin moves from requirements.txt to
pyproject.toml, and uv.lock is regenerated (only LiteParse changes, from
2.16.0 to 2.5.0). The benchmark README keeps main's prepare text and notes
the pinned version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tuomas Rintamaki <[email protected]>
@trintamaki
trintamaki requested a review from a team as a code owner November 4, 2026 17:16
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 4, 2026
@cmunley1

cmunley1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

/review

@cmunley1

cmunley1 commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

/ok to test 6236233

cmunley1
cmunley1 previously approved these changes Nov 5, 2026

@cmunley1 cmunley1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm pending autobot's review

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

HOLD — the report can replace valid verifier grades with zero, misstate judging completeness, and misread recovered runs.

I inspected all nine changed files and traced document consumption, judge requests, and rollout/recovery artifacts. The inline findings include proposed regression checks; I couldn't execute tests or model rollouts in this read-only review.

RISK — Provide representative rollout and before/after scoring evidence

The PR explicitly says no real rollouts are attached. The parser pin changes policy inputs, the judge defaults change grading, and the new report changes aggregation. Unit tests, synthetic PDF preparation and config validation don't establish that the document-to-policy-to-judge path works or explain its score distribution. The trusted quality bar requires representative real model rollouts; the pinned review rubric also requires profiling evidence for fixed-benchmark scoring changes. This is a validation gap, not a demonstrated runtime failure.

Correction and acceptance: Could you attach matched before/after runs using a vision policy and the configured Luna judge, with the exact config, task selection, repeat count and artifact locations? Report all-pass, mean criterion pass, judge-failure counts, incomplete-verdict counts and fixed-denominator metrics, and explain the intended shifts. Inspect representative answers and verdicts, confirm that the new judge parameters reach the provider, and retain image-first delivery, empty-answer zeros and terminal-input-failure zeros. Keep remaining failures visible in the comparison. No source patch can substitute for this evidence.


Inline comments (escaped v1):

  • benchmarks/gdp_pdf/report_aa.py line 92: BLOCKER — Preserve valid decimal grades from the verifier.

    Failure: A complete evaluation with score="1.0" and passed=true fails this check, so the report silently replaces its credit with zero and labels it incomplete_judging. That is supported producer output: the verifier parses decimal scores and applies half-up rounding, then serializes str(score). Its existing tests also support 0.99996, 0.99994 and 1.5. Thus the new report disagrees with valid saved GDP grades whose spelling isn't exactly "0" or "1".

    Correction: Match the verifier's serialized decimal contract, not just the requested judge schema. Import Decimal, InvalidOperation and ROUND_HALF_UP from decimal, and replace this elif block in _grade() with:

            elif type(item.get("passed")) is not bool or not isinstance(item.get("score"), str):
                return None
            else:
                try:
                    score = Decimal(item["score"])
                    if not score.is_finite():
                        return None
                    expected_pass = score.quantize(Decimal("0.0001"), rounding=ROUND_HALF_UP) >= 1
                except (InvalidOperation, ValueError):
                    return None
                if item["passed"] != expected_pass:
                    return None

    Preservation and acceptance: Proposed report regressions should give full credit for "1", "1.0", "0.99996" and "1.5", and no credit for "0", "0.0" and "0.99994", with matching Boolean verdicts and judging_complete=true. Retain the existing rounding assertions. Preserve empty-answer evaluations without numeric scores, and keep a nonempty answer with a missing verdict incomplete and zero. This suggested code is source-reasoned, not executed; please verify it before adopting it.

  • benchmarks/gdp_pdf/report_aa.py line 179: RISK — Derive judging completeness from every expected attempt.

    Failure: For one expected task, no rollouts and repeats=1, the report returns missing: 1 but judging_complete=true. A second reachable case is a saved nonempty answer with mask_sample=true, failure_kind="agent_route_failed" and no evaluations: GDP's agent produces this when verification fails, yet its failed_agent_route_failed outcome also leaves completeness true. Both contradict the documented promise that completeness stays false while an attempt lacks criterion verdicts. Checking only two outcome names misses these cases.

    Correction: Count every expected attempt without an accepted complete grade as unjudged, while retaining the verifier's explicit empty-answer/terminal-input zeros. With the current outcome branches, replace this assignment with:

        unjudged = denominator - sum(
            outcomes[name] for name in ("graded", "empty_answer", "terminal_input_failure")
        )
    

    Preservation and acceptance: Add proposed cases for the missing attempt and masked verify-transport failure above: both must score zero and return judging_complete=false. Update test_missing_attempt_scores_zero to expect false rather than its current true assertion. Retain false for judge failures and partial verdicts, true for fully graded runs and verifier-produced empty/terminal-input zeros, and the existing fixed denominator in every case. This suggestion wasn't executed.

  • benchmarks/gdp_pdf/report_aa.py line 118: RISK — Resolve failures even when a task has no successful rollout.

    Failure: This mapping comes only from the main rollouts. Collector HTTP /run failures carry diagnostics without verifier metadata, followed by task/repeat stamps. If every repeat of a task fails this way, _attempt_key() returns None and all its sidecar evidence is discarded. Minimal case: one expected task, an empty main file, and {_ng_task_index: 0, _ng_rollout_index: 0, _ng_failure_class: "agent_run_error"} in the sidecar. With one repeat, the report says missing: 1 and all_attempts_present=false instead of classifying the recorded failure. The score remains zero, but the failure/presence diagnostics are wrong.

    Correction: Give summarize() an index-to-task mapping from the run's materialized inputs, or enrich selected failures from those inputs in main(). For managed runs, the public RolloutStore.inputs_for() provides that association. Preserve explicit verifier_metadata.task_id precedence and reject conflicting mappings. Don't substitute prepared-file position: collection honors supplied non-positional indices. Update the CLI documentation if an explicit materialized-input argument is needed; the exact interface choice needs author verification.

    Preservation and acceptance: Proposed cases should cover an all-failed task with no successful sibling, an empty main file, and a materialized task indexed at 42. Recorded pairs must appear under their failure class and count as present; genuinely absent pairs must remain missing and zero. Retain the existing assertion that an earlier failed try does not replace the selected graded attempt. No tests were executed.

  • benchmarks/gdp_pdf/report_aa.py line 129: RISK — Select current outcomes before rejecting duplicate task/repeat pairs.

    Failure: Gym's main JSONL can contain append-only history rather than one current row per pair. A GDP verify failure leaves a masked main-file result; recovery can regrade that saved result, and settlement appends its replacement. Both retain the same task/repeat, so the documented report CLI raises Duplicate rollout after successful recovery. Always preferring a main-file row over a sidecar row can also resurrect an older score after a newer failed execution.

    Correction: In main(), read managed runs through the public RolloutStore.read() and summarize its selected successes and failures. Keep duplicate rejection for genuinely conflicting unmanaged input. Don't use last-line-wins: selection must follow the manifest and execution identity, including a newer reservation with no saved outcome. The existing selection regressions demonstrate why arrival order is insufficient. The integration needs verification rather than a speculative replacement for main().

    Preservation and acceptance: Add a proposed managed-run check containing a masked GDP result and its settled, fully passing replacement: reporting must succeed, count one logical attempt and award full credit. Retain genuine-duplicate rejection for unmanaged inputs and an earlier sidecar failure followed by a selected success. A newer selected failure must hide an older success, and a newer unresolved reservation must not resurrect the older grade. These checks weren't executed.

  • benchmarks/gdp_pdf/prepare.py line 417: RISK — Apply parser-version invalidation to example preparation too.

    Failure: The new version check in prepare_document() is bypassed by fetch_example_media(): its early cache check calls this structural-only wrapper and skips before reaching prepare_document(). Start with existing example manifests rendered by the previous LiteParse version, install this PR's pinned 2.5.0, and rerun the documented example-fetch command: it renders zero documents and keeps the old extraction. Legacy manifests without provenance are also reused. Thus the migration works for full preparation but not the supported example path.

    Correction: Make _manifest_looks_complete() require the installed parser version, while still avoiding a source-PDF hash requirement:

        return _manifest_is_complete(manifest_path, parser_version=_liteparse_version())
    

    Update its docstring accordingly. Adjust the reusable stub manifests in the existing fetch tests to declare matching parser provenance when they represent a reusable cache.

    Preservation and acceptance: Proposed fetch regressions should rerender a structurally complete manifest with parser_version="2.16.0" or no version, then record 2.5.0. A complete matching-version manifest must still skip download/render even when its source PDF isn't local; missing page images must still trigger preparation. Retain the existing direct-preparation version-change test and once-only warning behavior. This suggested change is source-reasoned and wasn't executed.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@github-actions github-actions Bot removed the sla:triage-overdue Review assignment is over the one-business-day SLA label Nov 5, 2026
Review fixes for the AA report and example preparation:

- A criterion's saved score is str() of the judge's decimal, so "1.0" or
  "0.99996" is a valid grade. The report now applies the verifier's pass
  rule (half-up to 4 places, at least 1) and checks it against the saved
  verdict, instead of accepting only "0" and "1".
- judging_complete is false while any expected attempt lacks a complete
  grading: missing and failed attempts and a masked /verify failure count,
  while an empty answer or an input that never fit stays a final zero.
- A run collected by gym eval is read through its RolloutStore, which
  selects the current outcome of each attempt. A re-verified result that
  follows the masked one no longer raises "Duplicate rollout". The run's
  materialized inputs map task indices, so a failure of a task with no
  successful rollout is attributed to it. Rollouts without a manifest, or
  with an explicit --failures file, are read as before.
- fetch_example_media renders again a manifest from another LiteParse
  version, or one without a recorded version, as prepare_document does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tuomas Rintamaki <[email protected]>
@trintamaki

trintamaki commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for the review. c0303dc addresses the five inline findings:

  • Decimal grades (report_aa.py, blocker): the report now applies the verifier's pass rule to the saved score: any finite decimal string, half-up to 4 places, passes at 1 or more. It checks that rule against the saved passed. "1", "1.0", "0.99996" and "1.5" get credit; "0", "0.0" and "0.99994" don't. A verdict the verifier could not have saved (passed disagreeing with the score, NaN, a non-decimal or a non-string score) leaves the attempt incomplete. Empty answers keep their judge-free zeros.
  • Judging completeness: judging_complete is now false while any expected attempt lacks a complete grading. Missing and failed attempts count, and so does a masked /verify failure. An empty answer and an input that never fit stay final zeros. test_missing_attempt_scores_zero now expects false.
  • Failures of a task with no successful rollout: summarize() takes the run's materialized inputs (inputs=), which map a task index to its task, and rejects an index that maps to two tasks. main() gets them from RolloutStore.inputs_for().
  • Recovered runs: main() reads a gym eval run through RolloutStore.read() (selected("success"), failures()), so a re-verified result replaces the masked one it settles. A new test builds a managed run, re-verifies a masked result through admit_rejudgment/record_rejudgment, and checks one graded attempt with full credit. It also checks that reading the raw file still raises Duplicate rollout. Rollouts without a manifest, or with an explicit --failures, are read as before, so duplicate rejection stays for unmanaged input.
  • Example preparation: _manifest_looks_complete() now requires the installed parser version, so fetch_example_media() renders a manifest from 2.16.0, or one with no recorded version, again. A matching manifest is still skipped without downloading its PDF.

pytest resources_servers/gdp_pdf/tests: 89 passed. pytest responses_api_agents/gdp_pdf_agent/tests: 75 passed. pre-commit passes on the changed files.

On before/after rollouts: since the previous revision was approved, I haven't run them for this round. If a maintainer wants them before merging, I'll run matched before/after evaluations with a public vision policy and the Luna judge. I'll attach all-pass, mean criterion pass, judge-failure and incomplete-verdict counts and the fixed-denominator report, with the configs and task selection.

@svcnvidia-nemo-ci svcnvidia-nemo-ci added bug Something isn't working area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters needs-review PR is ready for code review and waiting on a reviewer labels Nov 7, 2026
@cmunley1

cmunley1 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

/ok to test c0303dc

@cmunley1

cmunley1 commented Nov 7, 2026

Copy link
Copy Markdown
Contributor

/review

cmunley1
cmunley1 previously approved these changes Nov 7, 2026

@svcnvidia-nemo-ci svcnvidia-nemo-ci left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

SHIP WITH CARE — the five code findings are fixed; the rollout/profiling evidence RISK remains unresolved.

I compared this head with the previous reviewed revision and traced the directly affected contracts. The current source and regression assertions address:

This was a follow-up review, not a fresh whole-PR review. One delegated report wasn't available, so I independently covered its grading/completeness assignment. I couldn't execute tests or model evaluations; the reported test passes weren't independently reproduced.

RISK — Provide representative rollouts and before/after scoring evidence

The systemic finding from review 5792909589 remains unresolved. The description still says rollouts aren't attached, and the author's update confirms that matched before/after evaluations weren't run. The parser preparation changes policy inputs, the judge defaults change grading, and the report changes aggregation. Unit tests, synthetic-PDF preparation and config validation don't establish the real document-to-policy-to-judge behavior or explain its score distribution. The trusted quality bar and review rubric require that evidence. This is a validation gap, not a demonstrated runtime failure.

Correction: Could you attach representative matched baseline/head evaluations using the same vision policy, configured Luna judge, tasks and repeat count? Include the exact revisions, resolved configs, parser provenance and artifact locations. Report all-pass, mean criterion pass, judge-failure counts, incomplete-verdict counts and fixed-denominator metrics for both runs, and explain the intended shifts. No source patch substitutes for these artifacts.

Preservation and acceptance: Inspect representative answers and criterion verdicts to confirm that the real path completes and the score changes are explained. Saved judge requests should show reasoning_effort: medium and max_completion_tokens: 16384. Retain English OCR, 150-DPI preparation and image-first delivery followed by one task/text block. Keep empty answers and terminal-input failures as final zeros; missing, failed and incompletely judged attempts must remain in the denominator and keep judging_complete=false. Leave unresolved failures visible in the comparison. These are requested acceptance checks, not results obtained in this review.

Review generated by codex. This was a findings-only review. Request a full review with /review reset=true.

…outs

test_public_api_facades requires code outside the library to import
exported names from the package's public API.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Tuomas Rintamaki <[email protected]>
@yaoyu-33

yaoyu-33 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

/ok to test cf87221

@trintamaki

Copy link
Copy Markdown
Contributor Author

/ok to test 8135b59

@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42705440445

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42707284195

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 9, 2026
@yaoyu-33 yaoyu-33 added ready-to-merge PR is approved, current, and waiting for final CI or merge and removed needs-review PR is ready for code review and waiting on a reviewer labels Nov 10, 2026
@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/42849741641

Merged via the queue into NVIDIA-NeMo:main with commit 1709bbd Nov 10, 2026
65 of 68 checks passed

This branch was previously deployed

1 inactive deployment
public — cf87221e Deployed Nov 9, 2026 by copy-pr-bot[bot] via release / finalize / notify #11138
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters bug Something isn't working ready-to-merge PR is approved, current, and waiting for final CI or merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants