Skip to content

[Experimental] Preserve speculative decoding during prefill across DP ranks - #40118

Merged
Oasis-Git merged 9 commits into
sgl-project:mainfrom
Oasis-Git:feat/dp-prefill-spec
Sep 24, 2026
Merged

Oasis-Git merged 9 commits into
sgl-project:mainfrom
Oasis-Git:feat/dp-prefill-spec

Conversation

@Oasis-Git

@Oasis-Git Oasis-Git commented Sep 18, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

Modifications

Accuracy Tests

Speed Tests and Profiling

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): ❌ Run #35924758446
Latest PR Test (Extra): ❌ Run #35924758238
Latest PR Test (AMD ROCm 10): ❌ Run #35924758471

@Oasis-Git Oasis-Git added run-ci CI: run the baseline test suite on this PR run-ci-extra CI: also run the extra suite (requires run-ci) bypass-fastfail labels Sep 18, 2026
@Oasis-Git Oasis-Git changed the title [Experimental][Feat] DP Prefill Eagle Spec [Experimental] Preserve speculative decoding during prefill across DP ranks Sep 20, 2026
@Oasis-Git

Copy link
Copy Markdown
Collaborator Author

@Oasis-Git

Copy link
Copy Markdown
Collaborator Author

Comment thread python/sglang/srt/managers/scheduler.py Resolved
speculative_moe_a2a_backend_context(),
spec_stage_span("draft"),
):
verify_input = self.draft_worker.draft(draft_batch)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bug] The pure-decode prologue is not used on a heterogeneous step. speculative_num_steps == 0 normally builds a 1-node verify input and can skip draft-extend under SGLANG_SPEC_SKIP_ZERO_STEP_DRAFT_EXTEND (adaptive spec reaches 0 steps). This path always calls draft(). On a non-idle rank draft_forward's loop is range(0) and then indexes token_list[0]; the prefill rank's idle draft returns Nones and builds an idle verify input, so the ranks do not even fail together. The same call also drops pp_proxy_tensors (the prefill branch forwards them) and never runs the PP tail-draft that the pure-decode branch runs after verify.

Suggestion: Share the decode prologue: activate_step_by_batch, the steps==0 trivial verify and draft-extend skip, and pass pp_proxy_tensors into verify. Run the PP tail-draft for non-prefill ranks when pp_size > 1.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still open on faa4f78. This commit does not consult speculative_num_steps before this draft() call, and verify() just below still omits pp_proxy_tensors. The steps==0 prologue remains only on the pure-decode arm of forward_batch_generation.

@ch-wan ch-wan removed the run-ci CI: run the baseline test suite on this PR label Sep 23, 2026
@Oasis-Git Oasis-Git removed bypass-fastfail run-ci-extra CI: also run the extra suite (requires run-ci) labels Sep 23, 2026
@Oasis-Git

Copy link
Copy Markdown
Collaborator Author

/rerun-test test/registered/spec/eagle/test_dp_spec_prefill_coordination.py test/registered/unit/spec/test_dp_spec_prefill_coordination.py test/registered/unit/model_executor/test_mlp_sync_pad_unpad.py

@github-actions

github-actions Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Results for /rerun-test test/registered/spec/eagle/test_dp_spec_prefill_coordination.py test/registered/unit/spec/test_dp_spec_prefill_coordination.py test/registered/unit/model_executor/test_mlp_sync_pad_unpad.py:

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

cd test/ && python3 registered/spec/eagle/test_dp_spec_prefill_coordination.py

🚀 ubuntu-latest (2 tests): ✅ View workflow run

cd test/ && python3 registered/unit/spec/test_dp_spec_prefill_coordination.py
cd test/ && python3 registered/unit/model_executor/test_mlp_sync_pad_unpad.py

@ch-wan ch-wan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed by agent.

This commit closes the startup algorithm gate, the EAGLE3 reject, the MAX_LEN extend rewrite, the dataclass, and the test-base gaps. With the flag left off, scheduling and the forward path still match the previous behavior.

The heterogeneous path still always calls draft(), so speculative_num_steps == 0 misses the trivial-verify prologue and verify() still drops pp_proxy_tensors. That existing thread is unchanged.

Issue counts by severity

  • bugs: 1
  • suggestions: 0
  • nits: 0

@Oasis-Git
Oasis-Git merged commit 1417345 into sgl-project:main Sep 24, 2026
94 of 110 checks passed
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