Repository navigation
Conversation
…g in the Gumbel kernel - DSpark batch-sharded draft sampling: under batch-sharded sampling each TP rank samples the drafts of the requests it verifies, from an all-to-all of the vocab-sharded draft logits, instead of every rank sampling every request from all-gathered logits. Owners follow DraftLogitsCache.assign (batch position % TP), and the draft logits are written through its row mapping. - Markov sampling: add the Markov bias inside the Gumbel kernel and cache the biased logits; combine the per-block maxima in one kernel; skip the divide at temperature 1. - DFlash: pad the prepared inputs in wide blocks. - Scheduler: no draft-slot charge for MRV2 DFlash/DSpark when every request's queries fit max_num_batched_tokens. - MRV2: write is_padding with the positions for VLLM_MOE_SKIP_PADDING. - Top-k/top-p: keep the max token(s) when a top-p below fp32 resolution drops every duplicate; warm the kernels up for V2's contiguous FP32 rows. Co-authored-by: qizixi <22851944+zixi-qi@users.noreply.github.com> Co-authored-by: Dao Le <daole@inferact.ai> Co-authored-by: Taoyu Zhu <zhutaoyu97@gmail.com> Co-authored-by: Zhewen Li <jerven.vllm@gmail.com> Co-authored-by: Zijing Liu <liuzijing2014@users.noreply.github.com> Co-authored-by: xiaozhoupy <peiyuanzhou1994@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
Main already reserves no draft slots for DFlash and DSpark (SpeculativeConfig.max_num_new_slots_for_drafting returns 0 for both), so the override was a no-op. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
zyongye
requested review from
TheEpicDolphin,
houseroad,
njhill and
yewentao256
as code owners
October 29, 2026 07:46
Collaborator
|
Current PR overlaps with #63554 and probably needs to be rebased |
Member
#63886 covers batch-sharded DSpark draft sampling, so this PR keeps only the Markov sampling in the Gumbel kernel. Remove DraftBatchSharder, compute_draft_logits_local and the drafter's sharding hooks. Without the sharded path the bias row is the token's own row, so gumbel_sample drops bias_rows. The fused-vs-unfused Markov test moves to test_dspark_markov_sampling.py. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Yongye Zhu <zyy1102000@gmail.com>
2 of 6 tasks
WoosukKwon
reviewed
Oct 29, 2026
Comment on lines
+236
to
+237
| idx_map_steps = idx_map.t().contiguous() | ||
| draw_pos_steps = (sample_pos.t() - 1).contiguous() |
6 tasks done
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
Open
6 tasks done
6 tasks done
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR speeds up the DSpark/DFlash draft step under MRV2 and fixes a top-p masking bug. It contains:
is_paddingwritten by the positions kernel;Split out of #63232 (MiniMax-M3.1-Flash). Based on
main; it does not depend on the other PRs of that split. Batch-sharded DSpark draft sampling was dropped from this PR; #63886 covers it.Claims
argmax+gather.prepare_dflash_inputspads the per-request buffers in 1024-wide blocks. Before, it usedBLOCK_SIZE, which is 8 in a decode step, so the padding took thousands of serial iterations.VLLM_MOE_SKIP_PADDING(on by default), the positions kernel writesis_padding, replacing twofill_launches per step. The result is the same, including after adaptive compaction.Validation
Unit tests on GB300:
460 passed, 1 skipped, 0 failed.
New tests:
test_dspark_markov_sampling.py::test_markov_sampling_matches_unfusedruns the Markov loop with the real LM-head, Markov embedding and Markov bias layers. For greedy and probabilistic drafting, with full and reduced draft vocabularies, it checks that the loop gives the same draft ids and cached draft-logits rows as adding the bias first.test_gpu_gumbel_sample.py::test_gumbel_combine_preserves_first_nan_and_maximumchecks that the combine kernel followstorch.argmax: the first NaN wins, otherwise the first maximum.test_rejection_sampler_utils.py::test_block_verification_is_unbiased_across_stepsdrafts withgumbel_sampleover many steps and checks that block verification keeps the target distribution.test_gpu_input_batch_v2.py::test_prepare_positions_preserves_padding_after_compactionchecks theis_paddingwrites.test_topk_topp_sampler.py::test_tiny_p_keeps_max_tokenfails onmain's kernel (2 failed) and passes here.Performance:
main's 7 also hasargmax+gatherin place of the combine kernelThe 4 kernels per step are the Markov embedding, the bias GEMM, the Gumbel kernel and the combine kernel. The fused path removes the bias add and the per-step copy into
draft_tokens.Not covered: no end-to-end benchmark or accuracy eval on this branch.
Details
Not a duplicate:
This PR keeps the generic Gumbel loop and its draws, so it works with probabilistic drafting and any DSpark draft model.
When the bias is fused: probabilistic full-vocab drafting with no watermarking, acceptance estimator or output logit transform. Greedy drafting, a reduced draft vocab and those features still add the bias first, because they need the biased logits.
Shared code touched:
gumbel_samplegains an optionalbias.torch.argmax's tie and NaN semantics.prepare_dflash_inputspadding.prepare_pos_seq_lensgains optionalis_paddingoutputs.Size: about 220 non-test lines.
Credits: qizixi (Markov bias in the Gumbel kernel), plus Dao Le, Taoyu Zhu, Zhewen Li, Zijing Liu and xiaozhoupy, whose DSpark work this comes from, as co-authors in the commit. AI assistance (Claude) was used to port these changes onto
main, and to write the port's tests and this description. The submitter reviewed the change and ran the tests above.Pull Request Checklist
I used vLLM's
/pr-checklistskill. (Mandatory for agents, optional for humans).AI assistance was used during the creation of this PR.
Design Fit: Minimizes impact on core components, reuses existing functionality, and justifies added complexity.
Testing and Validation: Validates the change and ensures any added tests are meaningful and reliable, with CI coverage or documented CI resource constraints and validation performed outside CI.
Code Quality and Style: Keeps code and comments clear and concise, and updates relevant documentation and examples.
Pull Request Contents: Includes a brief summary and relevant links, supports claims with evidence, explains root causes and implementation trade-offs, and follows the contributing guide.
🤖 Generated with Claude Code