Repository navigation
Conversation
|
The following ciflow label(s) have been added but CI has not been triggered yet because the workflows are awaiting approval:
Once a maintainer approves the workflows (scroll to the bottom of the PR page), the corresponding CI jobs will be triggered automatically. Please ping one of the reviewers if you do not have access to approve and run workflows. |
This was referenced Dec 1, 2026
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.
Summary (human-written)
Why
ChunkedLossWrapperruns the untied language-model head after decoder forward and finishes its backward before decoder backward. FSDP currently manages the final norm and head in one unit. The norm backward can therefore gather the full head weight after the loss has already completed the head gradients. In the always-reshard policy, entering the loss can also repeat the head gather that was prefetched by the last decoder block.For an untied head with eager chunked loss, explicit prefetch and always resharding, the 0.4 comparison observes these gathers per microbatch.
What changed
Give the final norm and untied head separate FSDP lifetimes for eager chunked-loss training without pipeline parallelism. Keep the existing forward prefetch targets and anchor the last decoder block's backward prefetch to the final norm. Tied models, eager unchunked loss, and the PP and accelerator-graph paths retain their existing grouping. The model, projections, loss, and checkpoint keys remain the same.
Numerics and testing
main@cc020983a483, the four-rank Gloo production-path regression verifies that the head consumes exactly one all-gather in the explicitly prefetched path. Loss and all local gradients match the shared-group control bitwise.ScheduleGPipe.register_post_metadata_inference_cleanupin the local PyTorch 2.15 CPU build on both the main control and the candidate. The PP configuration keeps the existing grouping.Eight-device training performance on the 0.4 backport
An independent sequential control/candidate pair used eight Ascend 950DT devices, EP8/FSDP8, sequence length 16,384, accumulation 24, the full 163,840-token vocabulary, eight loss chunks and the same activation checkpoint policy. Both arms completed 12 steps. Steps 6–12 use the slowest rank for each update.
The split head was faster at all seven matched steady steps, saving a mean 0.376 seconds per update and increasing MFU by 0.237 percentage points. The FSDP group probe confirmed the selected grouping on every rank and was removed after verification. Both arms had zero allocation retries and OOMs. Across 96 matched rank-step measurements, token counts and global gradient norms were identical and the maximum absolute global loss difference was 0.000136.
Earlier work explored separate grouping together with a different autograd treatment in #3229. This patch uses the current partial-backward behavior introduced by #5563.