Skip to content

fix(text_to_sql): raise the README judge budget so a reasoning judge reaches a verdict - #5102

Merged
yaoyu-33 merged 1 commit into
mainfrom
qiaochuz/reg-20261026-text-to-sql-judge-budget
Nov 18, 2026
Merged

yaoyu-33 merged 1 commit into
mainfrom
qiaochuz/reg-20261026-text-to-sql-judge-budget

Conversation

@qiaochuz-nv

Copy link
Copy Markdown
Contributor

What does this PR do?

Makes the text_to_sql README launch give the judge enough output tokens to reach a verdict. The README's gym env start set judge_responses_create_params.max_output_tokens=512. The judge is the policy model, so when the policy is a reasoning model, the judge spends all 512 tokens reasoning and stops incomplete before it writes [[A=B]] or [[A!=B]]. Following the README on the five shipped examples then scores every row 0 with no verdict, and the check_twice_swap second judge almost never runs. This PR raises the documented budget to 8192.

Found by the NeMo Gym QA regression (QA case text_to_sql); no NVBug filed.

Cause

resources_servers/text_to_sql/README.md:74 has passed max_output_tokens=512 to the judge since the server was added in #648, and configs/text_to_sql.yaml sets judge_model_server.name: policy_model. A judge reply cut off at the budget carries no marker, so _generate_judge_evaluation leaves verdict_label=None (app.py:397-414). verify then records judge_evaluation_failed with reward 0.0 (app.py:312-313), and the swap judge, which only runs after a first [[A=B]] (app.py:288), is skipped. The parsing and scoring are correct; only the documented budget is too small.

