Repository navigation
[megatron] fix: allow sequence-mean loss with per-token normalization - #7915
Merged
wuxibin89 merged 1 commit intoSep 18, 2026
Merged
Conversation
Remove the overly restrictive aggregation guard described in verl-project#7914. Co-authored-by: OpenAI Codex <noreply@openai.com> Signed-off-by: Zhikaiiii <1658973216@qq.com>
Zhikaiiii
requested review from
HollowMan6,
ISEEKYAN and
vermouth1992
as code owners
September 18, 2026 04:01
wuxibin89
approved these changes
Sep 18, 2026
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.
What does this PR do?
Fixes #7914 by removing the
seq-mean-token-meanrejection in the Megatron per-token loss callback. The guard rejects CP=1 whencalculate_per_token_loss=True, and also blocks static-CP THD training even though the forward path reconstructs full-sequence outputs before PPO loss computation.Checklist Before Starting
API and Usage Example
No API changes.
loss_agg_mode=seq-mean-token-meanno longer triggers this rejection whencalculate_per_token_loss=True.Design & Code Changes
Deletes only the aggregation-mode guard and its explanatory comment from
postprocess_micro_batch_func(13 lines). The existing normalization logic and other validation remain intact.AI assistance (OpenAI Codex) was used for analysis, implementation, checks, and PR preparation under the issue author's direction.
Checklist Before Submitting