[tml] fp32 MoE activation and combine for bf16 inference alignment - #68
Merged
Conversation
Zhichenzzz
marked this pull request as ready for review
July 15, 2026 18:48
Two opt-in TransformerConfig knobs for MoE numerical precision on the routed-expert path, needed to match reference inference numerics for models trained with fp32 expert internals: - moe_activation_in_fp32: compute the inter-GEMM swiglu (x probs) in fp32 via _MoEActivationInFP32 (custom fwd/bwd), with a single rounding back to the params dtype. Grouped-GEMM path only. - moe_combine_in_fp32: carry routing probs into the combine un-rounded and accumulate expert outputs in fp32, one final round. Both default False and assert bf16/fp16 (no fp8/fp4), no fused permute, and fp32 router dtype for combine, so existing configs are unaffected.
Zhichenzzz
force-pushed
the
inkling-support
branch
from
July 30, 2026 00:05
b6537e4 to
7fd80da
Compare
yueming-yuan
approved these changes
Jul 30, 2026
This was referenced Aug 5, 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.
Two opt-in
TransformerConfigknobs for MoE numerical precision on the routed-expert path, needed to match reference inference numerics for models trained with fp32 expert internals (e.g. Inkling):moe_activation_in_fp32— compute the inter-GEMM swiglu (× probs) in fp32 via_MoEActivationInFP32(custom forward/backward), with a single rounding back to the params dtype. Grouped-GEMM path only.moe_combine_in_fp32— carry routing probs into the combine un-rounded and accumulate expert outputs in fp32, with one final round.Both default
False. Guard asserts: bf16/fp16 only (no fp8/fp4), no fused permute/unpermute, and--moe-router-dtype fp32for combine. Existing configs are unaffected.Rebased on latest
miles-main; the NVMe optimizer store and checkpoint changes that used to live in this PR have been dropped from its scope.