[vllm] fix: is_fp8_weight() skips fused-MoE expert weights with non-".weight" checkpoint names - #7443
Merged
HollowMan6 merged 1 commit intoAug 19, 2026
Conversation
….weight" checkpoint names
Fused-MoE checkpoints store all experts in one tensor per projection,
so parameter names like "mlp.experts.gate_up_proj" / "mlp.experts.down_proj"
carry no ".weight" suffix. The previous `name.endswith("weight")` guard
silently excluded every such parameter from fp8_param_names, causing
quant_weights() to never quantize (or yield a *_scale_inv tensor for)
any expert-weight parameter on any fused-MoE model.
Replace the suffix guard with an explicit allowlist (_FP8_CANDIDATE_LEAVES)
covering both "weight" (dense linear + per-expert-layout) and the fused
projection leaf names ("gate_up_proj", "down_proj"). This serves as a
fast path — module resolution is only triggered for leaf names that can
actually be fp8 weights — while the real fp8-eligibility decision
(is_fp8_linear / is_fp8_moe) remains structurally unchanged, still
checking the resolved module's actual dtype.
Co-authored-by: Claude <noreply@anthropic.com>
YolandaLyj
force-pushed
the
fix/fp8-fused-moe-expert-weight-filter
branch
from
August 17, 2026 13:04
225c925 to
19e1ce2
Compare
Contributor
Author
|
@wuxibin89 @HollowMan6 It seems that none of the failed CI assignments involve the changed files. |
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.
What does this PR do?
is_fp8_weight()inverl/utils/vllm/vllm_quant_utils.pyusedname.endswith("weight")to filter bias parameters before resolving the module and checking its dtype. The comment says "Filter out bias params", but the check is stricter than that: it requires the name to end in"weight", which silently excludes fused-MoE expert weights whose checkpoint names carry no.weightsuffix (e.g.mlp.experts.gate_up_proj,mlp.experts.down_proj).As a result, on any model whose checkpoint stores expert weights in the fused 3D layout,
quant_weights()never quantizes, and never yields the companion*_scale_invtensor, for any expert-weight parameter — across every layer, for the entire training run.Root cause and fix: Replace the single suffix guard with an explicit whitelist (
_FP8_LINEAR_LEAF/_FP8_MOE_LEAVES) that (1) correctly admits fused expert parameter names and (2) serves as a fast path — module resolution viaget_module_from_param_nameis only triggered for leaf names that can actually be fp8 weights, avoiding unnecessary calls for embeddings, norms, and biases. The real fp8-eligibility decision (is_fp8_linear/is_fp8_moe) is structurally unchanged — it still checks the resolved module's actual dtype.Affected models: Any MoE model whose checkpoint uses the fused expert layout (one
[num_experts, in_dim, out_dim]tensor per projection, no per-expert index in the name). Examples include Qwen3-MoE-style checkpoints. Models with per-expert layout (experts.{id}.gate_proj.weight) are not affected.Duplicate check:
gh pr list --repo verl-project/verl --state open --search "is_fp8_weight OR fused expert"— no open PR addresses this fix.Checklist Before Starting
gh pr list --repo verl-project/verl --state open --search "is_fp8_weight OR fused expert"— no duplicates found.[{modules}] {type}: {description}Test
This bug only triggers at runtime with a fused-MoE fp8 checkpoint, which requires a GPU environment.
Suggested verification:
w13_weight/w2_weightarefloat8_e4m3fnand a parameter name likemodel.layers.0.mlp.experts.gate_up_proj; assertis_fp8_weight(name, model)returnsTrue(wasFalsebefore fix).*.weight) and bias params (*.bias) return the same result as before.Design & Code Changes
_FP8_LINEAR_LEAF = "weight"and_FP8_MOE_LEAVES = {"gate_up_proj": "w13_weight", "down_proj": "w2_weight"}.is_fp8_weight(), extract the parameter leaf name vianame.rsplit(".", 1)[-1]and gate module resolution onleaf == _FP8_LINEAR_LEAF or leaf in _FP8_MOE_LEAVES.getattr(module, _FP8_MOE_LEAVES[leaf])inis_fp8_moeso the whitelist is the single source of truth for the leaf→attribute mapping.Checklist Before Submitting
autogen-trainer-cfgfails due to missing localhydra-core;check-docs-time-infoandcheck-naming-conventionsfail on untrackeddocs/custom/files unrelated to this PR.)