Skip to content

spec: DSPARK PD-disaggregation via native draft-KV transfer - #33204

Closed
bobcao3 wants to merge 1 commit into
sgl-project:mainfrom
bobcao3:dspark-pd-disagg
Closed

bobcao3 wants to merge 1 commit into
sgl-project:mainfrom
bobcao3:dspark-pd-disagg

Conversation

@bobcao3

@bobcao3 bobcao3 commented Aug 1, 2026

Copy link
Copy Markdown

Turns out the DSPARK draft-KV transfer landed upstream already / is in some other PR that landed recently

Reduced from the original DSPARK PD-disagg commit: the spec_info
DSPARK branch and draft-KV transfer landed upstream via #32541 and the
DP/EP draft-batch fields via #33098, this one-line guard is the only piece
still missing on main.


Original PR body

Motivation

We are trying to bring up 4xB200 prefill + 4xB200 decode for Dsv4 flash 0731 (excellent model),
but with vanilla nightly we bumped into incompatibilities between DSPARK and PD-disagg (and file based HiCache).

Originally we went with #31466 but found that has incompatibility with HiCache,
after some inspection I think we can get this done with a much smaller set of changes presented here,
instead of the full hidden-row transfer system.

We have now a running setup on top of 07/31 nightly showing DSPARK with 3-5x improvement in single user case and KV cache seems to be functioning correctly.

Modifications

Two hunks make DSPARK work in PD disaggregation with symmetric TP:

  1. spec_info.py: build_disagg_draft_input DSPARK branch
  2. overlap_utils.py: FutureMap.resolve_future tolerates future_indices=None.

To get a working setup:

  • A prefill engine started with --speculative-algorithm DSPARK runs DSparkWorkerV2._forward_prefill on every extend batch, building draft KV from target hidden states exactly like unified serving.
  • For DSV4 / SWA, PD transfer now ships draft KV alongside target KV
  • --speculative-algorithm DSPARK must be on both engines

Here is our full launch commands:

Prefill:

SGLANG_HICACHE_FILE_BACKEND_STORAGE_DIR=/mnt/nvme/hicache \
sglang serve \
  --model-path deepseek-ai/DeepSeek-V4-Flash-0731 \
  --trust-remote-code \
  --tp 4 \
  --base-gpu-id 0 \
  --moe-runner-backend flashinfer_mxfp4 \
  --disable-flashinfer-autotune \
  --swa-full-tokens-ratio 0.1 \
  --reasoning-parser deepseek-v4 \
  --tool-call-parser deepseekv4 \
  --speculative-algorithm DSPARK \
  --chunked-prefill-size 16384 \
  --mem-fraction-static 0.90 \
  --enable-hierarchical-cache \
  --hicache-ratio 2 \
  --hicache-size 0 \
  --hicache-mem-layout page_first_direct \
  --hicache-io-backend direct \
  --hicache-write-policy write_through \
  --hicache-storage-backend file \
  --hicache-storage-prefetch-policy wait_complete \
  --disaggregation-transfer-backend nixl \
  --disaggregation-mode prefill \
  --disaggregation-bootstrap-port 8998 \
  --host 0.0.0.0 \
  --port 30000

Decode:

sglang serve \
  --model-path deepseek-ai/DeepSeek-V4-Flash-0731 \
  --trust-remote-code \
  --tp 4 \
  --base-gpu-id 4 \
  --moe-runner-backend flashinfer_mxfp4 \
  --disable-flashinfer-autotune \
  --swa-full-tokens-ratio 0.1 \
  --reasoning-parser deepseek-v4 \
  --tool-call-parser deepseekv4 \
  --speculative-algorithm DSPARK \
  --chunked-prefill-size 4096 \
  --mem-fraction-static 0.87 \
  --cuda-graph-max-bs 64 \
  --disaggregation-transfer-backend nixl \
  --disaggregation-mode decode \
  --host 0.0.0.0 \
  --port 30001

Router:

python3 -m sglang_router.launch_router \
  --pd-disaggregation \
  --prefill http://127.0.0.1:30000 8998 \
  --decode http://127.0.0.1:30001 \
  --host 0.0.0.0 \
  --port 8000

CI States

Latest PR Test (Base): ❌ Run #30960127898
Latest PR Test (Extra): ❌ Run #30960127702

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@bobcao3

bobcao3 commented Aug 1, 2026

Copy link
Copy Markdown
Author

/tag-and-rerun-ci

…dices

A PD decode bootstrap draft input built on a spec-less engine (or before
the first overlap publish) carries future_indices=None; the relay path
indexed it unconditionally. Return early, matching the existing
zero-length guard one line below.

(Reduced from the original DSPARK PD-disagg commit: the spec_info
DSPARK branch and draft-KV transfer landed upstream via sgl-project#32541 and the
DP/EP draft-batch fields via sgl-project#33098 — this guard is the only piece
still missing on main.)
@hnyls2002

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci label Aug 5, 2026
@bobcao3

bobcao3 commented Aug 5, 2026

Copy link
Copy Markdown
Author

Turns out the DSPARK draft-KV transfer landed upstream already / is in some other PR that landed recently.

Copy link
Copy Markdown

Follow-up regression coverage: #34410 pins the existing DSpark PD-decode draft-input handoff on current main.

The new PR is test-only and does not duplicate the production support discussed here. It asserts the first-decode contract (SpecInput must already exist) and the overlap relay initialization (future_indices / FutureMap) so this integration cannot silently regress.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants