fix: allow mtp_num_layers=0 with overlap_moe_expert_parallel_comm#5912
Queued
cuichenx wants to merge 2 commits into
Queued
fix: allow mtp_num_layers=0 with overlap_moe_expert_parallel_comm#5912cuichenx wants to merge 2 commits into
cuichenx wants to merge 2 commits into
Conversation
The MoE expert-parallel communication overlap validation in TransformerConfig.__post_init__ rejected mtp_num_layers=0, only accepting None or 1. Zero MTP layers is semantically identical to None (no multi-token-prediction) and is equally compatible with expert-parallel comm overlap, so it should not fail configuration validation. Providers that explicitly default mtp_num_layers to 0 (e.g. hybrid/GPT-OSS style configs) currently fail at config finalize when overlap_moe_expert_parallel_comm is enabled, even though the model has no MTP layers. Accept 0 alongside None and 1. Signed-off-by: Chen Cui <chcui@nvidia.com>
svcnvidia-nemo-ci
marked this pull request as draft
July 20, 2026 21:17
Contributor
|
This PR has been automatically converted to draft because all PRs must start as drafts. When you are ready for review, click Ready for Review to begin the review process. This will:
See the contribution guide for more details. |
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
cuichenx
force-pushed
the
chcui/mtp-overlap-allow-zero-layers
branch
from
July 20, 2026 21:29
c09ffc4 to
4ce076a
Compare
Signed-off-by: Chen Cui <chcui@nvidia.com>
Connor-XY
approved these changes
Jul 20, 2026
jiemingz
approved these changes
Jul 20, 2026
yaoyu-33
approved these changes
Jul 20, 2026
yaoyu-33
approved these changes
Jul 20, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/29851153570 |
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Jul 21, 2026
Contributor
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/29881500076 |
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.
What
Accept
mtp_num_layers == 0in theoverlap_moe_expert_parallel_commvalidation insideTransformerConfig.__post_init__, alongside the existingNoneand1:Why
mtp_num_layers == 0is semantically identical toNone— both mean no multi-token-prediction layers — and is equally compatible with expert-parallel communication overlap. The previous check (is None or == 1) rejected0, so any config that explicitly defaultsmtp_num_layersto0(rather thanNone) fails configuration validation at finalize time whenoverlap_moe_expert_parallel_commis enabled, even though the model has no MTP layers.This surfaced with hybrid/MoE providers whose
mtp_num_layersfield defaults to0: enabling MoE expert-parallel comm overlap raisedAssertionError: MTP layernum only supports 1 ...during__post_init__, blocking otherwise-valid runs. The downstream Megatron-Bridge project already relaxed its equivalent guard; this brings the Megatron-Core check in line so0is handled at the source.Change
{None, 1}to{None, 0, 1}.None/1;>= 2still (correctly) fails.🤖 Generated with Claude Code