Mask replay for GRPO - #254
Open
vx120 wants to merge 6 commits into
Open
Conversation
Signed-off-by: vx120 <893600387@qq.com>
Signed-off-by: vx120 <893600387@qq.com>
Signed-off-by: vx120 <893600387@qq.com>
Signed-off-by: vx120 <893600387@qq.com>
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Signed-off-by: vx120 <893600387@qq.com>
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.
This PR adds sampling replay for selective log-probability computation.
During rollout, the sampler records the token support used at each generation step. During training, sampling replay reconstructs log-probabilities over the same support instead of recomputing them over a potentially different distribution. This better aligns the rollout and training policies.
Results
Reward is comparable with and without replay, with a small improvement when replay is enabled:
mean train/total_rewardThe reward curves show similar
total_reward,accuracy_reward, andformat_rewardtrajectories in both settings. Replay preserves reward quality and is slightly better at the final rollout.mean importance_ratio_meanmean logp_diff_meanimportance_ratio_meanmeasures the average ratio between the training-time and rollout-time probabilities of sampled tokens. The ideal value is1.0.logp_diff_meanmeasures the average difference between training-time and rollout-time token log-probabilities. The ideal value is0.0.With replay enabled, the importance ratio stays tightly centered around
1.0, while the log-probability difference remains much closer to0.0. This reduces rollout/training mismatch and provides a more stable optimization signal, which should be beneficial for longer training runs.