diff --git a/python/sglang/srt/mem_cache/swa_memory_pool.py b/python/sglang/srt/mem_cache/swa_memory_pool.py index bd1205708..6fab812af 100644 --- a/python/sglang/srt/mem_cache/swa_memory_pool.py +++ b/python/sglang/srt/mem_cache/swa_memory_pool.py @@ -561,6 +561,8 @@ class SWATokenToKVPoolAllocator(BaseTokenToKVPoolAllocator): self.full_to_swa_index_mapping[alloc_full_indices[-swa_tail_len:]] = ( alloc_swa_indices ) + if swa_tail_len < extend_num_tokens: + self.full_to_swa_index_mapping[alloc_full_indices[:-swa_tail_len]] = 0 return alloc_full_indices def alloc_decode(