Repository navigation
Conversation
Co-authored-by: Zihan Zhang <tiancaizhangdaxian@sjtu.edu.cn>
jianc99
requested review from
BBuf,
DarkSharpness,
Fridge003,
HaiShaw,
HydraQYH,
Qiaolin-Yu,
Ying1123,
celve,
hnyls2002,
ispobock,
merrymercy,
xiezhq-hermann and
yuan-luo
as code owners
October 24, 2026 00:15
This was referenced Oct 24, 2026
4 of 5 tasks
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.
This is component 7 of the DFlash adaptive-verification series. Original implementation and component-only review: jianc99#7. Integration and full-system results: #46182.
Depends on #46187. Until those land, the diff against upstream
mainincludes prerequisite changes. Compact verification on GDN additionally needs #46189.Updated onto upstream
main(6a319e7). All applicable pre-commit checks passed on this branch. The GPU tests and benchmark results below were run previously on the original source branch; they have not been rerun after this upstream update. Submission preparation used AI assistance.Stacked on #46187 (online acceptance estimator). On a GDN target (Qwen3.8), compact mode also needs #46189 (packed ragged GDN verify).
Motivation
DSpark already has adaptive verification. With
SGLANG_RAGGED_VERIFY_MODE=cap-acceptorcompact, the scheduler plans a per-step verify budget from a measured cost table and the drafts' confidence and gives the budget to the most likely drafts (global top-k by survival);compactthen runs the packed ragged verify in token-tier CUDA graphs, whilecap-acceptverifies the whole block and stops acceptance at the planned length. That path is open to DSPARK only, and it needs a trained confidence head. DFLASH drafts, including DFlash2 selector drafts, have no confidence head, so DFLASH always verifies the whole block, even where most of it gets rejected.Modifications
DFLASH reuses the DSpark machinery: the planner, the budget objective, top-k allocation, ragged packing, compact graphs, cutoff accept, the confidence relay, and the cost table with its profiler. The new piece is where the confidence comes from; the other changes below are fixes and gates that DSPARK shares (listed at the end of this section).
OnlineAcceptanceEstimator([Feat] spec: online acceptance estimator for drafts without a confidence head #46187) is a per-position logistic model, refit online from verify outcomes.supports_ragged_verify, the confidence relay, and the scheduler's record and pinned-budget controls.AcceptGreedy, which now also takes precomputed argmax ids.[bs, T / bs], which failed for ragged layouts on Qwen3.5/3.8 targets. Multimodal deltas follow the per-request verify lengths.sglang.benchmark.dspark_sps_profileraccepts DFLASH servers.--fracs) is now scheduled even without a table, so the 2-D compact table can be measured from scratch.SGLANG_SIMULATE_ACC_LENis above 0 and not 1.0, because a simulated acceptance could run past the trimmed lengths.compactis refused at startup when the target attention backend cannot verify packed ragged tokens (supports_ragged_verify_graph). A GDN hybrid target (Qwen3.8) needs [Feat] gdn: run target verify on packed ragged tokens (ReplaySSM) #46189.What DSPARK sees: in both ragged modes, the relay waits for the lagged copy instead of skipping it, and the scatter waits for the previous ring copy; the scheduler refuses to pin a budget under a simulated acceptance length other than 1.0 (cap-accept already refuses that setting at startup). In
compactmode only: a pinned budget is scheduled without a table (cap-accept already did this); small batches skip budget pricing, and full-block plans take the cached uniform layout, without packing when the batch fills a captured tier; on mRoPE targets, spec-verify positions are indexed per request instead of failing the[bs, T / bs]view. These were not measured on a DSPARK draft.Accuracy Tests
Qwen3.8-27B target, DFlash2 block-8 draft, GB300. Client: SPEED-Bench first turns.
Unit tests (CPU and GPU): 116 passed before the estimator's last commit in [Feat] spec: online acceptance estimator for drafts without a confidence head #46187; the same files pass on [Feat] spec: DFlash adaptive verification integration (do not merge) #46182, which has it. They cover:
SGLANG_SIMULATE_ACC_LENguard;The new GPU cases fail with the cutoff or the relay change reverted.
No regression at full budget. T=0, c1,
cap-acceptwith the budget pinned to the full block: the outputs of 12 prompts (up to 768 tokens each) are identical to static verification, token for token.Trimming. T=0, c1,
cap-acceptwith the budget pinned to 50%."think through requirements. User"vs"think through requirements.\n\nUser".Overlap scheduling.
cap-acceptwith a cost table plans the same verify lengths with overlap on and with--disable-overlap-schedule: 7.53 vs 7.51 verify tokens per request in steps of 1-16 requests, 3.84 vs 3.80 in steps of 17-64 requests.TP4 consistency. In test builds, each rank logged its budget and verify-token tier on every decode step. They were identical on all 4 ranks in every step:
TP4 compact serving runs without hangs or errors from c1 to c512 at T=1, and at T=0 at c16 and c64 (acceptance length 4.02 and 3.87).
Speed Tests and Profiling
T=1 (top_p 0.95, top_k 20), up to 4096 output tokens, bf16 mamba state. Decode tok/s = per-request decode rate (output tokens after the first / time after the first token), times concurrency; c1 is the single-request decode rate. Static and compact were run on the same node in the same window.
The compact column needs packed GDN verify for Qwen3.8, so it runs this PR merged with #46189: ReplaySSM, packed conv and GDN verify, including SubSir's deduplicated conv window tile store. It uses the 2-D cost table the profiler measured on that stack. On this PR alone,
compacton a GDN target is refused at startup.TP1,
--max-running-requests 128, decode tok/s:The c64 and c128 static numbers are the mean of two earlier runs on the same stack.
TP4,
--max-running-requests 512, decode tok/s:With the budget pinned to the full block (every draft verified; no packing when the batch fills a captured tier), TP4 compact decodes at 4018 / 6372 / 9222 tok/s at c8 / c16 / c32: 1-3% above the planned budget and still 4-7% below static. So most of the gap below c64 comes from the compact graph path itself, not from trimming; see "Known limitation".
compactpays off at high concurrency: +18% at TP1 c128 and +16% at TP4 c512. This tree does not include #46186 or #46188, and at TP1 c128 and TP4 c512 the running cap equals the concurrency, which reads higher, slightly more for compact. With all seven PRs merged and a cap above the concurrency, #46182 measures +14.4% at TP1 c128 and +12.5% at TP4 c512 (T=1).Use the 2-D table (
--fracsin compact mode). The 1-D diagonal table from a static-mode run overprices the savings at large batches and over-trims.Known limitation
Below c64, compact decodes slower than static: 3-7% at TP1 c4-c32 and 4-9% at TP4 c1-c32; at c64 the two are within 3%. Compact CUDA graphs are captured per token tier, and a tier of T tokens carries min(T, max_bs) request slots, so a small batch replays a graph sized for many more requests (up to 8x the real batch when every block is full). Steps that verify the full block are not routed back to the batch-size-keyed verify graphs that static mode uses. Static mode, the default, is unaffected. The fix, routing full-block steps to the batch-size graphs (or capturing compact graphs per request bucket and token tier), is a graph-runner change left for a follow-up. Until then, keep
staticbelow full load.Related upstream work
resolve relayed verify confidence identically on every TP rank) is the same code change inoverlap_utils.py. Drop that commit if [Fix] dspark: Keep TP ranks planning the same verify budget under overlap scheduling #42717 lands first.SGLANG_SIMULATE_ACC_LEN=1.0unlessSGLANG_SIMULATE_ACC_METHOD=match-expected, becausemultinomialsampling around 1.0 can accept two or more tokens. Prefer its version: if it lands first, the profiler commit keeps only the DFLASH enablement of the profiler and the scheduler controls; if this PR goes first, it should adopt that stricter guard.schedule_layout. The small-batch commit here does more: it skips budget pricing when even the shortest plan replays the full-block graph, decides by graph tier rather than by budget, and skips packing and scattering for full-block layouts. Both edit the same lines ofschedule_layout, so whichever lands second rebases onto the other; the mRoPE commit here can be dropped if either of those lands first. Its GDN part overlaps [Feat] gdn: run target verify on packed ragged tokens (ReplaySSM) #46189.online_confidenceplanner flag on the sameDSparkVerifyPlannerlines as this PR'sexternal_confidence(constructor, confidence-head refusal,carries_confidence), and changes the padding fill of the compact scatter inrun_compact, which the small-batch commit here wraps. If it lands first, this PR moves onto it and uses its flag (see [Feat] spec: online acceptance estimator for drafts without a confidence head #46187)._budget_covers_full_window) to the verify-all branch ofschedule_layout, on the same lines as the small-batch commit here, so whichever lands second rebases. This PR uses the existing offline profiler and does not wire the startup derivation into the DFLASH worker.CI States
Latest PR Test (Base): ❌ Run #40044049685
Latest PR Test (Extra): ❌ Run #40044049597
Latest PR Test (AMD ROCm 10): ❌ Run #40044049553