Skip to content

Add norm before up projection for LatentMoE - #6819

Open
i-riyad wants to merge 2 commits into
NVIDIA:mainfrom
santhnm2:rislam/mimo-checkpoint-compat-main
Open

Add norm before up projection for LatentMoE#6819
i-riyad wants to merge 2 commits into
NVIDIA:mainfrom
santhnm2:rislam/mimo-checkpoint-compat-main

Conversation

@i-riyad

@i-riyad i-riyad commented Aug 24, 2026

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What does this PR do?

Add an optional normalization layer after LatentMoE expert-output combination and before the latent up-projection:

experts → combine → fc2_norm → fc2_latent_proj → transformer hidden size

The option is exposed as moe_use_norm_before_up_proj and remains disabled by default, so existing LatentMoE models are unchanged.

When enabled, TENorm selects LayerNorm or RMSNorm from the existing transformer configuration and uses moe_latent_size as the normalized dimension. The LatentMoE projection path already requires Transformer Engine.

This PR also restores moe_use_norm_before_up_proj from checkpoint arguments alongside moe_latent_size. This ensures checkpoint loading reconstructs the norm module and consumes saved mlp.fc2_norm.weight tensors. Without restoring the option, strict checkpoint auditing reports those tensors as unconsumed because the runtime model does not construct fc2_norm.

Regression coverage exercises normalized LatentMoE execution across dispatcher, expert implementation, grouped-GEMM, and latent-size combinations, plus checkpoint-argument restoration.

Related PR: #6449 proposes similar normalized-LatentMoE behavior under the configuration name moe_latent_output_norm and targets dev. This PR retains moe_use_norm_before_up_proj because that key is persisted in existing GDP checkpoint metadata. The naming or compatibility approach can be aligned during review.

Issue tracking

Linked issue: N/A — compatibility fix for existing LatentMoE checkpoints.

Testing

  • BASE_REF=main CHECK_ONLY=true SKIP_DOCS=false bash tools/autoformat.sh
    • Black, isort, pylint, and ruff passed.
  • Focused distributed unit tests on four GPUs, Slurm job 557079:
    • TestLatentMoELayer::test_latent_moe_layer across all 12 parameter combinations
    • test_load_args_restores_latent_moe_norm_from_checkpoint across both parameter combinations
    • Relevant result: 14 norm/checkpoint cases passed per rank.
  • The checkpoint restoration path was also exercised while loading the phase1_v2 GDP/MIMO checkpoints on the staging branch.

Contribution process

Pre-checks

  • I have added relevant unit tests
  • I have added relevant functional tests
  • I have added proper typing to my code
  • I have added relevant documentation
  • I have run the autoformatter.sh on my PR

Code review

Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate review.

All PRs start as draft. Mark this PR ready only after CI is passing.

@copy-pr-bot

copy-pr-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@i-riyad
i-riyad marked this pull request as ready for review August 24, 2026 21:06
@i-riyad
i-riyad requested review from a team as code owners August 24, 2026 21:06
@i-riyad
i-riyad force-pushed the rislam/mimo-checkpoint-compat-main branch from 910e062 to 0ceddb7 Compare August 24, 2026 21:11
rogerwaleffe and others added 2 commits August 24, 2026 15:44
Add an optional Transformer Engine normalization layer after expert-output combination and before the latent MoE up-projection. This preserves the architecture encoded by GDP checkpoints while leaving the existing path unchanged by default.

Signed-off-by: Riyad Islam <rislam@nvidia.com>
Force moe_use_norm_before_up_proj from checkpoint arguments alongside moe_latent_size so inference constructs and consumes the checkpoint's fc2_norm weights.

Signed-off-by: Riyad Islam <rislam@nvidia.com>
@i-riyad
i-riyad force-pushed the rislam/mimo-checkpoint-compat-main branch from 0ceddb7 to d4eee06 Compare August 24, 2026 22:45
@i-riyad i-riyad changed the title Add MIMO checkpoint compatibility for mlp2 and LatentMoE norm Add norm before up projection for LatentMoE Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants