[Refactor] Remove unused world_size plumbing#1964
Draft
HAOCHENYE wants to merge 1 commit into
Draft
Conversation
After the reduce-sum switch, the z-loss global-average branch no longer scales by world_size and the balancing loss no longer uses all_reduce_autograd, so the associated plumbing is dead. Remove it to leave one coherent model: - ZLossContext.accumulate / AuxLossContext.accumulate drop the world_size arg. - MoE._z_loss_dist_token_count returns just num_tokens_global (no world_size), and its call sites in moe.py / qwen3vl_text.py are updated. - Delete the now-unreferenced all_reduce_autograd / _AllReduce autograd function and its all_reduce import from moe_loss. Pure signature/dead-code cleanup: no change to loss values or gradients.
HAOCHENYE
force-pushed
the
reduce-sum-03-switch-sum
branch
from
July 17, 2026 08:11
51c5491 to
590c9e7
Compare
HAOCHENYE
force-pushed
the
reduce-sum-04-remove-world-size
branch
from
July 17, 2026 08:11
006ac3c to
4f4db55
Compare
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 (4/5) — behavior-neutral cleanup. Removes the now-dead
world_sizeplumbing (ZLossContext/AuxLossContext.accumulateparams,_z_loss_dist_token_count) and the unreferencedall_reduce_autograd/_AllReduce.Full stack (merge bottom-up, under #1959):
reduce-sum-01-fsdp-helper— [FSDP] Add reduce-sum gradient reduction helperreduce-sum-02-split-logging— [Loss] Split logging loss from backward lossreduce-sum-03-switch-sum— [FSDP][Loss] Switch gradient reduction to SUMreduce-sum-04-remove-world-size— [Refactor] Remove unused world_size plumbingreduce-sum-05-drop-nonglobal— [Refactor] Drop non-global aux-loss averaging mode