fix(reward): extract boxed answer in RLPR WebInstruct math grading (#170)#61
Open
galuis116 wants to merge 1 commit into
Open
fix(reward): extract boxed answer in RLPR WebInstruct math grading (#170)#61galuis116 wants to merge 1 commit into
galuis116 wants to merge 1 commit into
Conversation
galuis116
force-pushed
the
sn74-galuis116-agreement-diagnostic
branch
from
July 12, 2026 04:00
a25eacc to
6698b45
Compare
_check_rlpr_webinstruct fed the raw candidate text into math_equal without
extracting the answer, unlike _check_math. Since normalize_math_answer doesn't
strip \boxed{...}, a correct boxed answer (the format the worker is told to use)
scored 0: score_text('rlpr', r'The area is \boxed{15}.', {...'15'...}) returned
0.0 while the same answer under math500 returned 1.0.
Extract extract_boxed(cand) or extract_last_number(cand) or cand (and
extract_boxed(gold) or gold) before comparing, mirroring _check_math. Adds
offline tests/test_rlpr_webinstruct_math.py; 47 existing rlpr/reward tests pass.
Distinct from the RLPR MMLU-Pro choice issues (mini-router#116/mini-router#122). Logs in docs/JOURNAL.md.
galuis116
force-pushed
the
sn74-galuis116-agreement-diagnostic
branch
from
July 13, 2026 07:22
6698b45 to
29ea75b
Compare
Contributor
Author
|
Note: I've repurposed this PR onto a distinct, self-contained fix — RLPR WebInstruct math grading now extracts |
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.
Closes #170
Summary
_check_rlpr_webinstructinsrc/trinity/orchestration/reward.pygrades WebInstruct-verified RLPR items. For a math answer it fed the raw candidate text intomath_equal/normalize_math_answerwithout first extracting the answer — unlike_check_math, which usesextract_boxed/extract_last_number. Sincenormalize_math_answerdoes not strip\boxed{...}, a correct boxed answer (the formatformat_hint("rlpr")tells the worker to use) scored 0.What Changed
src/trinity/orchestration/reward.py: extract the answer before the math compare —cand_math = extract_boxed(cand) or extract_last_number(cand) or cand,gold_math = extract_boxed(gold) or gold— mirroring_check_math.tests/test_rlpr_webinstruct_math.py(new, offline): boxed answer scores 1.0, plain number still works, wrong boxed scores 0, the letter path is unchanged, and RLPR agrees with the math path on a boxed answer.docs/JOURNAL.md: entry per repository protocol.Why This Matters
Every WebInstruct-verified RLPR math item answered in the requested
\boxed{...}format was a false negative, understating accuracy and corrupting the reward signal for those items. Verified offline: the new tests fail on the old code and pass on the fix; 47 existing rlpr/reward tests still pass.Notes