Repository navigation
[Fix] Match GLM5.3 mHC pre-mixing precision with HF - #2154
Closed
bingshao333 wants to merge 1 commit into
Closed
bingshao333 wants to merge 1 commit into
bingshao333 wants to merge 1 commit into
Conversation
Select the F4 mHC primitive and regression-test changes from JT-Ushio/xtuner-muonsplit-verify commit a8d798a. Preserve the original author and add type annotations to the new test.
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
The BF16
hc_prepath casts FP32-normalized residual streams back to BF16 and performs the mixing projection in BF16. This introduces rounding before the Sinkhorn split, so the collapsed streams and input/parameter gradients can diverge from Hugging Face's FP32 reference.Keep both the unweighted RMS normalization and mixing projection in FP32, then cast the collapsed stream back to the activation dtype. This is an F4 follow-up to #2107, targeting
feat/glm53flash-f4-mhcfor merge before the upper stack layers are restacked.Changes
hc_fn.float()insidehc_pre.Validation
pytest tests/model/test_glm53_mhc.py -q: 10 passed, 2 skipped. Both skipped cases require CUDA.6841448), both newly added CPU precision regressions fail; both pass with this fix.git diff --checkpasses.autotest/files; the identical formatting changes were reproduced on the unchanged F4 base.Local validation uses PyTorch 2.9.1 and Transformers 5.17.0 on CPU. This restores reference arithmetic in a performance-sensitive projection; GPU throughput and complete-model training were not measured in this environment.