From 9ebffef1ef956654e249ca21804d4a82b8ca1778 Mon Sep 17 00:00:00 2001 From: Xinyuan Tong <115166877+JustinTong0323@users.noreply.github.com> Date: Fri, 6 Mar 2026 00:04:58 +0000 Subject: [PATCH] [FIX] NSA backend page_table overflow in speculative decoding target_verify (#19016) --- python/sglang/srt/layers/attention/nsa_backend.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/layers/attention/nsa_backend.py b/python/sglang/srt/layers/attention/nsa_backend.py index 31ad7c010..2e76cf608 100644 --- a/python/sglang/srt/layers/attention/nsa_backend.py +++ b/python/sglang/srt/layers/attention/nsa_backend.py @@ -752,9 +752,11 @@ class NativeSparseAttnBackend( 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 "page_table": torch.zeros( max_num_tokens, - self.max_context_len, + self.max_context_len + (self.speculative_num_draft_tokens or 0), dtype=torch.int32, device=self.device, ),