Skip to content

[Core] Skip redundant draft token alloc + sampling - #48244

Draft
njhill wants to merge 3 commits into
vllm-project:mainfrom
njhill:skip-drafting
Draft

njhill wants to merge 3 commits into
vllm-project:mainfrom
njhill:skip-drafting

Conversation

@njhill

@njhill njhill commented Jul 10, 2026

Copy link
Copy Markdown
Member

Avoid spec decode drafting and lookahead allocation for requests/steps where it isn't necessary (non-final prefill chunks or based on max_tokens).

This is a similar optimization to those from @NickLucche in #45280 and #45283, with a benefit that it doesn't rely on config and can apply in some more cases (e.g. aggregated scenarios with chunked prefills).

However the config-based approach should still be worthwhile/complimentary since it means we can avoid capturing cuda graphs for the extra eagle steps and draft sampling (for full CG case) altogether. It also works naturally with DP.

I did not apply this to MRV1 since we are in the process of deprecating it.

Performance comparison

Setup
  • Hardware: 1x GB200
  • Model: Qwen/Qwen3-8B (fp16) + eagle3 drafter AngelSlim/Qwen3-8B_eagle3, num_speculative_tokens=3
  • Workload: vllm bench throughput --dataset-name random --random-input-len 16384 --random-output-len 1 --num-prompts 64 --max-model-len 20480 --seed 42, i.e. 1,048,576 prompt tokens total, 1 output token per request
Results (total tokens/s, higher is better)
max_num_batched_tokens Base With change Delta
2048 (8 chunks/req) 60,913 (n=3, ±0.1%) 61,528 (n=3) +1.0%
512 (32 chunks/req) 44,209 (n=3, ±0.06%)¹ 45,462 (n=2) +2.8%

@mergify mergify Bot added the v1 label Jul 10, 2026
@mergify

mergify Bot commented Jul 19, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @njhill.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify

mergify Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @njhill.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added needs-rebase mrv2 Model Runner V2 specific labels Jul 24, 2026
justtestingthingsx pushed a commit to meandmyboiclaude/vllm that referenced this pull request Aug 7, 2026
…g (+DP support)

Skips draft proposal/sampling for requests whose drafts can never be
consumed (non-final prefill chunks, guaranteed-final decode steps),
propagated via SchedulerOutput.no_draft_req_ids, plus DP draft-skip
sync. Includes DP block-table/dp_utils/speculator changes and tests
(merged clean).

BEHAVIOR NOTE (rule 3): the skip is NOT behind a user opt-in flag. It is
gated on `vllm_config.use_v2_model_runner` (report_unusable_drafts /
can_skip_lookahead are False unless the V2 model runner is active, and
can_skip_lookahead additionally excludes dflash/dspark). The legacy V1
runner path is unaffected; on the V2 runner + spec decode this changes
default behavior by design (that is the PR's purpose).

Merge notes: preserved our vllm-project#40757 zero-collapse floor guard verbatim
(untouched, outside conflict region) and our vllm-project#48944 DynamicSDLookup type
for self.dynamic_sd_lookup + dynamic_sd_ctx_agg; added PR's
report_unusable_drafts/can_skip_lookahead flags and no_draft_req_ids
SchedulerOutput kwarg alongside our ec_manager_metadata.

Co-authored-by: vLLM contributors
(cherry picked from commit 467b5e9)
(cherry picked from commit 29994b7)
justtestingthingsx pushed a commit to meandmyboiclaude/vllm that referenced this pull request Aug 11, 2026
…g (+DP support)

Skips draft proposal/sampling for requests whose drafts can never be
consumed (non-final prefill chunks, guaranteed-final decode steps),
propagated via SchedulerOutput.no_draft_req_ids, plus DP draft-skip
sync. Includes DP block-table/dp_utils/speculator changes and tests
(merged clean).

BEHAVIOR NOTE (rule 3): the skip is NOT behind a user opt-in flag. It is
gated on `vllm_config.use_v2_model_runner` (report_unusable_drafts /
can_skip_lookahead are False unless the V2 model runner is active, and
can_skip_lookahead additionally excludes dflash/dspark). The legacy V1
runner path is unaffected; on the V2 runner + spec decode this changes
default behavior by design (that is the PR's purpose).

Merge notes: preserved our vllm-project#40757 zero-collapse floor guard verbatim
(untouched, outside conflict region) and our vllm-project#48944 DynamicSDLookup type
for self.dynamic_sd_lookup + dynamic_sd_ctx_agg; added PR's
report_unusable_drafts/can_skip_lookahead flags and no_draft_req_ids
SchedulerOutput kwarg alongside our ec_manager_metadata.

Co-authored-by: vLLM contributors
(cherry picked from commit 467b5e9)
(cherry picked from commit 29994b7)
justtestingthingsx pushed a commit to meandmyboiclaude/vllm that referenced this pull request Aug 22, 2026
…re-pads an already-padded layer to the shared page (boot AssertionError class); commensurate per-token-bytes zero guard; AR speculator draft-prefill dispatches on num_tokens_padded (restores upstream vllm-project#47352, reverted by carried vllm-project#48244 pick); gemma4_dspark + laguna_dflash fused-KV dtype derived from norm weight + bias cast (fp16 drafters); unpadded() propagates mm_req_doc_ranges; V1 runner zeroes padded-row num_prompt_tokens_cpu (stale-length dummy-row class); fused_recurrent + fused_sigmoid_gating INPLACE_FINAL_STATE load masked to the row (SM-fault class, mirrors vllm-project#50021's sibling bound); profile_cudagraph_memory empty-sample guard; TQ spec head_size_v; packed-codec (kvarn_/turboquant_) branch in _validate_cache_dtype logging; max_page_block_lcm includes padded-to-max layers (PR vllm-project#52804 intent)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mergify mergify Bot removed the needs-rebase label Sep 3, 2026
@njhill

njhill commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

github-actions Bot commented Sep 3, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #87016 for commit 21f9f5d6e90d.

@mergify

mergify Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @njhill.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 3, 2026
Signed-off-by: Nick Hill <nickhill123@gmail.com>
Signed-off-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: Claude
Signed-off-by: Nick Hill <nickhill123@gmail.com>
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@mergify mergify Bot removed the needs-rebase label Sep 3, 2026
@mergify

mergify Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @njhill.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant