Add routed-expert MXFP4 QAT for Hy3 - #2
Open
ISEEKYAN wants to merge 13 commits into
Open
Conversation
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
ImplConfig.qatQuantization scope
The policy matches K3: quantize every routed-path linear and no other component. The concrete structures differ:
fc1.weightKis the fused gate-plus-up projection for local expertK;fc2.weightKis its down projection.experts.K.gate_up.weightandexperts.K.down.weight.routed_expert_down_projandrouted_expert_up_projlinears and has a routed-expert norm. Hy3 has no equivalent latent bottleneck or norm.Kis the local-expert index because Megatron Lite passesnum_experts / ep_sizeto each Transformer EngineGroupedLinear.Attention, dense MLP, shared experts, embedding, router/correction bias, and
lm_headremain BF16. Hy3 also has no K3-style standalone attention residual-projection modules: its attention output projection is excluded underattn, while residual additions have no parameters.The Hy3 declaration therefore matches exactly
moe.experts.fc1/fc2modules and parameters namedweightfollowed only by digits. This covers every local expert tensor without matching similarly named non-weight state.Validation
fc1/fc2.weightKset; the two-expert tiny model has exactly 4 mastersThe repository currently has no
.pre-commit-config.yamlor pinned Ruff version. The equivalent Ruff check and changed-file format checks were run directly without reformatting unrelated pre-existing files.