[WIP][Spec Decode] DSpark capacity reallocation without sampler padding#47808
Draft
LucasWilkinson wants to merge 1 commit into
Draft
[WIP][Spec Decode] DSpark capacity reallocation without sampler padding#47808LucasWilkinson wants to merge 1 commit into
LucasWilkinson wants to merge 1 commit into
Conversation
e4457cf to
9b3a024
Compare
Contributor
|
This pull request has merge conflicts that must be resolved before it can be |
9b3a024 to
f4ee8d9
Compare
b9f7e14 to
e9c61c2
Compare
…cation Implements DSpark (arXiv 2607.05147) confidence-scheduled verification with two capacity enforcement modes and full CUDA graph support: - Capacity manager with `mask` (pad pruned verify rows) and `varlen` (compact the verifier batch) modes; varlen replays FULL CUDA graphs for both the target verify step and the DSpark draft query step. - Paper-faithful Algorithm 1 allocator: capacities are the greedy admission counts (sum(capacities) == spent budget, hard cap; zero-survival tokens are never candidates), fixing a threshold-recount tie escape that disabled the budget under saturated confidence logits. - Hardware-aware prefix scheduler: optional `dspark_sps_curve` config (profiled steps-per-second vs verification batch tokens) drives the theta = tau * SPS(B) argmax stopping rule; `dspark_budget_frac` remains as an admission upper bound. Includes benchmarks/profile_dspark_sps_curve.py to measure the curve from the captured cudagraph staircase. - Varlen full-CG correctness fixes: per-request token bound in cudagraph dispatch, capture/replay buffer-address consistency in the DSA indexer varlen decode path (forced flatten + persistent indices buffer), padded-row sizing in the indexer build, TP-deterministic capacity flushes, and correct handling of the scheduler's -1 draft placeholder ids in capacity accounting. Co-authored-by: OpenAI Codex <codex@openai.com> Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DHmbeNn4JRhg5zaZqPiGHm Signed-off-by: Lucas Wilkinson <lwilkins@redhat.com>
e9c61c2 to
0299e2c
Compare
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.
This PR implements DSpark confidence-scheduled verification: a capacity manager that prunes low-confidence draft tokens from target verification, with two enforcement modes —
mask(pruned rows kept as padding) andvarlen(verifier batch physically compacted). The varlen path keeps FULL CUDA graphs for both the target verify step and the DSpark draft step.Based on #47469 (SM100 DSA varlen decode); comparison point is #47513 (padded/full-CG approach). Replaces #47694 (opened from the wrong fork).
How it works
sum(capacities) == spent budget(the earlier threshold-recount formulation blew through the budget on tied/saturated scores).theta = tau * SPS(B)argmax over a profiled step-rate curve, supplied viadspark_sps_curve(measure it withbenchmarks/profile_dspark_sps_curve.py);dspark_budget_fracstill acts as a hard admission cap.dspark_online_stsfits the paper's Sequential Temperature Scaling online: per-(position, verdict) empirical conditional acceptance from the rejection sampler's own outcomes.dspark_confidence_temperatureis a simpler static alternative.Performance
DeepSeek-V4-Flash-NVFP4 + DSpark draft, TP4 B200, k=7, speed_bench (all categories), 256 prompts x 1024 output tokens, temperature 1.0,
--ignore-eos(equal work per cell). Cells: output tok/s / mean ITL / acceptance length (delta vs no capacity):GSM8K 5-shot: varlen 0.933-0.939, mask 0.950, invalid <= 0.002 (eval config included as
tests/evals/gsm8k/configs/DeepSeek-V4-Flash-DSpark-varlen-TP4.yaml).Exact reproduction commands
TODO
--overhead-ms): the verify-only curve over-prunes below the contention knee (~-7% vs no capacity at c=16)AI assistance
Built with AI assistance (Codex + Claude Code); all benchmarks above were executed as part of this work. Draft until human-reviewed.