Skip to content

[Feat] dspark: Enable DeepSeek-V4.1 dynamic verify on PD decode - #40567

Open
lidekang160122 wants to merge 9 commits into
sgl-project:mainfrom
lidekang160122:dsv41-pd-dynamic-verify
Open

lidekang160122 wants to merge 9 commits into
sgl-project:mainfrom
lidekang160122:dsv41-pd-dynamic-verify

Conversation

@lidekang160122

@lidekang160122 lidekang160122 commented Sep 21, 2026 •

Copy link
Copy Markdown

DeepSeek-V4.1 DSpark rejects dynamic verify on PD decode. This enables compact
and cap-accept on decode while keeping prefill static and preserving main's
Mooncake/NIXL, attention-DP and interleaved Prefill-CP validation.

The attention TP group broadcasts the chosen budget before selecting the layout
and graph tier. The SPS profiler accepts a separate decode control URL: generation
uses the PD router, while budget updates, observations, abort and reset reach
decode. Observations distinguish logical target rows, padded input rows and the
CUDA graph capacity actually replayed. Off-diagonal profiling rejects eager
fallback, ineffective budget pins and inconsistent execution geometry.

Dependencies and calibration fixes

Validation

Final head 7b8d4f061a is based on main eae134d61f. 120 focused tests and
75 subtests pass
, including real CUDA graph replay of both layout variants,
changing request layouts, short/empty rows, padding, and a real Gloo subgroup
whose leader is global rank 1. Pre-commit passes.

Full-model checks on H20 TP8/EP8 with released DeepSeek-V4.1-Flash weights:

  • Compact graph/eager top-1 agrees at 78/78 monolithic positions and 149/149 PD
    positions, including a separate 30K-context probe. All compared logits are
    finite. PD graph repeats are bitwise equal at those 149 positions.
  • Real Engram hashes agree across graph/eager/repeat, all 42 independent
    target-only prefixes and all 78 compact/static aligned positions. PD batches
    are aligned by request ID and token position across split/reordered layouts.
  • Full-model target-only parity is not established: compact/target-only
    top-1 is 38/42; static/target-only is 36/42; compact/static is 73/78. Static
    graph/eager is 78/78. Monolithic compact graph/eager has weighted MAE 0.07658
    and max absolute error 4.24219; target-only MAE is 0.92134 and max error 14.75.
    A BF16 MoE diagnostic did not eliminate differences and was not full-model
    BF16. These checks establish mapping/history consistency, not losslessness.
  • The full-model probes use 4e6b50e506 on main 306ccf6f57, before the isolated
    forced-pin/profiler corrections. The final main refresh changes GLM chat
    templates, NPU attention and tests; the native token-ID H20 path is unchanged.
    All 20 PR files are byte-identical across that final rebase. Formal decode
    uses final HEAD; static prefill remains on 4e6b50e506.

SPS was recalibrated using actual replayed graph rows: 25 fit cells, numeric
rank 12/12; fit median/max error 1.00%/3.05%
. Ten independent hold-outs pass
median/max 1.55%/12.31%; two additional graph-tier checks pass at 1.86%/2.18%.
Every captured tier has a physical measurement, with at least 10 measured steady
seconds per valid cell. Invalid underfilled/rounding attempts are retained and
excluded. Logical costs expand through graph buckets, so the table invents no
savings within a fixed replay tier. Simulated AL1 is used only for cost fitting.

PD measurements

Two poc-beijing nodes, 8 H20 GPUs per role, TP8/EP8, attention DP1, Mooncake,
1P1D, full verify width 6, Decode max-running 16. Default folded proposal and
overlap, no simulated acceptance, forced budget or diagnostic hooks. Frozen
16 public LongBench-v2 inputs span 12,678–30,324 tokens; caches are flushed per
trial. Each fresh process has an untimed identical warmup. No request retries.

Client concurrency Original paired E2E TPS gains Mean API TPOT reductions Strict draft AL, static → compact
1; N16/output512 +0.39%, −0.07% +0.42%, −0.41% 2.416 → 2.488; 2.478 → 2.496
16; N64/output1024 +8.59%, +5.90% +7.41%, +9.02% 2.661 → 2.346; 2.658 → 2.360

A separate C64/N64/output1024 pair gives +0.86% E2E TPS, API TPOT
8.461 → 7.516 ms (−11.17%), and strict draft AL 2.742 → 2.422. Static/compact
have sampled continuous B16 windows of 24.8/15.8 seconds, but whole-trial full
coverage is only 56.1%/37.5%, below the 95% gate. This pair is not pooled with
ABBA. Its first attempt lost Decode GPU monitoring during compact startup;
that coverage failure is retained, and both arms were repeated with identical
settings after repairing the sampler. All 448 requests in the original ABBA
and replacement pair completed with zero failures/retractions and complete
GPU monitoring. Independent raw-record aggregation and OLS fitting verify all
37 SPS points and all 1,248 requests, including warmups and excluded trials.

Original C16 mean paired E2E gain is 7.24%; C1 is effectively unchanged. These
are complete client-workload results, not stable B16 decode-only claims:
none of the original trials achieves a continuous sampled 10-second full-target
window or 95% whole-trial coverage. C16 repeats the 16 inputs four times and
reuses about 72–73% of prefill tokens within each trial; this is not a cold,
unique-prompt workload. API TPOT is derived from native decode_throughput,
not isolated GPU kernel time. Strict draft AL excludes the bonus; AAL = AL +1.

