From 493d4b3c04a439c926df2c4d2fa3cdfabb1a8605 Mon Sep 17 00:00:00 2001 From: HieDean <34408026+HieDean@users.noreply.github.com> Date: Thu, 17 Sep 2026 23:20:37 +0800 Subject: [PATCH] [bugfix] Mark draft tokens to rebuilt their embeddings. (#57356) Signed-off-by: HieDean <799287043@qq.com> Co-authored-by: hiedean --- vllm/v1/worker/gpu_model_runner.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/vllm/v1/worker/gpu_model_runner.py b/vllm/v1/worker/gpu_model_runner.py index 10f85be718..77d11621c2 100644 --- a/vllm/v1/worker/gpu_model_runner.py +++ b/vllm/v1/worker/gpu_model_runner.py @@ -1858,8 +1858,12 @@ class GPUModelRunner( total_without_spec = total_num_scheduled_tokens - total_num_spec_tokens if self.enable_prompt_embeds: # The multimodal embed path reads is_token_ids.gpu; its .cpu copy is - # refreshed every step but the async fast paths below only scatter - # input_ids.gpu, so refresh is_token_ids.gpu here too. + # refreshed every step but the async fast path below replaces draft + # tokens directly on the GPU. Mark those positions as token IDs before + # refreshing the GPU mask so their embeddings are rebuilt. Sampled + # tokens are already marked by bookkeeping. + if spec_flattened_indices: + self.is_token_ids.np[spec_flattened_indices] = True self.is_token_ids.copy_to_gpu(total_num_scheduled_tokens) if num_common_tokens < total_without_spec: # If not all requests are decodes from the last iteration,