Repository navigation
Conversation
Under rejection sampling the acceptance at a position is 1 - TV(p, q), which the draft's top probability does not tell, so the p_min cutoff dropped draft tokens the target would have accepted. Skip it when MTP or DFlash2 samples the draft. draft-simple keeps it: each extra draft token costs a full draft model pass.
|
Adding the performance section as a separate comment for better visibility. Performance
Master and this PR were both run with Δ is this PR vs master at each temperature, over the 12 prompts x 3 seeds:
Tokens/target pass shows the acceptance effect alone; t/s also includes the cost of the extra drafted tokens and the larger verify batch. Models: Qwen3.8-27B Q4_K_M with its DFlash2 draft and the ggml-org MTP head (Q8_0); Muse-Glimmer-30B Q4_K_M with z-lab's DFlash2 draft. SummaryΔ t/s vs master, mean of per-temp values, temps 0.1-1.0 / 0.5-1.0:
RTX 5090RTX 5090, Qwen3.8-27B + DFlash2, n_max 3
RTX 5090, Muse-Glimmer-30B + DFlash2, n_max 3
RTX 5090, Qwen3.8-27B + MTP, n_max 3
RTX 5090, Qwen3.8-27B + MTP, n_max 8
On the RTX 5090 part of the gain comes from CUDA graphs: with the cut the verify batch size changes from step to step and the graph keeps being re-captured. With DGX SparkDGX Spark, Qwen3.8-27B + DFlash2, n_max 3
DGX Spark, Muse-Glimmer-30B + DFlash2, n_max 3
DGX Spark, Qwen3.8-27B + MTP, n_max 3
SPEED-BenchQwen3.8-27B + DFlash2, n_max 3, temp 1.0, OSL 512, concurrency 1, master and this PR both with RTX 5090
DGX Spark
|
|
@ruixiang63, @gaugarg-nv, @ORippler can you please review this PR? Thanks. |
Overview
Follow-up to discussion from #30663 (comment).
--spec-draft-p-minstops a draft once the draft's top probability drops below p_min. That fits greedy drafts, where the target keeps a drafted token only if it picks the same one. With--spec-draft-sampling probabilisticthe draft is sampled and verified by rejection sampling: a sampled token is accepted with probability min(1, p/q), so the acceptance at a position is Σ min(p, q), which the draft's top probability does not tell. A flat but well-matched draft gets cut although the target would accept most of its tokens, and the cut fires more as the temperature rises.This PR skips the p_min cut for sampled MTP and DFlash2 drafts. Greedy drafting and temp-0 requests are unchanged. The output distribution is the same either way, since the cut does not depend on the drawn token; only throughput changes.
The help text now says p_min is not applied to sampled draft-mtp and draft-dflash drafts.
Performance
Master and this PR were both run with
--spec-draft-sampling probabilisticand--spec-draft-p-min 0.75. Same method as #27694: 11 temperatures, 12 prompts x 256 tokens, 3 seeds, arms interleaved. Temp 0 gave identical text in every config.Δ is this PR vs master at each temperature, over the 12 prompts x 3 seeds:
predicted_per_second, prompt processing excluded), mean per request.Tokens/target pass shows the acceptance effect alone; t/s also includes the cost of the extra drafted tokens and the larger verify batch.
Models: Qwen3.8-27B Q4_K_M with its DFlash2 draft and the ggml-org MTP head (Q8_0); Muse-Glimmer-30B Q4_K_M with z-lab's DFlash2 draft.
Summary
Δ t/s vs master, mean of per-temp values, temps 0.1-1.0 / 0.5-1.0:
RTX 5090
RTX 5090, Qwen3.8-27B + DFlash2, n_max 3
RTX 5090, Muse-Glimmer-30B + DFlash2, n_max 3
RTX 5090, Qwen3.8-27B + MTP, n_max 3
RTX 5090, Qwen3.8-27B + MTP, n_max 8
On the RTX 5090 part of the gain comes from CUDA graphs: with the cut the verify batch size changes from step to step and the graph keeps being re-captured. With
GGML_CUDA_DISABLE_GRAPHS=1(Qwen3.8 + DFlash2, temp 1.0) the gain is +20.9% t/s for +27.5% tokens per target pass. On DGX Spark t/s follows tokens per pass.DGX Spark
DGX Spark, Qwen3.8-27B + DFlash2, n_max 3
DGX Spark, Muse-Glimmer-30B + DFlash2, n_max 3
DGX Spark, Qwen3.8-27B + MTP, n_max 3
SPEED-Bench
Qwen3.8-27B + DFlash2, n_max 3, temp 1.0, OSL 512, concurrency 1, master and this PR both with
--spec-draft-sampling probabilistic --spec-draft-p-min 0.75. coding =--category coding, qualitative =--category all --limit 15. Dataset rows that only hold the placeholder text "FULL BENCHMARK DATA SHOULD BE FETCHED FROM THE SOURCE USING SPECDEC_BENCH" are excluded, leaving 70 coding and 82 qualitative prompts. t/s = generated tokens / decode time over all requests.RTX 5090
DGX Spark
Requirements