streaming session: spec v2 bonus accounting + comprehensive test matrix (#22651)

This commit is contained in:
Liangsheng Yin
2026-04-15 17:12:41 -07:00
committed by GitHub
parent ccff59254c
commit a4cf2ea128
5 changed files with 559 additions and 308 deletions
@@ -358,7 +358,8 @@ class SchedulerOutputProcessorMixin:
stride = self.draft_worker.speculative_num_draft_tokens
for i, req in enumerate(batch.reqs):
req.kv_committed_len += accept_lens[i]
# -1 because prepare_for_decode pre-claimed the bonus slot.
req.kv_committed_len += accept_lens[i] - 1
predict_tokens.append(
next_token_ids[i * stride : i * stride + accept_lens[i]]
)
@@ -1075,15 +1075,6 @@ class TokenizerCommunicatorMixin:
"Streaming sessions are disabled. "
"Please relaunch with --enable-streaming-session."
)
if (
self.server_args.speculative_algorithm is not None
and not self.server_args.disable_overlap_schedule
):
raise ValueError(
"Streaming sessions are incompatible with speculative decoding v2 "
"(overlap + speculative). Use --disable-overlap-schedule or "
"disable speculative decoding."
)
if obj.session_id is None:
obj.session_id = uuid.uuid4().hex
@@ -127,6 +127,8 @@ class EagleDraftInputV2Mixin:
num_needed_tokens += x
r.kv_allocated_len += x
r.decode_batch_idx += 1
# Pre-claim bonus slot here (like normal decode); resolve subtracts 1.
r.kv_committed_len += 1
cur_kv_lens_cpu = torch.tensor(cur_kv_lens_cpu, dtype=torch.int32, device="cpu")
nxt_kv_lens_cpu = torch.tensor(nxt_kv_lens_cpu, dtype=torch.int32, device="cpu")