perf: avoid full-vocab all-gather for draft greedy sampling - #1517
Merged
Conversation
sufubao
force-pushed
the
exact-vocab-parallel-greedy
branch
2 times, most recently
from
August 27, 2026 04:20
74841a4 to
8d4eaf2
Compare
sufubao
force-pushed
the
exact-vocab-parallel-greedy
branch
from
August 28, 2026 16:32
8d4eaf2 to
c062b57
Compare
sufubao
force-pushed
the
exact-vocab-parallel-greedy
branch
from
August 28, 2026 17:10
c062b57 to
7a860c9
Compare
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.
Motivation and scope
Draft/MTP proposal generation only consumes a greedy global winner and, where confidence is required, that winner's exact full-vocabulary probability. Gathering every vocabulary logit onto every TP rank wastes communication and memory. This PR changes draft models only; target-model sampling and its dense fallback are unchanged.
Final head
7a860c919731af5b24ee90bb7226a46a995ba4c9is rebased onto the then-currentupstream/main@3e0d9f70ce3e1070504ac812606aff7be6744b5a, which contains merged PRs #1509 and #1513.Design and invariants
ModelOutput.logitsremains a logit tensor. Global IDs and normalization are explicitlogits_token_idsandlogits_logsumexpmetadata.exp(selected_logit - full_vocab_logsumexp).For Qwen3.5-27B (
vocab_size=248320, TP4, BF16 dense logits), the all-gather output per token changes from248320 × 2 = 496640bytes to4 × 3 × 4 = 48bytes: 10,346.7× less collective payload (99.9903%). This follows directly from the actual tensor shapes and dtypes exercised by the CUDA tests and running service.Final H100 correctness
d06cb14f015229a209b9af64700a0f3eca818a2667e83d06875fa87c5c9ecf04git diff --checkpassH100 memory and end-to-end results
The matched TP4/MTP3 service A/B used the same four H100 80GB GPUs, Qwen3.5-27B files, FP8 weights, CUDA Graph settings/cache, source mount strategy, environment, and AIPerf streaming ISL=256/OSL=1024 corpus. Each formal candidate point is the median of three runs and all 42 runs completed with zero request errors.
Geometric-mean output-throughput gain is +8.55%. Relative to the immediate
3e0d9f70control, #1517 adds about +1.5% geometric-mean throughput and +3.9% at C64; C2 is noisy and is not claimed as an isolated improvement.Matched memory samples show:
67617 → 67523 MiB/GPU(94 MiB/GPU saved)69179 → 69105 MiB/GPU(74 MiB/GPU saved)The end-to-end A/B uses the TP4
eagle_with_attMTP3 engine. DSpark-specific confidence semantics are established by the focused tests above; a full multi-node 3P1D DSpark deployment is downstream release validation and is not misrepresented as having been run by this PR.Experiment records
Final candidate:
260829-011244-2688792-sudo-n-docker-run-d-name-pr1517-final-7a860c91-p260829-011605-2699042-home-devsft-aiperf-venv-bin-aiperf-profile-model260829-011645-2701809,260829-011742-2703458,260829-011823-2704888,260829-011917-2706518,260829-012000-2708554,260829-012047-2711649260829-012222-2717180-bash-s260829-012354-2723368-sh-c-sudo-n-docker-logs-pr1517-final-7a860c91-p1Matched control memory:
260829-012505-2724728-sudo-n-docker-run-d-name-pr1517-control-0be08549260829-012806-2734716-bash-s260829-012921-2738290-sh-c-sudo-n-docker-logs-pr1517-control-0be08549-Raw artifacts are retained under
/home/devsft/qwen35_goal_20260829/pr1517_final_resultsand/home/devsft/qwen35_goal_20260829/pr1517_control_memory. Every performance command was wrapped byexp -m.