From 4d042ed85f3b8fe8c73b6a4a365e65cf1811823e Mon Sep 17 00:00:00 2001 From: Santino Ramos <51103228+santiramos27@users.noreply.github.com> Date: Mon, 13 Apr 2026 08:57:38 -0700 Subject: [PATCH] [Bugfix] Fix tensor shape mismatch in sparse attention with speculative decoding (#39542) Signed-off-by: Santino Ramos --- vllm/model_executor/layers/sparse_attn_indexer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vllm/model_executor/layers/sparse_attn_indexer.py b/vllm/model_executor/layers/sparse_attn_indexer.py index df77172219..bdaa6af094 100644 --- a/vllm/model_executor/layers/sparse_attn_indexer.py +++ b/vllm/model_executor/layers/sparse_attn_indexer.py @@ -213,7 +213,7 @@ def sparse_attn_indexer( ) torch.ops._C.persistent_topk( logits, - decode_metadata.seq_lens, + seq_lens, topk_indices, topk_workspace, topk_tokens, @@ -250,7 +250,7 @@ def sparse_attn_indexer( topk_indices.reshape(batch_size, -1, topk_indices.shape[-1]), decode_lens, ) - topk_indices_buffer[:num_decode_tokens, : topk_indices.shape[-1]] = ( + topk_indices_buffer[: topk_indices.shape[0], : topk_indices.shape[-1]] = ( topk_indices )