From b2b8f679d0589f0c956f3e734cc70dab07b27b8a Mon Sep 17 00:00:00 2001 From: Evan Takahashi Date: Tue, 21 Jul 2026 10:53:37 -0700 Subject: [PATCH] [Bugfix][Spec Decode] Restrict embedding-width share guard to EAGLE drafts (#47953) Signed-off-by: Evan Takahashi Co-authored-by: Michael Goin --- vllm/v1/spec_decode/llm_base_proposer.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vllm/v1/spec_decode/llm_base_proposer.py b/vllm/v1/spec_decode/llm_base_proposer.py index f8b52d079a..6ee442af51 100644 --- a/vllm/v1/spec_decode/llm_base_proposer.py +++ b/vllm/v1/spec_decode/llm_base_proposer.py @@ -1477,9 +1477,13 @@ class SpecDecodeBaseProposer: "Sharing target model embedding weights with the draft model." ) - if share_embeddings: + if share_embeddings and hasattr(self.model, "has_own_embed_tokens"): + # EAGLE drafts consume input embeddings at their own hidden + # size, so only share when the widths match. MTP drafts + # project target-width embeddings (e.g. Gemma4 MTP's + # pre_projection takes 2 * backbone_hidden_size), so the + # width check does not apply to them. draft_embed = self.model.model.embed_tokens - # Only share when both models use the same embedding width. # Guard with isinstance so non-Tensor weights (e.g. in tests) # are not affected — mirrors the weight-equality check above. if isinstance(target_embed_tokens.weight, torch.Tensor) and isinstance(