Repository navigation
fix(rm_hub): grade the final ###Response segment in deepscaler reward - #2116
SuperMarioYL wants to merge 1 commit into
Conversation
The deepscaler rule-based reward splits the response on the answer marker and grades the segment after it. The </think> branch takes the last segment ([-1]), but the ###Response branch took the second segment ([1]). When a response contains more than one ###Response marker (e.g. the model echoes the marker in its reasoning before emitting the final answer), [1] grades a middle segment instead of the final answer, so a correct answer in the last segment is silently scored 0 — a wrong RL reward signal. Take [-1] for the ###Response branch too, so both branches grade the final segment. Add regression tests pinning last-segment grading and cross-branch consistency.
|
Gentle ping on this one — it's been open a couple of weeks with CI green (28 checks passing, no conflicts). The fix is narrow: |
|
Gentle ping — happy to rebase or address any concerns. |
|
Gentle ping on this fix — grading the final |
|
Closing this to stop nudging a queue that clearly has no bandwidth for it. The fix is narrow and all checks are green; if the deepscaler reward path is ever revisited I'm glad to reopen or resubmit. Thanks. |
What
get_deepscaler_rule_based_rewardsplits the model response on the answermarker and grades the segment that follows it. The two marker branches were
inconsistent:
The
</think>branch takes the last segment ([-1]), but the###Responsebranch takes the second segment ([1]). When a responsecontains more than one
###Responsemarker — e.g. the model echoes themarker inside its reasoning before emitting the final answer —
[1]grades amiddle segment instead of the final answer. A correct answer in the last
segment is then silently scored
0, i.e. a wrong RL reward signal that noother CI check would surface.
Reproduction
Fix
Take
[-1]for the###Responsebranch as well, so both branches grade thefinal segment. This matches the
</think>branch and the contract alreadydocumented in
tests/test_rm_deepscaler.py("only what comes after isgraded"). The single-marker case is unchanged (
split(...)[1] == split(...)[-1]when there is exactly one marker), so existing behavior is preserved.
Tests
Added two regression tests to the existing CPU unit suite
(
tests/test_rm_deepscaler.py, already in thecpu-unittestCI matrix):test_response_split_on_response_marker_grades_last_segment— multiple###Responsemarkers grade the final segment; the wrong intermediate answeris not graded. (Red before this change, green after.)
test_think_and_response_markers_agree_on_last_segment— the two markerbranches pick the same final segment regardless of which separator the chat
template emits.
All 12 tests in the file pass;
ruff check,ruff format, andisortareclean.
This change is orthogonal to the missing-response guard in #2115 (which adds a
check above these branches and does not touch the split index), so the two do
not conflict.