Complete output strings differ on every original static/compact comparison. Same-mode
repeats also have 0/16 (C1) and 0/64 (C16) exact matches for both static and
compact. Baseline variability does not establish task-quality equivalence.
No answer-quality score or lossless guarantee is claimed. NIXL, attention DP
and Prefill CP have configuration-test coverage only. H20 does not activate
DSv4.1's Blackwell candidate graph variants; the two-variant CUDA regression
covers their layout/mapping geometry, not Blackwell full-model execution.


CI States

Latest PR Test (Base): ❌ Run #39429081078
Latest PR Test (Extra): ❌ Run #39429080833
Latest PR Test (AMD ROCm 10): ❌ Run #39429080934

@lidekang160122
lidekang160122 marked this pull request as ready for review September 21, 2026 12:02
detain pushed a commit to detain/sglang that referenced this pull request Oct 20, 2026
…ens to their requests

With SGLANG_RAGGED_VERIFY_MODE=compact, target verify packs a variable
number of tokens per request. EngramHasher asserted equal blocks per
request and token_req_indices repeated each request draft_token_num
times, so DeepSeek-V4.1 failed at CUDA graph capture (sgl-project#39173).

Add ragged_verify_token_rows, a fixed-size token-to-row lookup over the
layout's qo_indptr. Engram hashes packed verify through its existing
extend path; token_req_indices maps graph padding to pool slot 0.
Uniform verify is unchanged.

sgl-project#40567 by @lidekang160122 identified these two call sites.

(cherry picked from commit 0f85c31b3e1a123330c0ac3972954bc6ea2caacc)
…ens to their requests

With SGLANG_RAGGED_VERIFY_MODE=compact, target verify packs a variable
number of tokens per request. EngramHasher asserted equal blocks per
request and token_req_indices repeated each request draft_token_num
times, so DeepSeek-V4.1 failed at CUDA graph capture (sgl-project#39173).

Add ragged_verify_token_rows, a fixed-size token-to-row lookup over the
layout's qo_indptr. Engram hashes packed verify through its existing
extend path; token_req_indices maps graph padding to pool slot 0.
Uniform verify is unchanged.

sgl-project#40567 by @lidekang160122 identified these two call sites.
DeepSeek-V4.1 captures each verify token tier for two attention variants.
Capture both through the runner, stage live unequal lengths, and check
that token_req_indices and EngramHasher read them from either variant's
layout.
ormandj and others added 6 commits October 20, 2026 20:17
…lized

dspark_sps_profiler --fracs pins dspark_force_budget_frac on a compact
server to profile the off-diagonal SPS cost T(bs, M). Before a profiled
table exists the planner is verify-all, and schedule_layout returned the
cached full-width layout before consulting the budget, so every pinned
cell measured full-width verify and the fitted 2D table was flat in M.
Serve the cached layout only while no fraction is pinned.

Since a pin now trims verify under verify-all, reject pinning it while
SGLANG_SIMULATE_ACC_LEN is above 1, as the DSpark worker already does at
startup for profiled tables.
SGLANG_SIMULATE_ACC_METHOD=multinomial draws the accept length from a
normal around SGLANG_SIMULATE_ACC_LEN, so a configured 1.0 can still
accept past a trimmed compact verify window. Allow the pin only when the
simulated length is exactly 1.0 with match-expected sampling.
@github-actions

This comment has been minimized.

@lidekang160122

Copy link
Copy Markdown
Author

Refreshed this PR on main eae134d61f at head 7b8d4f061a; it also merges
cleanly with current main df13d5dce3. Merged #42709 is retained.

@davidorman I reused the commits from #42718 (packed-token mapping and Engram
extend path) with your attribution instead of carrying a second implementation.
#42711's pinned-budget fixes are also included. Please flag any integration
concern; the dependency commits can be dropped once those PRs merge.

@hnyls2002 @Qiaolin-Yu Could you review the PD decode gate, attention-TP budget
broadcast, profiler control routing and execution-geometry checks? The updated
PR body contains the full validation boundaries: 120 focused tests/75 subtests,
37 physical-row SPS measurements, and two paired PD performance orientations
on 16 H20 GPUs. C16 E2E gains are 8.59% and 5.90%; C1 is effectively unchanged.
The separate C64 pair lowers API TPOT 11.17% but improves E2E TPS only 0.86%.
Invalid calibration attempts and missing-observation trials were retained,
not silently retried or mixed into the successful comparison.

Please pay particular attention to the remaining numerical boundary: real
Engram hashes and compact graph/eager top-1 checks pass, but independent
target-only top-1 is 38/42 for compact and 36/42 for static. Whole generated
strings also vary between same-mode repeats. This is not a lossless or
answer-quality claim. H20 does not exercise the production Blackwell candidate
graph variants; their layout/mapping geometry has CUDA regression coverage.

Could an authorized maintainer trigger the full base + extra CI for this head,
including the DSv4.1 CUDA, TP synchronization and profiler regressions? This PR
currently lacks the CI labels, and the author can rerun failed CI but cannot
grant those labels under the repository's CI permissions.

The automatic Base run
and Extra run
stopped at call-gate / pr-gate. The Base gate explicitly reports a missing
run-ci label; the GPU tests have not run.

@lidekang160122 lidekang160122 changed the title [DSV4.1][DSpark] Enable dynamic verify on PD decode [Feat] dspark: Enable DeepSeek-V4.1 dynamic verify on PD decode Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants