Skip to content

fix(math-with-judge): accept whitespace in verdict markers - #4151

Merged
bxyu-nvidia merged 1 commit into
mainfrom
codex/math-judge-verdict-whitespace
Oct 8, 2026
Merged

bxyu-nvidia merged 1 commit into
mainfrom
codex/math-judge-verdict-whitespace

Conversation

@Kipok

@Kipok Kipok commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Accept whitespace inside the existing [[A=B]] and [[A!=B]] math-judge markers. Normalize only a temporary parsing string, leaving stored judge responses unchanged. Keep the existing first-marker rule and two-direction agreement requirement.

This is a focused parser bug fix; no separate issue is needed. Well-formed markers retain their behavior. Spaced equal markers can now trigger the reverse check, so affected scores can change. This does not add fuzzy verdict matching or normalize other environments' verdict formats.

Validation

  • 47 tests passed: tests/unit_tests/test_judge.py and resources_servers/math_with_judge/tests/test_app.py on Python 3.13.14.
  • pre-commit run --all-files: passed.
  • git diff --check: passed.
  • Tests cover whitespace/newlines, rejected malformed markers, both marker orderings in normalization, preserved raw evidence, and disagreement on the reverse check.

Draft for author review. The change originated from offline profiling; no fresh real-model smoke was launched against this rebased revision. That validation remains required before marking ready. No private data or deployment paths are included.

@Kipok Kipok added bug Something isn't working area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers labels Oct 7, 2026
@copy-pr-bot

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

@Kipok
Kipok marked this pull request as ready for review October 7, 2026 00:57
@yaoyu-33 yaoyu-33 added complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer labels Oct 7, 2026
@github-actions github-actions Bot added the sla:triage-overdue Review assignment is over the one-business-day SLA label Oct 8, 2026
@bxyu-nvidia

Copy link
Copy Markdown
Contributor

/ok to test cc99e97

@copy-pr-bot

copy-pr-bot Bot commented Oct 8, 2026

Copy link
Copy Markdown

/ok to test cc99e97

@bxyu-nvidia, there was an error processing your request: E2

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/

@bxyu-nvidia
bxyu-nvidia enabled auto-merge October 8, 2026 16:43
@bxyu-nvidia

Copy link
Copy Markdown
Contributor

/ok to test cc99e97

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

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

Merged via the queue into main with commit 6d0cb9f Oct 8, 2026
51 checks passed
@bxyu-nvidia
bxyu-nvidia deleted the codex/math-judge-verdict-whitespace branch October 8, 2026 17:16
ananthsub pushed a commit to jiwasawa/Gym that referenced this pull request Oct 8, 2026
)

## Summary

Use the last recognized `[[A=B]]` / `[[A!=B]]` marker in the existing
final `output_text` block instead of the first. This allows explicit
judge self-corrections such as `different [[A!=B]] ... Final: [[A=B]]`
to determine the per-call verdict.

This is an intentional scoring-policy change, separate from whitespace
normalization in NVIDIA-NeMo#4151. It targets current main independently; it does
not include that patch or change the accepted marker syntax. Both
changes can compose: normalize the selected text, then select the last
marker.

## Preserved behavior

- Only the existing last message / last output-text block is parsed.
Reasoning items are not scanned; this does not concatenate earlier
messages or content blocks.
- No recognized marker still means unequal. Single-marker and
repeated-identical-marker answers keep their meaning.
- The two-order agreement rule is unchanged. If the first-order verdict
becomes positive, Gym must perform the reverse-order call; a negative or
missing reverse verdict still yields zero.
- Stored judge responses remain unchanged. No saved profiles or
historical scores are rewritten.

Conflicting-marker responses can now change the reward or the number of
judge calls. In particular, a saved negative-first response cannot
simply be rescored positive offline if its reverse-order evaluation is
missing. Pin the Gym revision when comparing benchmark results.

## Validation

- 36 math environment tests passed on Python 3.13.14, using the existing
math environment venv and explicitly binding the resources-server
namespace to this worktree (verified implementation path).
- Updated the two existing first-marker expectations and added tests for
both correction directions, both reverse-check outcomes, corrections in
the reverse response, repeated identical markers, missing markers,
ignored reasoning summaries, raw-text preservation and swapped answer
order.
- Replayed two saved real-model self-corrections through the changed
parser: both per-call decisions change from negative to positive, with
unchanged response objects. No model calls or final two-order reward
claims were made in that replay. Private prompts and records are not
included in this PR.
- `pre-commit run --all-files`: passed after formatting.
- `git diff --check`: passed.

Draft for author review. A fresh real-model smoke on this revision
remains outstanding before marking ready; offline replay and unit tests
are not a substitute. This focused PR serves as the change proposal, so
no separate issue is needed. Prior math parsing work (NVIDIA-NeMo#3095) and its
discussion were reviewed; answer extraction and formatting rules remain
unchanged.

Signed-off-by: Igor Gitman <[email protected]>

This branch was previously deployed

1 inactive deployment
public — cc99e978 Deployed Oct 8, 2026 by copy-pr-bot[bot] via release / finalize / notify #4733
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 bug Something isn't working complexity:low Localized change in one scope with a small, straightforward review surface needs-review PR is ready for code review and waiting on a reviewer sla:triage-overdue Review assignment is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants