Use one accuracy-compatible mode for model and optimizer numerics - #17
Merged
Merged
Conversation
Preserve existing gradient ownership groups while making the FP32 norm independent of layout and partition order. Signed-off-by: Zhan Rongrui <me@zrr.dev>
This was referenced Sep 15, 2026
Signed-off-by: Zhan Rongrui <me@zrr.dev>
Signed-off-by: Zhan Rongrui <me@zrr.dev>
zrr1999
marked this pull request as ready for review
September 16, 2026 02:00
This was referenced Sep 16, 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?
Use
use_accuracy_compatibleas the single mode for reference model numerics, AdamW selection and reproducible gradient clipping. Remove the separate norm, router, DSA, native-unfused-AdamW and reproducible-norm options. DSA-specific behavior follows the model architecture through a read-only derived property; ordinary training retains its existing fast implementations.The reproducible L2 norm accumulates FP32 squares in integer bins using existing dense/expert ownership groups, then rounds once before the square root. Clipping remains disabled when the configured threshold is zero. Optimizer selection now happens once instead of choosing an implementation and overriding it later.
Validation:
formal-ci-followup-20260915-n100-r1: all 100 loss values are IEEE bit-identical, provenance passes, and both canonical safetensors checkpoints match. Each side also matches its prior accepted 100-step loss and checkpoint. GLM4.5 native EP2 10-step regression has 40/40 matching loss hashes and matches the previous baseline on both sides. Local receipts:experiments/ops/ci-followup-20260915/terminal.jsonandglm45-pair-r0/comparison.json. Frozen repository pins, existing completion-required items and the incomplete native-build snapshot remain unresolved; this is candidate acceptance, not complete + sealed or remote-CI acceptance.Issue tracking
For PRs from open-source community contributors:
Related failure: https://github.com/PaddlePaddle/PaddleFleet/actions/runs/34816312836/job/103892378045?pr=1961
Companions: Swift accuracy-mode integration and PaddleFleet GLM4.5 case. Reference wheels must include these changes before rerunning the accuracy job.
Contribution process
Pre-checks
Code review
Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!
All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.
Step 1: Mark PR as "Ready for Review"
.github/CODEOWNERS.Final Review might get declined if these requirements are not fulfilled.
Step 2: Final Review
For PRs that change
megatron/core, once all expert reviewers have approved, theFinal Reviewlabel is applied automatically and final reviewers are assigned.For PRs outside
megatron/core, this step is skipped.Step 3: Approved
Once all required reviewers have approved, the
Approvedlabel is applied automatically.Merge
Any member of mcore-engineers will be able to merge your PR.