Megatron: Nemotron RL support - #51
Open
Zhichenzzz wants to merge 3 commits into
Open
Conversation
added 3 commits
June 10, 2026 06:52
Squashed transplant of mtp-hybrid + cleanup pass: - Design mirrors nvidia/main (parse_hybrid_pattern, mtp_model_layer rename, is_mtp_layer plumbing, standalone process_mtp_loss, MTP FLOPs accounting). - Fixes the routing-replay MTP bypass regression (is_mtp_layer into the R3 gate; the old Router.is_mtp flag had lost its only writer); removes dead set_is_mtp; upstream-form isinstance attn-mask validation; deduped arguments asserts; zero reformat-only churn. - Carries the make_viewless_tensor dead-store fix and the vocab_size test typo fix. - Rebased onto current miles-main (router layer_number / tid2eid / R3 input_ids co-exist with is_mtp_layer).
The bridge/mamba path lacks the GPT provider's enable/disable dance around MTP block construction, so MTP MoE routers registered replay slots that the trainer-side fill (which only records main-decoder MoE layers) never populates -- a main layer then pops an empty slot (IndexError: len(top_indices_list)=0). Gate registration on is_mtp_layer, mirroring the existing is_mtp bypass in topk routing.
The MambaStack layer builder passed is_mtp_layer to attention layers but not to MoE layers, so MTP-block MoE routers saw is_mtp_layer=False -- defeating both the rollout-replay slot-registration skip and the is_mtp topk bypass (the slot/fill desync then popped an empty replay: IndexError len(top_indices_list)=0).
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.
radixark/miles#1284