feat(RL): NeMo-RL × Megatron ModelExpress v2 weight-refit (trainer path)#3068
Draft
KavinKrishnan wants to merge 35 commits into
Draft
feat(RL): NeMo-RL × Megatron ModelExpress v2 weight-refit (trainer path)#3068KavinKrishnan wants to merge 35 commits into
KavinKrishnan wants to merge 35 commits into
Conversation
76b10c4 to
3a1cc9d
Compare
Trainer-side MX publish path for the Megatron policy worker (per-rank native shard + layout sidecar, stream_weights_via_mx), MX helpers (role detection, publish-set collection, MxConfig/builders), and reproducible K8s deploy + smoke artifacts (dense, mixed-TP, PP, MoE, multi-cycle, fan-out). Pairs with the MX client umbrella (modelexpress) and the native vLLM "mx" weight-transfer backend. Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
…GD template Adds a self-contained guide to stand up the full NeMo-RL x Megatron x ModelExpress deployment (MX server + Megatron trainer + Dynamo/vLLM rollouts) with placeholders instead of cluster/namespace/personal specifics, and a generalized rollout DGD template showing both the native "mx" weight-transfer backend (going-forward) and the current --load-format mx + DYN_MX_REFIT_ENABLED flow. Points at the existing MX server manifest, V2 Megatron exemplar, and smoke harnesses. Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
Scrubs personal image / secrets / cache paths / cluster selectors from the V2 rollout exemplar and replaces them with documented <PLACEHOLDER>s. Adds a header explaining what users must create from their own accounts/keys (worker image, a Secret with their HF token, a registry pull secret, PVC, RDMA claim), with kubectl create-secret examples. Adds IPC_LOCK + full UCX aux transports. Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
…arks - examples/ep8_rollout_dgd.example.yaml: TP1 x DP8 x EP8 inference DGD (--enable-expert-parallel + --moe-backend triton + native "mx" backend) that makes EP byte-pruning measurable (current deploys are EP=1, where the filter is a no-op). Placeholder-only. - bench/: push-button differentiator orchestrator (run_differentiator_bench.sh) covering transport baseline, refit-phase breakdown, elastic-join, straggler, and partial/EP byte-pruning, with graceful skips when a live publisher / NCCL path / EP>1 deploy is absent; plus mx_vs_nccl_refit_bench.py, the synthetic EP>1 byte-pruning proof (ep_gt1_byte_pruning.py, runnable now, 8.0x), and the MDL partial-update smoke. README documents scenarios + prereqs. Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
6334212 to
ab6c05a
Compare
…stic, reg, fp8) Single-purpose harnesses that produced the 2026-07-08 GB200 numbers: mdl_correctness (corrupt->warm-reload byte-identity), ep_live_test (live EP placement parity + refit), wire_bench (cross-host 900 Gbps + EP byte-pruning), elastic_bench (decoupled/straggler timelines), reg_bench (arena vs per-tensor), fp8_h1_test (fp8 warm-path diagnosis). Kept in-tree so they survive /tmp wipes.
…DISABLE) - EP4 publishes over RDMA
…per-source pull balance, GT byte-identity)
…32+local) to gather all experts
…T (role-based shard axis)
… per-TP at load); full byte-identity check
…current) — true GPU->GPU transfer time
…oncurrent); fixes use_arena non-reentrancy
…rent multi-arena path)
…acked when no 4-free node)
…ing down under rank-packing; each publishes independently)
- detect_megatron_role/collect_megatron_publish_set: advertise GLOBAL expert id (expert_id + owned_expert_ids = ep_rank*num_local + local; keep local_expert_id) so an EP-trainer -> non-EP/lower-EP rollout gathers experts without collision. - ep_publisher: pass num_local_experts (num_experts // EP). - ep_e2e_rollout.py: live e2e that drives the PRODUCTION MxVllmWeightUpdater in a real vLLM engine (corrupt->refit->generate). NOTE: manual post-hoc refit fights vLLM's pre-owned NIXL/UCX in-process (degraded transport); the real proof needs the NeMo-RL framework wiring the mx backend at engine init.
update_weights_via_mx (megatron branch) now routes through MxVllmWeightUpdater (_update_weights_via_mx_native), which delivers full HF weights (vLLM slices per-TP at load) and supports EP-gather (EP trainer -> lower-EP/non-EP rollout) with per-source global expert remap, reusing the worker's existing receiver (one NIXL agent). This makes the communicated EP-trainer -> TP-rollout config work through the production path (TP1 trainer dense -> TP2 rollout handled by vLLM's loader; EP experts gathered+globalized). MX_MEGATRON_LEGACY_RECEIVER=1 falls back to the bespoke planner path. Full-HF gather is correctness-first; EP byte-pruning is a follow-up. Requires GRPO-loop validation (refit is orchestrated by the training loop).
… EP layout _update_weights_via_mx_native no longer hardcodes moe_expert_filter=False. It now reads cluster.weight_sync.mx_config.moe_expert_filter and introspects the live vLLM FusedMoE layout (ep_world_size/ep_rank/num_experts) to drive EP byte-pruning. Safe: filter is a no-op at EP1 (rollout owns all experts -> full gather, the proven path) and only prunes when the rollout is expert-parallel, using the model's ground-truth layout so we never pull the wrong expert subset.
Capture the exact GB200 EP4-to-TP1 topology and transport settings so the NIXL team can reproduce the TCP-to-RDMA lane selection issue without cluster-specific credentials.
Update the shared GB200 snapshot with the clean three-step result showing that excluding TCP keeps all source pulls on RDMA and removes the dominant refit stall.
Pass each vLLM worker's tensor-parallel identity into the converged MX updater so TP2 refits can validate rank-local behavior.
Provide the two-node GB200 Megatron EP8 and native-MX TP2 GRPO deployment used for the final correctness and performance gate.
Add fail-fast GPU/RDMA/backend checks, size rollout staging memory, and provide a TP2+EP2 variant for live expert-byte pruning validation.
Hold model, topology, batches, and step count constant while swapping only the weight-sync backend for the final MX comparison.
Use published trainer/rollout images, disable unavailable GB200 MNNVL, and size the GRPO batch for eight policy workers.
Use aligned trainer/MDL images, an explicit Dynamo command, namespace-local MX DNS, and a GRPO import preflight so no runtime code overlay is required.
Use vLLM PyNccl on both sender and rollout to measure packed checkpoint update time without NeMo communicator incompatibilities.
Standardize JSON metrics and assertions for filtering, TP slicing, partial refit, elastic joins, stragglers, tree fan-out, and trainer egress balance.
Make BF16/FP8 stage comparisons and MX differentiator runs reproducible with coordinated publishers, normalized timing output, correctness gates, and GB200 benchmark manifests.
Add a standalone two-rank P6 broadcast benchmark and label P5 preconsolidated versus unsupported true-EP semantics so comparisons cannot overclaim topology parity. Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
Fall back to torch.distributed (TCPStore + NCCL) when nemo_rl is absent so the P6 wire-only baseline runs in the model-express-dev sender/receiver images; fix RDMA network annotation keys in the receiver manifest. Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
Pull only tensors required by non-contiguous mixed-TP plans while retaining full-contiguous transfers, and add a real FP8 partial-refit behavioral correctness gate plus EP publisher byte accounting. Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
Pass registry shapes with the pruned tensor-name set so row-parallel fallback receives shaped tensors for local axis-1 slicing instead of flat scratch buffers. Signed-off-by: Kavin Krishnan <kavink@nvidia.com>
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.
NeMo-RL × Megatron trainer/orchestration integration for ModelExpress native weight refit. Pairs with ai-dynamo/modelexpress#482.
What's here
Validated target
Interpretation
For this fixed full-model topology, NCCL is about 2× faster end-to-end. MX's raw RDMA wire is faster, but its current critical path is Megatron→HF translation/staging plus load. MX's differentiators remain expert filtering, heterogeneous layouts, elasticity, straggler isolation, and fan-out.
Artifacts
infra/nrl_k8s/examples/k8s_exemplars/V1/grpo_moe_qwen3_30b_ep8_tp2_dynamo_mx.yaml...ep8_tp2_dynamo_mx.gb200.infra.yaml...ep8_tp2ep2_dynamo_mx.yamlinfra/nrl_k8s/dynamo_mx/bench/preflight_ep8_tp2.shinfra/nrl_k8s/dynamo_mx/bench/native_nccl_refit_bench.py