Skip to content

fix(rm): stop double-extracting boxed answers for boxed_math - #2357

Open
YeonwooSung wants to merge 1 commit into
THUDM:mainfrom
YeonwooSung:fix/543-boxed-math
Open

fix(rm): stop double-extracting boxed answers for boxed_math#2357
YeonwooSung wants to merge 1 commit into
THUDM:mainfrom
YeonwooSung:fix/543-boxed-math

Conversation

@YeonwooSung

Copy link
Copy Markdown

Problem

rm_type="boxed_math" pre-strips \boxed{} in async_rm, then grade_answer_verl looks for \boxed{} again. Extraction returns None, 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_verl is unchanged: unboxed strings still fail (grade_answer_verl("just 42", "42") is False).

Test plan

CPU tests (NUM_GPUS = 0) in tests/test_rm_boxed.py:

  • async_rm with rm_type="boxed_math", response Answer: \boxed{5}, label 5 → reward 1
  • same with wrong label → 0
  • rm_type="math" still requires \boxed (unboxed "5" vs "5" → 0)
  • boxed_math with no boxed content → 0
python -m pytest tests/test_rm_math.py tests/test_rm_boxed.py -q --tb=short

36 passed.

Fixes #543

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
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.

grade_answer_verl fails when rm_type="boxed_math" strips the \boxed{} wrapper upstream

1 participant