Conversation
qq1060
marked this pull request as ready for review
August 13, 2026 12:27
qq1060
requested review from
BBuf,
DarkSharpness,
Fridge003,
HaiShaw,
HydraQYH,
JustinTong0323,
Qiaolin-Yu,
Ying1123,
celve,
hebiao064,
hnyls2002,
ispobock,
merrymercy,
xiezhq-hermann,
yizhang2077 and
yuan-luo
as code owners
August 13, 2026 12:27
qq1060
force-pushed
the
pr/dspark-confidence-scheduler
branch
4 times, most recently
from
August 17, 2026 08:39
dfd303a to
e5b9143
Compare
Load independent tensor-parallel LM heads and map draft tokens and probabilities into the target vocabulary for native Speculators checkpoints.
qq1060
force-pushed
the
pr/dspark-confidence-scheduler
branch
from
August 18, 2026 12:20
7b45f57 to
a0700a2
Compare
Author
|
/tag-and-rerun-ci |
4 tasks
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.
Motivation
This PR extends SGLang's DSpark path to run native Speculators checkpoints end
to end in eager mode, CUDA Graph replay, and ragged multimodal verification. It
covers the checkpoint config and weight formats, both DSpark anchor layouts,
independent draft vocabularies, and the runtime paths needed to verify them.
Native Speculators checkpoints are not limited to the shared-vocabulary layout
that DSpark originally supported in SGLang. They may contain an independent
reduced-vocabulary LM head plus a draft-to-target (
d2t) mapping. For example,the public
RedHatAI/Qwen3.6-35B-A3B-speculator.dsparkcheckpoint has:
lm_head: 32,000 tokens;markov_w1: target-vocabulary input;markov_w2: draft-vocabulary output;d2t: a 32,000-entry mapping from sampled draft IDs to target IDs.Treating these tensors as a shared-vocabulary model either fails during loading
or feeds/scatters IDs in the wrong vocabulary space.
Speculators checkpoints can also use either DSpark draft-block layout:
sample_from_anchor=false: the anchor is only a conditioning token. The draftforward has
gamma + 1slots, and slot 0 is excluded from sampling andverification.
sample_from_anchor=true: the anchor is a trained prediction. The draftforward has
gammaslots.Using the wrong width does not always crash; it can shift real draft positions
and reduce the acceptance length toward 1.
After checkpoint loading and draft geometry were working, mixed image/text
validation exposed separate problems in ragged mRoPE and linear attention. The
ragged-path changes make multimodal verification work under CUDA Graphs.
During the same validation, I found a pre-existing interaction between
/flush_cacheand DSpark draft CUDA Graphs: emptying the allocator cache caninvalidate addresses retained by a captured graph. This is included as a
separate DSpark graph-lifecycle fix.
Modifications
under
transformer_layer_config, without importing checkpoint-side remoteconfig code. This path is gated on
speculators_model_type=dsparkand reusesthe existing config-dictionary fetch.
ParallelLMHeadwhendraft_vocab_size != target_vocab_size; preserve the original shared-headpath for full-vocabulary DSpark checkpoints.
markov_w1consumes target IDs whilemarkov_w2and the draft LM head produce draft-vocabulary logits.d2tbefore storing tokens or feeding the nextMarkov step. For probabilistic acceptance, scatter draft probabilities into
target-vocabulary columns and leave unmapped target tokens at
-inf.checkpoints without
d2t. Loadt2das checkpoint metadata without using itin the decode path.
gammaandsample_from_anchormetadata, rejectinconsistent checkpoint geometry at startup, and propagate the same draft
width through eager execution and CUDA Graph replay.
gammareal drafttokens. Only the draft forward width changes.
CUDA Graph padding uses zero-delta ghost positions.
declare ragged CUDA Graph support per attention backend.
/flush_cachewhilestill clearing logical request, KV, radix, grammar, and metrics state.
Mbin for compact scheduling and recompute the simulatedbonus token at the acceptance boundary.
normalization, tensor-parallel LM heads, Markov shapes,
d2tmapping,corrected-logit scatter, both checkpoint layouts, CUDA Graphs, ragged mRoPE,
linear attention, cache flushing, and SPS fitting.
Status
/flush_cacheCorrectness Tests
On the PR branch rebased onto upstream
mainon 2026-08-13, the focused suitereports
212 passed, 54 subtests passed; the reduced-vocabulary file reports26 passed, 2 subtests passed. Python compilation, formatting, focused Ruffchecks, and
git diff --checkalso pass.The public-checkpoint validation uses
RedHatAI/Qwen3.6-35B-A3B-NVFP4as the target and
RedHatAI/Qwen3.6-35B-A3B-speculator.dsparkas the draft. All reported runs used NVIDIA RTX PRO 5000 72GB Blackwell GPUs
(driver 580.126.20); each run used one GPU, and paired performance measurements
reused the same physical GPU. The environment has PyTorch 2.13.0+cu130, Transformers 5.12.1,
and FlashInfer 0.6.17. The official workloads are MT-Bench (80 two-turn
conversations, 160 requests) and the MMSpec test split (600 conversations, 723
turns). Correctness runs compare target-only autoregressive (AR) decoding with
DSpark under greedy decoding at concurrency 1.
The AR repeat is exact on both workloads, confirming a deterministic
baseline. DSpark completes every request, but target-output equivalence is not
established. A separate 20-prompt eager probe also mismatches on all 20 prompts,
so disabling decode CUDA Graph does not remove the divergence; its cause remains
unresolved.
Acceptance is aggregated from raw server counters. The acceptance length below
includes the target bonus token.
Separate focused lanes also pass TP=1 and TP=2 inference, greedy and non-greedy
sampling, ragged multimodal CUDA Graph replay, and a post-
/flush_cacherequest.Fixed-output Performance
The formal fixed-output benchmark consists of three same-GPU paired repeats
with service restart and unmeasured warm-up before each mode:
request;
target -> DSpark,DSpark -> target,target -> DSpark.All 2,400 measured requests completed with the required output length. Values
below are medians across the three runs; the interval is the range of the three
paired throughput ratios. The raw service logs and result manifests bind these
runs to the reported source commit and execution-environment freeze; strict
reanalyzing after the provenance audit produced an identical summary.
The gain is not uniform across the latency distribution. MT-Bench C=8 p99 E2E
regresses in all three repeats (paired target/DSpark ratios 0.906-0.920).
MMSpec C=8 has about 9% higher p50 TPOT and mixed p99 E2E results (paired
ratios 0.938-1.092, median 0.961). This supports a stable fixed-output
throughput and p50 E2E improvement under the reported configuration, not a
universal tail-latency improvement.
SSE chunk gaps are not reported as token-level ITL because one speculative
event can expose multiple tokens. TPOT is client-observed and amortized from
the first to last token-bearing event.
Known limitation
Greedy token-level equivalence with target-only decoding has not been established
for the tested public checkpoint. The reported results demonstrate checkpoint
compatibility, request completion, online acceptance, and fixed-output
performance, but do not support a lossless-output claim.
Related work
Thanks to the authors and reviewers of these changes for the checkpoint-layout
analysis and reference behavior.
Contributors
Engine Architecture Group 5, Engine Infrastructure Department, Xiaohongshu
(RedNote): Su Zhan, Fei Ziyu, Hong Chenchen, Luo Zhaokai, Jin Huayi.
CI States
Latest PR Test (Base): ❌ Run #32136288277
Latest PR Test (Extra): ❌ Run #32136288017