Compare the non-additive R1 format gate against r1_style_format_reward - #1917
Open
shaurya416 wants to merge 3 commits into
Open
shaurya416 wants to merge 3 commits into
shaurya416 wants to merge 3 commits into
Conversation
RewardConfig.build() zeroed the verifiable reward of every response whose format score was not exactly 1, but the format score is r1_style_format_reward on a match. With any value other than 1.0 (for example 0.5), correctly formatted responses were scored 0 whenever additive_format_reward is False. Adds regression tests for default, 0.5 and 2.0 format rewards, matching and non-matching responses, and a mixed batch.
This branch has not been deployed
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.
Fixes #1915
RewardConfig.build()scores a response asraw_score if format_scores[i] == 1 else 0whenapply_r1_style_format_rewardis on andadditive_format_rewardis off.format_scorescomes fromsoft_format_reward_func(decoded_responses, self.r1_style_format_reward), so a matching response scoresr1_style_format_reward, not 1. With any value other than 1.0 (for example 0.5), every correctly formatted response had its verifiable reward zeroed.The gate now compares against
self.r1_style_format_reward. With the default of 1.0 the behaviour is unchanged.Tests
Adds
TestRewardConfigNonAdditiveFormatGatetoopen_instruct/test_ground_truth_utils.py: format reward 1.0 (matching and non-matching, unchanged behaviour), 0.5 (matching and non-matching), 2.0 (matching), and a mixed batch.RewardConfigand its helpers with the verifier call stubbed: 3 of the 6 tests fail on currentmain(0.5 matching, 2.0 matching, mixed batch) and all 6 pass with this change.ruff checkandruff format --checkpass on the two changed Python files.uv run pytestsuite locally.CHANGELOG entry is included. No GPU code path is touched.
GPU_TESTS=bypass