@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 2562e0271e
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 7, 14:00 UTC

[MTP] Validate that MTP weights are actually loaded (#35548)

Signed-off-by: Matthew Bonanni <mbonanni@redhat.com>

Matthew Bonanni committed Feb 27, 2026 at 23:27 UTC 2562e0271e51950da23c57b237649250bf41d9e0
1 file changed +20
vllm/model_executor/models/deepseek_mtp.py
+20
@@ -415,6 +415,26 @@ class DeepSeekMTP(nn.Module, DeepseekV2MixtureOfExperts):
415 weight_loader(param, loaded_weight)
416 if not is_fusion_moe_shared_experts_layer:
417 loaded_params.add(name)
418 +
419 + # Validate that weights were loaded for each expected MTP layer.
420 + loaded_layers: set[int] = set()
421 + for param_name in loaded_params:
422 + spec_layer = get_spec_layer_idx_from_weight_name(self.config, param_name)
423 + if spec_layer is not None:
424 + loaded_layers.add(spec_layer)
425 + for layer_idx in range(
426 + self.model.mtp_start_layer_idx,
427 + self.model.mtp_start_layer_idx + self.model.num_mtp_layers,
428 + ):
429 + if layer_idx not in loaded_layers:
430 + raise ValueError(
431 + f"MTP speculative decoding layer {layer_idx} weights "
432 + f"missing from checkpoint. The checkpoint may have "
433 + f"been quantized without including the MTP layers. "
434 + f"Use a checkpoint that includes MTP layer weights, "
435 + f"or disable speculative decoding."
436 + )
437 +
438 return loaded_params
439
440 def _rewrite_spec_layer_name(self, spec_layer: int, name: str) -> str: