Skip to content

Fix MXFP8 MoE weight sizing for non-gated models - #36097

Open
elvischenv wants to merge 1 commit into
sgl-project:mainfrom
elvischenv:nemotron-mxfp8-acc-fix
Open

Fix MXFP8 MoE weight sizing for non-gated models#36097
elvischenv wants to merge 1 commit into
sgl-project:mainfrom
elvischenv:nemotron-mxfp8-acc-fix

Conversation

@elvischenv

@elvischenv elvischenv commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Problem

create_fp8_moe_weight_ hardcoded is_concat=True, so w13 was always sized as
2 * intermediate (gate + up). Non-gated MoEs fuse only up into w13, leaving the
upper half as uninitialised torch.empty that no weight loader writes.

NemotronH (relu2, checkpoint has up_proj/down_proj and no gate_proj) is the
only MoE model in sglang with is_gated=False.

Fix

Derive is_concat from the layer's gating.

Result

Nemotron-3-Ultra-550B, GB300, TP8, --quantization mxfp8, gsm8k 5-shot:

flexible-extract strict-match
bf16 (reference) 0.9424 0.9386
mxfp8 before 0.0660 0.0637
mxfp8 after 0.9447 0.9424

Isolated by leaving the MoE in bf16 while keeping dense mxfp8, which scored 0.9439
and pointed at the MoE path.

Test

test_fp8_moe_weight_gating.py (CPU, ~1.5s) covers the sizing primitive and the
call site. Fails on the unfixed tree, passes with the fix.


CI States

Latest PR Test (Base): ❌ Run #32649456510
Latest PR Test (Extra): ❌ Run #32649456361
Latest PR Test (AMD ROCm 7.2): ❌ Run #32649456507

create_fp8_moe_weight_ hardcoded is_concat=True, so w13 was always sized as
2 * intermediate (gate + up). Non-gated MoEs fuse only up into w13, leaving the
upper half as uninitialised torch.empty that no weight loader writes.

NemotronH (relu2, checkpoint has up_proj/down_proj and no gate_proj) is the only
MoE model in sglang with is_gated=False. It scored 0.066 gsm8k under
--quantization mxfp8 versus 0.943 in bf16; with this fix it scores 0.945.

Derive is_concat from the layer's gating instead.

Add a CPU unit test covering both the sizing primitive and the call site. It
fails on the unfixed tree and passes with the fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant