Repository navigation
Support MTP+PP - #4488
Open
acisseJZhong wants to merge 1 commit into
Open
Support MTP+PP#4488acisseJZhong wants to merge 1 commit into
acisseJZhong wants to merge 1 commit into
Conversation
acisseJZhong
requested review from
fegin,
tianyu-l,
wconstab and
wwwjn
as code owners
September 5, 2026 00:48
acisseJZhong
marked this pull request as draft
September 5, 2026 00:55
acisseJZhong
force-pushed
the
enable_mtp_pp
branch
3 times, most recently
from
September 5, 2026 06:47
bd9290e to
9513cb1
Compare
acisseJZhong
marked this pull request as ready for review
September 5, 2026 06:47
acisseJZhong
force-pushed
the
enable_mtp_pp
branch
from
September 9, 2026 04:02
9513cb1 to
8985f96
Compare
acisseJZhong
requested review from
IvanKobzarev,
SherlockNoMad,
aditvenk and
sanketpurandare
as code owners
September 9, 2026 17:14
acisseJZhong
force-pushed
the
enable_mtp_pp
branch
from
September 9, 2026 17:14
8985f96 to
668eb45
Compare
acisseJZhong
force-pushed
the
enable_mtp_pp
branch
2 times, most recently
from
September 10, 2026 04:25
0e39e97 to
1bf9af3
Compare
acisseJZhong
force-pushed
the
enable_mtp_pp
branch
from
September 10, 2026 04:38
1bf9af3 to
97d3643
Compare
acisseJZhong
force-pushed
the
enable_mtp_pp
branch
from
September 10, 2026 05:04
97d3643 to
d9dbf03
Compare
acisseJZhong
force-pushed
the
enable_mtp_pp
branch
from
September 10, 2026 06:17
d9dbf03 to
3369153
Compare
acisseJZhong
force-pushed
the
enable_mtp_pp
branch
from
September 10, 2026 06:20
3369153 to
7239de8
Compare
4 of 18 tasks
This branch has not been deployed
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.
Summary
This PR enables DeepSeek-V3 MTP with eager pipeline parallelism using the
model-owned pipeline runtime and shared-parameter lifecycle.
The first pipeline stage owns the canonical token embedding, while the final
stage keeps a replica so it can embed shifted MTP tokens locally. Original
token IDs are available on each PP rank from the local microbatch, so pipeline
edges continue to carry only hidden activations.
Design
pipeline_deepseek_v3()adds the MTP-specific pipeline behavior:virtual stage;
embedding ownership;
the final tuple of main/MTP predictions and validity masks; and
_MTPPipelineRuntimesupplies stage-local source token IDs and uses theshared-parameter runtime to synchronize the embedding replica, combine its
gradients, and count the logical embedding once in grad norm.
After pipeline splitting,
num_mtp_layersretains the full model's configuredMTP depth, while
self.mtp_layerscontains only the layers assigned to thecurrent virtual stage. The final stage shifts
mtp_source_tokenswithroll_mtp_sequence(), embeds them with itstok_embeddingsreplica, andreturns
(*predictions, *valid_masks)for regular or chunked loss.The generic
pipeline_llm()now acceptsstage_metadata_fn(stage_idx, num_stages)for eachPipelineStage's input andoutput metadata. When
module_fqns_per_model_partis set, its length definesthe number of virtual stages.
Scope
Tests
Result:
36 passed.Compared
deepseek_v3_debugmodel_mtpon the parent commit without PP againstthis commit with two-stage PP. Both runs used the same seed checkpoint,
--debug.seed=42,--debug.deterministic, five training steps, two 256-tokenmicrobatches per optimizer step, and CUDA graphs disabled.
8.16e-61.01e-4Both runs completed successfully and followed the same loss and grad-norm
trajectories. The small differences are expected from the changed pipeline and
gradient-accumulation order.