Fix

  • README: the gym env start judge override is now max_output_tokens=8192, with one sentence saying why (the judge is the policy model, and a reasoning model needs thousands of tokens before the verdict).
  • tests/unit_tests/test_text_to_sql_readme_config.py: an offline README-replay test modeled on test_terminus_judge_readme_config.py (fix(terminus_judge): define the judge server the README launch needs #4557). It runs the README's gym env start block through the real CLI with dispatch intercepted, resolves the config offline with placeholder endpoints (no env.yaml/dotenv), and asserts the judge is policy_model with budget 8192.

Why 8192 and not 4096, the value #4557 used for terminus_judge: at 4096 the QA case passed, but 2 of 19 README-rollout judge calls still stopped incomplete at exactly 4096 (completed calls reached 3783 tokens). At 8192 every judge call reached a verdict across two runs; the largest used 4086 tokens.

Before the fix

Gym 45ceac060 (main), offline test from this branch:

pytest tests/unit_tests/test_text_to_sql_readme_config.py -q
>       assert resources.judge_responses_create_params.max_output_tokens == 8192
E       AssertionError: assert 512 == 8192

On the same main, the QA case text_to_sql runs the README stack (gym env start with the README overrides, gym eval run on the five shipped examples) with a reasoning model as policy and judge, then sends 15 live verifier controls (5 identical SQL, 5 different SQL, 5 no SQL):

example_rollouts.jsonl: 5/5 reward 0.0, each judge call status=incomplete, output_tokens=512, verdict_label=None
Judge quality: {"dual_judge_controls": 1, "equivalent_accepted": 0, "different_rejected": 5, "unparsed_judgments": 7}
  judge calls: 7/11 incomplete at 512 tokens with no verdict (all 5 identical-SQL controls)

(An earlier run on 494528232 failed the case outright: dual_judge_controls: 0, unparsed_judgments: 9.)

After the fix

Gym a16ce2911 (this branch, on main 74030391e). The QA run used the same change on main 45ceac060; the two main commits since touch only CI review and sandbox code:

============================== 1 passed ==============================

QA case text_to_sql, same flow with the README's 8192 budget:

Judge quality: {"dual_judge_controls": 5, "equivalent_accepted": 5, "different_rejected": 5, "unparsed_judgments": 0}
PASS   139.4s  all five README SQL examples and live mixed equivalence controls retain the 8192-token swap judge
example_rollouts.jsonl: every judge call status=completed with a verdict (1065-4086 output tokens);
  4/5 reward 1.0 ([[A=B]] from both judges), 1/5 reward 0.0 from a real [[A!=B]]
controls: 15/15 judge calls completed with a verdict (320-2676 output tokens)

Validation

  • QA testcase text_to_sql: before (512) all README rollouts scored 0 with no verdict; after (8192) 1/1, all 24 judge calls reached a verdict. Also run at 8192 a second time (all verdicts, max 3500 tokens) and twice at 4096 (2 of 19 rollout judge calls starved at 4096).
  • pytest tests/unit_tests/test_text_to_sql_readme_config.py: fails on main (512 == 8192), passes on this branch.
  • pytest resources_servers/text_to_sql/tests: 21 passed.
  • pre-commit run --all-files: passed.
  • Rollout evidence: the QA runs above are real README rollouts with a live reasoning model.

Compatibility

Docs and a test only; no config or code default changes. Users who copy the README command now give the judge up to 8192 output tokens, so a reasoning judge costs more per call but returns a verdict. Not changed here: a judge reply with no verdict is still scored as an unmasked reward 0 (app.py:312-313); masking it is a separate decision.

🤖 Generated with Claude Code

@qiaochuz-nv qiaochuz-nv added QA_fix Fix implemented by a QA team member docs Documentation-only updates or documentation debt area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers needs-review PR is ready for code review and waiting on a reviewer complexity:low Localized change in one scope with a small, straightforward review surface labels Oct 26, 2026
@copy-pr-bot

copy-pr-bot Bot commented Oct 26, 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.

@qiaochuz-nv
qiaochuz-nv requested a review from yaoyu-33 October 26, 2026 23:30
@qiaochuz-nv

Copy link
Copy Markdown
Contributor Author

/ok to test a16ce29

@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 — LGTM — no reliability concerns.

Reviewed both changed files and traced CLI configuration resolution through judge request forwarding. The README override reaches the configured policy-model judge without changing policy-generation defaults. The regression test follows the existing replay pattern and checks the resolved budget and judge wiring.

Static review only; tests and live rollouts were not executed.

Note: formal approval is not available for this request, so this review is posted as a comment only.

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

qiaochuz-nv added a commit that referenced this pull request Oct 27, 2026
…ing judge reaches a verdict

The README's `gym env start` gave the judge `max_output_tokens=256`. The judge
is the policy model, so a reasoning policy can spend the whole budget reasoning
and stop `incomplete` before `[[A=B]]`/`[[A!=B]]`, which scores the rollout 0.
Raise the documented budget to 8192 (same value as text_to_sql, #5102) and add
an offline README-replay test that asserts the judge is `policy_model` with
budget 8192.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: qiaochuz <[email protected]>
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Oct 28, 2026
eddy-nassif pushed a commit to youdotcom-oss/NeMo-Gym that referenced this pull request Oct 28, 2026
…ing judge reaches a verdict (NVIDIA-NeMo#5110)

* fix(equivalence_llm_judge): raise the README judge budget so a reasoning judge reaches a verdict

The README's `gym env start` gave the judge `max_output_tokens=256`. The judge
is the policy model, so a reasoning policy can spend the whole budget reasoning
and stop `incomplete` before `[[A=B]]`/`[[A!=B]]`, which scores the rollout 0.
Raise the documented budget to 8192 (same value as text_to_sql, NVIDIA-NeMo#5102) and add
an offline README-replay test that asserts the judge is `policy_model` with
budget 8192.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: qiaochuz <[email protected]>

* test(equivalence_llm_judge): resolve the README replay config offline

Parse with offline=True so the config-only test probes no ports or hosts,
sets up no exporters, and leaves UV_CACHE_DIR/UV_LOCK_TIMEOUT unset in
os.environ. Assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: qiaochuz <[email protected]>

---------

Signed-off-by: qiaochuz <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
…reaches a verdict

The README's `gym env start` gave the judge `max_output_tokens=512`. The judge
is the policy model (`configs/text_to_sql.yaml` sets
`judge_model_server.name: policy_model`), so with a reasoning model as the
policy the judge calls stopped `incomplete` on the 512-token budget before they
wrote the `[[A=B]]`/`[[A!=B]]` marker: verdict None, reward 0, and the
`check_twice_swap` second judge never ran. Following the README on the five
shipped examples scored 0 on every row with no verdict.

Raise the documented budget to 8192. terminus_judge went to 4096 for the same
reason (#4557), but here 2 of 19 rollout judge calls still ran out at exactly
4096 while completed calls reached 3783 tokens; at 8192 every call reached a
verdict (largest 3500).

Add `tests/unit_tests/test_text_to_sql_readme_config.py`, an offline
README-replay test modeled on `test_terminus_judge_readme_config.py`: it runs
the README `gym env start` block through the real CLI with dispatch intercepted,
resolves the config offline with placeholder endpoints (no env.yaml/dotenv), and
asserts the judge is the policy model and the budget is 8192.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: qiaochuz <[email protected]>
@qiaochuz-nv
qiaochuz-nv force-pushed the qiaochuz/reg-20261026-text-to-sql-judge-budget branch from a16ce29 to 2ad2c7c Compare November 7, 2026 07:23
@qiaochuz-nv

Copy link
Copy Markdown
Contributor Author

/ok to test 2ad2c7c

@yaoyu-33 yaoyu-33 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. The README budget override reaches both judge calls without changing policy-generation settings. All 22 focused tests passed.

@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 18, 2026
@github-actions github-actions Bot removed the sla:review-overdue Review response is over the one-business-day SLA label Nov 18, 2026
@yaoyu-33
yaoyu-33 added this pull request to the merge queue Nov 18, 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/44383445064

Merged via the queue into main with commit cf9ee62 Nov 18, 2026
110 of 113 checks passed
@yaoyu-33
yaoyu-33 deleted the qiaochuz/reg-20261026-text-to-sql-judge-budget branch November 18, 2026 19:59

This branch was previously deployed

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

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers complexity:low Localized change in one scope with a small, straightforward review surface docs Documentation-only updates or documentation debt QA_fix Fix implemented by a QA team member 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.

3 participants