scheduler: skip speculative decoding when all scheduled requests need <=1 output token - #437
Conversation
… ≤1 output token When scheduled_new_reqs is non-empty, scheduled_running_reqs is empty, and every new request has max_tokens <= 1, set num_spec_tokens_to_schedule = 0. Speculative decoding is useless for 1-token outputs; draft generation + verification adds measurable latency. Measured on RTX 5090 (31.4 GB), MTP=6: - 1-token-prompt request latency 141ms→127ms (−14ms) - 2000-token prefill benchmark +2.5% (7445→7635 tok/s) - TG for normal requests unchanged (189.8 tok/s)
|
Warning Review limit reached
Next review available in: 19 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Superseded by #438 — please close this one. Two reasons this PR could not have gone green, both fixed in #438:
#438 is the same change rebased onto current FWIW the |
|
Superseded by #439 (correct base, DCO-signed, lint-clean). Closing. |
Motivation
Speculative decoding is useless for 1-token outputs (e.g. classification, logprobs, embedding extraction). The draft generation + verification pipeline adds measurable latency with zero benefit when every request in the batch needs
max_tokens <= 1.Change
In
vllm/v1/core/sched/scheduler.py, afternum_spec_tokens_to_scheduleis computed (including the dynamic-spec-decode lookup), add a guarded block:The guard requires:
num_spec_tokens_to_schedule > 0(spec decode is active)scheduled_new_reqsis non-empty (there are new requests this step)scheduled_running_reqsis empty (no running/decoding requests mixed in)max_tokens <= 1When all conditions hold, spec decode is skipped for this scheduling step by setting
num_spec_tokens_to_schedule = 0.Measured evidence (RTX 5090, 31.4 GB, MTP=6)
The 1-token latency improvement comes from eliminating the draft-model forward pass + verification overhead. The prefill improvement is a side effect of reduced scheduling overhead when spec decode bookkeeping is skipped.
Safety
max_tokens > 1) are unaffected.num_spec_tokens_to_schedule = 0is the same state as if spec decode were disabled, so downstream code paths are already exercised in CI.Testing
ast.parseverified on the modifiedscheduler.py. No container/GPU interaction in this PR.