Conversation
… `exclude`
OneNexus/GLM-5.3-Flash-MXFP4 cannot be loaded today: weight loading dies with
AssertionError: param_data.shape=torch.Size([128, 512]),
loaded_weight.shape=torch.Size([128, 1024])
in `load_qkv_weight`. The 2x width is an MXFP4-packed parameter (two values per
byte) meeting an unpacked BF16 weight, i.e. a layer the checkpoint excluded from
quantization was quantized anyway.
`should_ignore_layer` only ever consults `exclude` after rewriting a fused
module name into its shards. That misses two shapes this checkpoint uses:
1. Already-fused modules named directly. The vision tower ships
`visual.blocks.N.attn.qkv_proj` as ONE tensor and all 125 such names appear
verbatim in `quantization_config.exclude`. Expanding to q/k/v_proj finds
nothing, so the module is quantized while the checkpoint holds it unpacked.
2. Per-expert MoE excludes. The checkpoint lists
`model.layers.{3,5,6}.mlp.experts.{0..287}.{down,gate,up}_proj` -- 1728
entries -- but SGLang builds a single FusedMoE named
`model.layers.N.mlp.experts`, which matches none of them. Those three layers'
experts are BF16 in the checkpoint (the model card documents this) and were
being loaded as MXFP4.
Fix: check `exclude` for a direct match before expanding packed mappings, and
treat a fused `...experts` module as excluded when the checkpoint excludes its
experts individually. Both checks run before the existing expansion, so the
shard-level path is unchanged.
The per-expert rule is exact for this checkpoint, where exclusion is
whole-layer (288 experts x 3 projections). It would not be for a checkpoint
excluding only some experts of a layer -- SGLang's fused representation cannot
express that at all, so there is no correct answer to preserve there.
Verified on 8x MI355X (gfx950) with the six open [AMD][GLM-5.3-Flash Day 0] PRs
(sgl-project#37530, sgl-project#37563, sgl-project#37573, sgl-project#37626, sgl-project#37629, sgl-project#37653) applied: without this change
weight loading aborts as above; with it all 120 shards load and the server
answers `/v1/models`.
Tests are bug-catchers, not vacuous: run against the unpatched function the two
new cases fail and the three regression guards pass; with the fix all five pass.
Arist12
requested review from
1am9trash,
HaiShaw,
hubertlu-tw,
kkHuang-amd and
yichiche
as code owners
September 2, 2026 23:48
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.
Problem
OneNexus/GLM-5.3-Flash-MXFP4cannot be loaded on this branch. Weight loading aborts within
load_qkv_weight. The 2× width is the signature of an MXFP4-packed parameter (two values per byte) meeting an unpacked BF16 weight — i.e. a layer the checkpoint excluded from quantization got quantized anyway.Root cause
should_ignore_layer()only consultsexcludeafter rewriting a fused module name into its shards. This checkpoint uses two exclusion shapes that never survive that rewrite:1. Already-fused modules named directly. The vision tower ships
visual.blocks.N.attn.qkv_projas a single tensor, and all 125 such names appear verbatim inquantization_config.exclude. Expanding toq_proj/k_proj/v_projmatches nothing, so the module is quantized while the checkpoint holds it unpacked.2. Per-expert MoE excludes. The checkpoint lists
model.layers.{3,5,6}.mlp.experts.{0..287}.{down,gate,up}_proj— 1728 entries — but SGLang builds oneFusedMoEnamedmodel.layers.N.mlp.experts, which matches none of them. Those three layers' routed experts are BF16 in the checkpoint (the model card documents this) and were being loaded as MXFP4.Measured on the checkpoint, confirming both the exclusion shape and which layers it covers:
and the tensors themselves:
At TP8 that is 2048/8 = 256 versus 1024/8 = 128 — exactly the assertion above.
Fix
Check
excludefor a direct match before expanding packed mappings, and treat a fused...expertsmodule as excluded when the checkpoint excludes its experts individually. Both run before the existing expansion, so the shard-level path is unchanged.The per-expert rule is exact for this checkpoint, where exclusion is whole-layer (288 experts × 3 projections). It would not be for a checkpoint that excluded only some experts of a layer — SGLang's fused representation cannot express that at all, so there is no correct behavior to preserve there.
Verification
8× MI355X (gfx950), ROCm 7.2.4, with the six open [AMD] [GLM-5.3-Flash Day 0] PRs applied (#37530, #37563, #37573, #37626, #37629, #37653):
/v1/modelsTests
Added to
test/registered/unit/layers/quantization/test_quark_utils.py, in that file's existing bug-catcher style. Proven non-vacuous — run against the unpatched function:The three guards cover the behavior that must not change: an empty
ignorelist must not start excluding everything, the original shard-level path must still work, and a per-expert prefix must not match a different layer index.Note
None of the six Day-0 PRs touch
quark/utils.py, so this gap is not covered by them.CI States
Latest PR Test (Base): ❌ Run #33696764690
Latest PR Test (Extra): ❌ Run #33696764505
Latest PR Test (AMD ROCm 7.2): ❌ Run #33696764681