fix(rm): stop double-extracting boxed answers for boxed_math - #2357
Open
YeonwooSung wants to merge 1 commit into
Open
fix(rm): stop double-extracting boxed answers for boxed_math#2357YeonwooSung wants to merge 1 commit into
YeonwooSung wants to merge 1 commit into
Conversation
Skip the generic boxed_ pre-extract for math, dapo, and deepscaler,
which already extract \boxed{} themselves. Pre-stripping made
grade_answer_verl miss the answer and score a correct boxed_math
response as 0.
Fixes THUDM#543
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
rm_type="boxed_math"pre-strips\boxed{}inasync_rm, thengrade_answer_verllooks for\boxed{}again. Extraction returnsNone, so a numerically correct answer is scored 0.This is the same bug as #543. Prior PR #1246 was closed unmerged during the Dec 30 2025 review purge.
Approach
Skip the generic
boxed_pre-extract when the remaining type already extracts boxed answers itself:math,dapo,deepscaler.Keep pre-extract for types that do not extract boxed (
f1,gpqa, etc.).grade_answer_verlis unchanged: unboxed strings still fail (grade_answer_verl("just 42", "42") is False).Test plan
CPU tests (
NUM_GPUS = 0) intests/test_rm_boxed.py:async_rmwithrm_type="boxed_math", responseAnswer: \boxed{5}, label5→ reward 1rm_type="math"still requires\boxed(unboxed"5"vs"5"→ 0)boxed_mathwith no boxed content → 036 passed.
Fixes #543