Plumb rl.loss_agg_mode to tunix GrpoConfig#4025
Open
py4 wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
tunix's GrpoConfig defaults loss_agg_mode to 'sequence-mean-token-mean', but GPU NeMo-RL stacks use 'token-mean'. With group-normalized advantages the two modes produce materially different losses, breaking GPU<->TPU recipe parity. Adds the field to the RL Pydantic schema + rl.yml default + passes it through to GrpoConfig construction so users can override via cmdline: 'rl.loss_agg_mode=token-mean'.
0d7759b to
ff7eb45
Compare
Collaborator
Author
|
Updated both |
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.
tunix's
GrpoConfigdefaultsloss_agg_modeto'sequence-mean-token-mean', but GPU NeMo-RL stacks use'token-mean'. With group-normalized advantages the two modes produce materially different losses (~10× gradient magnitude difference), breaking GPU↔TPU recipe parity when reproducing a GPU recipe on TPU.This PR exposes the existing tunix knob via the maxtext RL config so users can override on the cmdline:
rl.loss_agg_mode=token-mean.Changes:
rl.loss_agg_mode(Literal:"token-mean","sequence-mean","sequence-mean-token-mean")'sequence-mean-token-mean'inrl.ymlmatches tunix's default → backward compatible (no behavior change for users who don't set it)GrpoConfig(...)construction intrain_rl.pyEmpirical impact (Qwen3-1.7B GRPO on GSM8K, GPU recipe LR=2e-6 β=0.04, 50 outer steps):
sequence-mean-token-mean): grad_norm ~0.5 → underflows, training stallsrl.loss_agg_mode=token-mean: grad_norm ~5 → matches GPU stack, training converges normallyChecklist