Skip to content

[NVBug 6899737] Score only the final boxed answer in math_with_judge verify #4514

Open

Description

@qiaochuz-nv

Queue rank 26/48 · Difficulty 3/5 · Status on main: not_fixed

NVBug: https://nvbugspro.nvidia.com/bug/6899737 · Priority: Unprioritized (QA suggests P2) · ARB: Ananth Subramaniam
GitHub: none found (only unrelated benchmark PRs)

Summary

With should_use_judge: false, math_with_judge verify() concatenates every assistant message with "".join and sends the whole transcript to math-verify. math-verify 0.8.0 (via latex2sympy2_extended 1.10.2) keeps earlier \boxed{} spans within ~10 chars of the final box and scores them as a set, so a correct final \boxed{} preceded by a different box scores 0.0. Multi-message agents (ReWOO, parallel thinking) hit this structurally; single-message self-corrections can too.

Reproduction

Deterministic, offline, no GPU. From the Gym root (venv at resources_servers/math_with_judge/.venv), run repro script A: two messages \boxed{5} then \boxed{-3}, gold -3, give reward=0.0 extracted_answer='{-3, 5}'; the final message alone gives 1.0.

Root cause

resources_servers/math_with_judge/app.py:209 builds combined_response = "".join(assistant_responses); _verify_answer (:230) extracts boxed_answer = _extract_last_boxed_answer(...) for the no-answer guard and judge, but :234 calls _verify_answer_with_library_async(expected_answer, generated_answer) on the full transcript, not the last box. Changing the join separator does not help (the merge window is char-distance based).

Status on main (not_fixed)

HEAD 75bb53e. app.py:209 and :234 unchanged. git log 0c838b07..HEAD and 8555fc3c..HEAD on app.py return no commits; last touches were #4151/#4155 (verdict parsing), not verify logic. requirements.txt still pins math-verify==0.8.0.

Proposed fix

In _verify_answer, pass the already-extracted last box to the library: self._verify_answer_with_library_async(expected_answer, "\\boxed{" + boxed_answer + "}"). One-line change; aligns library path, guard and judge on one answer. Note the semantics decision (last-box vs math-verify multi-box) for maintainers; a deliberate multi-box case drops 1.0→0.0, with a reflection trade-off. Add unit tests in tests/test_app.py: two messages \boxed{5}/\boxed{-3} gold -3; ReWOO shape; single-message self-correction. Existing test_verify split-message case stays 1.0.

Validation

Re-run resources_servers/math_with_judge/tests/test_app.py. QA testcases testcases/environments/langgraph_rewoo_math.py and langgraph_parallel_thinking_math.py only check score consistency; do NOT add a fixed reward-threshold assertion (conflicts with the suite's "model quality is not a fixed threshold" design). Instead add a deterministic multi-message gold/wrong control that exercises the "".join merge (current controls use a single message and never hit the join).

Triage

Difficulty 3/5 — one-line code change, but a verifier-semantics/contract decision that flips rewards both ways, needing maintainer sign-off plus new unit tests and QA edits across two repos. Needs GPU/model: no.

Reviewer notes

Verifier confirmed not_fixed (app.py:209/230/234 live, math-verify==0.8.0 pinned) and raised difficulty 2→3 because the fix is a two-way reward-flipping contract decision with cross-repo tests. Validation corrected: drop the reward-threshold assertion (conflicts with the suite design) and instead add a deterministic multi-message gold/wrong control exercising the join.

Activity

  1. ankit373 commented on Nov 10, 2026

    @ankit373

    i'd like to take this, will send the fix with a test shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions