Skip to content

[Perf] DSv4.1: Enable decoder bounded replay by default - #44403

Merged
kpham-sgl merged 13 commits into
sgl-project:mainfrom
Oasis-Git:perf/dsv41-decoder-bounded-replay-default
Oct 17, 2026
Merged

kpham-sgl merged 13 commits into
sgl-project:mainfrom
Oasis-Git:perf/dsv41-decoder-bounded-replay-default

Conversation

@Oasis-Git

@Oasis-Git Oasis-Git commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

[codex/claude generated]

Motivation

Enable decoder SWA bounded replay by default for supported standalone CUDA DeepSeek-V4.1 configurations, while preserving an explicit full-prefill opt-out. In our paired accuracy runs, AIME 2026 without an explicit output cap was identical (469/480 each); DeepSWE differed by one solved task and MMMU-Pro by five correct responses. These are finite, stochastic accuracy measurements, not proof of numerical equivalence or a universal speedup.

Modifications

  • Enable decoder replay by default on CUDA DSv4.1 unless disable_decoder_bounded_replay is set for eager/breakable prefill, with the existing DP-attention compatibility checks. Keep PD, context parallelism, encoder replay, other platforms, and incompatible configurations out of automatic enablement.
  • Preserve explicit --enable-decoder-swa-bounded-replay; add --disable-decoder-bounded-replay to retain full prefill, including prompt-logprob support. Bounded replay remains numerically different from full prefill and does not support prompt logprobs.
  • Include the candidate-table capacity fix needed for speculative verification beyond the 1,048,576-token boundary. Select the existing 16 KiB or expanded 32 KiB bitmap according to page-table capacity; reject unsupported capacities above 2M tokens. This fixes a shared indexer issue, not a replay-only failure, and does not enlarge the model context limit.
  • Add default-resolution/CLI coverage and eager/CUDA-graph sorter boundary regressions; update the model cookbook and CLI help.

Base: upstream main 9d68ecce2e811d908551d58a2a8792c75245d181. Main already includes breakable-prefill replay support; this PR does not reapply the historical #43440 patch wholesale.

Accuracy Tests

Completed benchmark results

Each arm used one 4×GB300 node and deepseek-ai/DeepSeek-V4.1-Flash, checkpoint dba1be0a40aa45a94ad051997016db3960a90277. Replay off/on was the intended server-setting difference. TP=4, EP=4, attention DP=1, DSPARK block size=5, FlashMLA, static memory fraction=0.8, max running requests=64, decode graph max batch=64, breakable prefill max tokens=4096, prefill graph max sequence length=16384, chunked prefill=16384, and server random seed=0 were shared.

Workload Samples per arm Replay off Replay on Truncations off / on Harness/request errors off / on
DeepSWE 113 tasks, one attempt 78/113 = 69.03% resolved 77/113 = 68.14% resolved Not aggregated by this harness 0 / 0
AIME 2026, initial 32,768-token cap 30 questions × 16 = 480 453/480 = 94.38% 447/480 = 93.13% 25 / 31 0 / 0
AIME 2026, no explicit output cap 30 questions × 16 = 480 469/480 = 97.71% 469/480 = 97.71% 0 / 0 0 / 0
MMMU-Pro standard (10 options), repaired runs 1,730 questions × 1 1,152/1,730 = 66.59% 1,147/1,730 = 66.30% 18 / 28 0 / 0

AIME majority@16 was 96.67% for both capped runs and 100% for both uncapped runs. The capped results are included for completeness; the uncapped rerun removes the artificial 32K cutoff. Its largest observed outputs were 120,168 tokens off and 107,673 on.

DeepSWE used deep-swe 0b9fabbb63b9104d678fe965e1632f2dd9eaa2ea, Pier 4d3c14041d16443f3f9f460dcdf23629994a304e, mini-swe-agent 2.4.6, Docker task environments, four concurrent trials per arm, temperature=1, top_p=.95, max_tokens=32768, seed=0, and reasoning effort high. No sgl-eval changes were involved in that agent harness.

AIME/MMMU used unmodified sgl-eval 0.1.2 at 93bc2d851a59e57d54fe755202756589a04d3d86: concurrency=16, temperature=1, top_p=.95, thinking enabled, reasoning effort high, no per-request seed. MMMU used the existing image loader, prompt and MCQ grader for MMMU/MMMU_Pro, configuration standard (10 options), test split. This is mmmu_pro, not mmmu_pro_vision or mmlu_pro.

Example full MMMU command (use separate output directories and endpoints per arm):

sgl-eval run mmmu_pro \
  --base-url http://127.0.0.1:31000/v1 \
  --model deepseek-ai/DeepSeek-V4.1-Flash \
  --n-repeats 1 --num-threads 16 \
  --temperature 1.0 --top-p 0.95 \
  --thinking --reasoning-effort high \
  --out-dir results

A one-image smoke evaluation (--num-examples 1) passed on each arm before the full run. Full MMMU artifacts were checked for 1,730 distinct matching IDs, matching question text/expected answers and generation settings, zero exit codes, and recomputed accuracy/finish-reason counts. Saved server configurations differ only in replay selection after excluding runtime metadata. The installed repaired kernel hashes match. The loader did not pin the Hugging Face dataset revision; final prediction files do not contain image bytes for independent byte equality checks.

Revision scope and the original MMMU failure

These full benchmark runs predate the PR base above. DeepSWE/AIME ran on main b60444c62169c7992b98f102cbc4e86d9d117294 plus #43440 head 729c1584e597c915f6dbb6207b89e90a09fcef33, integrated locally as b273c67e75a70c1971eb7715910d15c148136883. Repaired MMMU added local fix 6dc4fa29df069c92668de2fc5ed7766dd49e378b, transplanted in this PR. The full benchmarks have not been rerun on the new main/default-selection patch.

Both original MMMU arms crashed at the context boundary with logical_page_idx < block_table_stride. A minimal sorter reproducer passed at 1M tokens but lost the newest candidate at 1M+1, returning INT32_MAX. Original interrupted scores are invalid and excluded from the accuracy table. Both arms were rerun fresh with the same fix; both completed without request errors.

Omitting max_tokens still permits context-limit truncation. Repaired MMMU reached maximum generated lengths of 1,048,271 off and 1,048,285 on. The remaining truncations reflect length stopping, not a recurrence of the server crash.

Historical fix validation also included six sparse-indexer tests, sorter boundaries at 1,048,575 / 1,048,576 / 1,048,577 / 1,048,586 / 2,097,152 tokens in eager and captured execution, and an end-to-end DSPARK request with 1,048,544 input tokens plus 30 output tokens followed by a healthy server. The text-only boundary reproducer shows that images are not necessary to trigger this bug.

Validation on the new PR base

  • Seven default-resolution and CLI tests passed against the updated source on a GB300 node, including the disable flag and conflicting-flag rejection.
  • The candidate boundary regression passed: five lengths × eager/captured execution (ten subcases).
  • Six existing sparse-prefill indexer tests passed against the new source on GB300.
  • Scoped pre-commit checks passed, including formatting, AST checks, and registered-test validation.

These ran in isolated test processes with the new source; the benchmark servers were not restarted. Full workload reruns, a complete documentation-site build, and upstream CI are not claimed here. Recommended CI covers the new server-argument test, encoder/decoder replay row tests, candidate boundary and sparse-indexer tests, and the GB300 DSv4.1 E2E. The current B300 PD+CP E2E is disabled upstream.

Speed Tests and Profiling

Workload Replay off evaluation time Replay on evaluation time
AIME 2026, 32K cap 876.22 s 869.16 s
AIME 2026, no explicit cap 1,064.43 s 1,037.55 s
MMMU-Pro, repaired 7,291.75 s 8,635.92 s

DeepSWE took approximately 6h 5m per arm, including agent tool execution and task grading. These are end-to-end workload durations, not isolated prefill latency measurements.

MMMU generated 31,363,333 completion tokens off versus 42,100,497 on. Aggregate output rates were 4,301 versus 4,875 tokens/s, but different output lengths, reasoning loops, and batch occupancy prevent treating that ratio as a controlled replay speedup. The controlled fixed-token comparison below measures speed separately from these accuracy workloads. Single stochastic runs also do not establish statistical equivalence of accuracy.

Recorded runtime: PyTorch 2.14.1+cu130, sgl-kernel 0.4.9, FlashInfer/cubin 0.7.1, FlashInfer JIT cache 0.7.1+cu130; Python UnifiedTreeCore fallback on both arms.

Controlled fixed-token comparison on 4×GB300

Measured October 16, 2026 on the same node, sequentially replay off then on. Identical deterministic synthetic token-ID prompts, temperature=0, ignore_eos=true, exact output lengths, and three repetitions per case. Shape-specific warmup and server startup are excluded; the radix cache was flushed before each repetition. All 348 measured requests per arm passed exact prompt/output-length checks with zero cached tokens.

Both arms used DeepSeek-V4.1-Flash, TP4/EP4, attention DP=1, FlashMLA, DSPARK block size 5, breakable prefill, 16,384-token chunks, and a 16,384-token prefill graph context limit. Encoder replay was disabled. Effective server settings matched apart from decoder replay and runtime metadata.

Single-request time to first token, with one output token and five requests per repetition. Values are medians of the three per-repetition medians; speedup = off/on. This is client-observed first-token latency, not GPU-kernel-only time.

Input tokens Replay off TTFT Replay on TTFT Speedup
1,024 42.89 ms 42.92 ms 0.999×
8,192 174.50 ms 172.54 ms 1.011×
32,768 480.92 ms 346.89 ms 1.386×
65,536 974.77 ms 700.62 ms 1.391×

End-to-end output throughput, with concurrency 16, 32 requests per repetition, and exactly 128 output tokens per request. Values are median repetition throughput; speedup = on/off.

Input tokens Replay off output tokens/s Replay on output tokens/s Speedup
1,024 2054.97 2107.11 1.025×
8,192 792.69 885.98 1.118×
32,768 256.38 337.22 1.315×

Long-prompt first-token latency improved by approximately 1.39× (28% lower latency) at 32K/64K input; 32K concurrent throughput improved 1.315×. Short single-request latency was essentially unchanged. Concurrent TTFT did not improve uniformly: at 1K input it was 163 ms off versus 184 ms on.

Revision and interpretation limits: these measurements use the retained repaired accuracy-test runtime, not a fresh checkout of current main or this PR head. The installed package reports 0.0.0.dev1+g67eab5705; that build-version string alone does not identify later local patches. The candidate-table header SHA-256 matches the repaired benchmark (d7088c2ac6c282ef2ae42cadcf527b21c36b165501add4d449b1c596bbbd16a2). Synthetic token IDs control input shape but do not represent natural-language quality or every production workload. DSPARK acceptance can differ between modes even with fixed output counts. The sequential order was not counterbalanced, and three repetitions do not establish statistical confidence.

Checklist

  • Format changed code with pre-commit.
  • Add default-selection, CLI, and candidate-boundary tests.
  • Document default scope and opt-out.
  • Provide accuracy results and workload timings with revision and interpretation limits.

CI States

Latest PR Test (Base): ⏳ Run #38989515697
Latest PR Test (Extra): ❌ Run #38989515539
Latest PR Test (AMD ROCm 10): ⏳ Run #38989515613

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@Oasis-Git Oasis-Git changed the title [DSv4.1] Enable decoder bounded replay by default for supported CUDA configurations [Perf] DSv4.1: Enable decoder bounded replay by default Oct 16, 2026
@Oasis-Git

Copy link
Copy Markdown
Collaborator Author

[Codex]: Running a minimal targeted validation set for head 8fa0a53: the TP4+EP4, DP4+EP4, and TRT-LLM GB300 E2E configurations (GSM8K and MMMU-Pro with default decoder replay and explicit breakable prefill graphs), the candidate-table context-boundary regression, and the encoder/decoder replay combination unit tests. This request covers five test files; it does not request the full CI suite or AMD coverage.

@Oasis-Git

Copy link
Copy Markdown
Collaborator Author

/rerun-test registered/e2e/models/test_deepseek_v41_flash_gb300_tp4ep4.py registered/e2e/models/test_deepseek_v41_flash_gb300_dp4ep4.py registered/e2e/models/test_deepseek_v41_flash_gb300_trtllm_bounded_bcg.py registered/kernels/ops/attention/test_dsv41_candidate_table_boundary.py registered/unit/model_executor/test_encoder_swa_replay.py

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🚀 4-gpu-gb300 (3 tests): ❌ View workflow run

cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_tp4ep4.py
cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_dp4ep4.py
cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_trtllm_bounded_bcg.py

🚀 4-gpu-b200 (1 test): ✅ View workflow run

cd test/ && python3 registered/kernels/ops/attention/test_dsv41_candidate_table_boundary.py

🚀 ubuntu-latest (1 test): ✅ View workflow run

cd test/ && python3 registered/unit/model_executor/test_encoder_swa_replay.py

@hnyls2002

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Oct 17, 2026
@hnyls2002

Copy link
Copy Markdown
Collaborator

/rerun-test registered/e2e/models/test_deepseek_v41_flash_gb300_tp4ep4.py registered/e2e/models/test_deepseek_v41_flash_gb300_dp4ep4.py registered/e2e/models/test_deepseek_v41_flash_gb300_trtllm_bounded_bcg.py registered/kernels/ops/attention/test_dsv41_candidate_table_boundary.py registered/unit/model_executor/test_encoder_swa_replay.py

@github-actions

github-actions Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

🚀 4-gpu-gb300 (3 tests): ✅ View workflow run

cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_tp4ep4.py
cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_dp4ep4.py
cd test/ && python3 registered/e2e/models/test_deepseek_v41_flash_gb300_trtllm_bounded_bcg.py

🚀 4-gpu-b200 (1 test): ✅ View workflow run

cd test/ && python3 registered/kernels/ops/attention/test_dsv41_candidate_table_boundary.py

🚀 ubuntu-latest (1 test): ✅ View workflow run

cd test/ && python3 registered/unit/model_executor/test_encoder_swa_replay.py

@kpham-sgl
kpham-sgl merged commit 3603824 into sgl-project:main Oct 17, 2026
150 of 178 checks passed
Rockdu added a commit to radixark/miles that referenced this pull request Oct 31, 2026
… v0.5.23

SGLang v0.5.23 (sgl-project/sglang#44403) turned
enable_decoder_swa_bounded_replay into Optional[bool] and resolves an unset
value to on for DeepSeek-V4.1 on CUDA. Bounded replay runs the layers after
the last kv_source layer over only the prompt tail; SGLang's own help says it
is not numerically equivalent to full prefill and to disable it for RL
rollouts whose logprobs must match the trainer. miles never set it, so a
default DSv4.1 run would have drifted from the trainer, and replayed routing
for those layers would no longer line up with the prompt rows.

When the user leaves it unset, pass False so every engine keeps full
prefill; an explicit --sglang-enable-decoder-swa-bounded-replay and a
per-group override still win. On v0.5.22 the field defaults to False, so
nothing changes there. The chart snapshots gain the rendered
--no-enable-decoder-swa-bounded-replay flag.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deepseek documentation Improvements or additions to documentation jit-kernel run-ci CI: run the baseline test suite on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants