diff --git a/python/sglang/srt/layers/attention/dsa_backend.py b/python/sglang/srt/layers/attention/dsa_backend.py index eb48fd0ac..18066b0db 100644 --- a/python/sglang/srt/layers/attention/dsa_backend.py +++ b/python/sglang/srt/layers/attention/dsa_backend.py @@ -1003,11 +1003,11 @@ class DeepseekSparseAttnBackend( max_bs + 1, dtype=torch.int32, device=self.device ), # fake page_table for sparse_prefill - # Add extra columns for speculative draft tokens to avoid - # overflow during target_verify when max_seqlen_k = seq_len + num_draft_tokens + # Match req_to_token's width exactly. It is over-allocated beyond + # context_len because spec decoding lets seq_len transiently overshoot. "page_table": torch.zeros( max_num_tokens, - self.max_context_len + (self.speculative_num_draft_tokens or 0), + self.req_to_token.shape[1], dtype=torch.int32, device=self.device, ),