Skip to content

Fix math with judge parsing and formatting - #3095

Merged
bxyu-nvidia merged 1 commit into
mainfrom
smahdavi/fix-math-judge
Sep 4, 2026
Merged

bxyu-nvidia merged 1 commit into
mainfrom
smahdavi/fix-math-judge

Conversation

@smahdavi4

@smahdavi4 smahdavi4 commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Forces having \boxed values in the response.
  • Passes the value inside \boxed to the judge instead of the parsed sympy value.

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, or N/A for docs-only / non-code changes (so CI unit/server checks pass when applicable).
  • Pre-commit checks pass locally (pre-commit run --all-files) (so CI lint/format/copyright pass).
  • All commits have DCO sign-off (git commit -s) (so the DCO check passes).

@copy-pr-bot

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

@bxyu-nvidia

Copy link
Copy Markdown
Contributor

/ok to test b85239f

@bxyu-nvidia
bxyu-nvidia merged commit a7c2e16 into main Sep 4, 2026
40 checks passed
@bxyu-nvidia
bxyu-nvidia deleted the smahdavi/fix-math-judge branch September 4, 2026 21:54
jkyi-nvidia pushed a commit that referenced this pull request Sep 11, 2026
<!-- Thanks for contributing to NeMo Gym! Please fill out the sections
below. -->

## What does this PR do?

* Forces having \boxed values in the response.
* Passes the value inside \boxed to the judge instead of the parsed
sympy value.

## Checklist

- [x] I have read the [contributing
guidelines](https://docs.nvidia.com/nemo/gym/latest/contribute/development-setup).
- [x] The change is focused; unrelated "drive-by" edits are tracked as
separate issues/PRs.
- [x] Tests added or updated and pass locally, or N/A for docs-only /
non-code changes (so CI unit/server checks pass when applicable).
- [x] Pre-commit checks pass locally (`pre-commit run --all-files`) (so
CI lint/format/copyright pass).
- [x] All commits have DCO sign-off (`git commit -s`) (so the DCO check
passes).

Signed-off-by: Sadegh Mahdavi <[email protected]>
Signed-off-by: Junkeun Yi <[email protected]>
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 — b85239f5 Deployed Sep 4, 2026 by copy-pr-bot[bot] via release / finalize / notify #2609
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.

3 participants