From 0dd63639be24c67a0bccc9e3b0f0fd6ab039455d Mon Sep 17 00:00:00 2001 From: Andy Liu <31980222+andyl98@users.noreply.github.com> Date: Sat, 10 Jan 2026 23:14:54 -0800 Subject: [PATCH] [MTP][GLM][Bugfix] Fixed .weight_scale loading logic that dropped MTP prediction accuracy with fp8+mtp (#32101) Signed-off-by: Andy Liu --- vllm/model_executor/models/glm4_moe_mtp.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/vllm/model_executor/models/glm4_moe_mtp.py b/vllm/model_executor/models/glm4_moe_mtp.py index cb6fdb869c..08e3a78378 100644 --- a/vllm/model_executor/models/glm4_moe_mtp.py +++ b/vllm/model_executor/models/glm4_moe_mtp.py @@ -268,11 +268,6 @@ class Glm4MoeMTP(nn.Module, SupportsPP, Glm4MixtureOfExperts): if spec_layer is None: continue name = self._rewrite_spec_layer_name(spec_layer, name) - # Some checkpoints include weight scale tensors for the LM head even - # when the quantized head isn't built. Skip them if the model does - # not expose a matching parameter to avoid KeyError during load. - if name.endswith(".weight_scale") and name not in params_dict: - continue for param_name, weight_name, shard_id in stacked_params_mapping: # Skip non-stacked layers and experts (experts handled below). if weight_name not in name: @@ -315,6 +310,12 @@ class Glm4MoeMTP(nn.Module, SupportsPP, Glm4MixtureOfExperts): # Skip loading extra bias for GPTQ models. if name.endswith(".bias") and name not in params_dict: continue + # Some checkpoints include weight scale tensors for the + # LM head even when the quantized head isn't built. Skip + # them if the model does not expose a matching parameter + # to avoid KeyError during load. + if name.endswith(".weight_scale") and name not in params_dict: + continue # According to DeepSeek-V3 Technical Report, MTP modules # shares embedding layer. We only load the first weights.