Repository navigation
[RFC] Add NCCL-M2N as an opt-in transport for checkpoint-engine #7273
Replies: 6 comments 5 replies
|
Thanks for putting this together — nice work. Disclosure up front: I work at NVIDIA, same company as the authors. Commenting The evaluation section is the strongest part of this RFC. Three configurations On sequencing, two observations that may help scope the upstreaming plan:
Happy to help review and push this along. |
|
Hi @achidiac-nv @ISEEKYAN — thanks for the detailed write-up. The performance and memory gains seem to be pretty compelling. One thing I wanted to ask about: is there a plan for supporting quantized weight sync (e.g. QAT) under this design? As far as I can tell, quantization currently hooks into I don't think that's a mechanical port, either. NVFP4 keeps per-group scales alongside a per-tensor global scale, and deriving the global scale is a whole-tensor reduction. Please correct me if I am missing something. |
|
As model is continuously scaling larger, e.g DeepSeek V4 pro 1.6T, Qwen3.8 Max 2.4T, Kimi K3 2.8T, inference engine (vllm/sglang) only support fp8/fp4 for those models.
The problem is that for block-wise quantization (e.g 128x128, 1x128), the weight block maybe shard across ranks, so we can't not do quantization on local shard. The training engine has to all gather shard and do quantization on the full weight, after quantization each rank has same My question is how NCCL-M2N transfer these quant |
|
@achidiac-nv, we came over from @wuxibin89's pointer on #7262 and read the proposal and thread closely. Pre-sharding of rollout TP slices is something we built as well, and composed with the sender striping from #7263, it syncs weights in 1.66 s vs 3.03 s for the stock engine in a paired run (1.82x) on the #7262 reference workload (Qwen3.5-27B bf16, 8x B200 trainer node to 8x B200 vLLM node at TP=4, over EFA). One note on the fabric, since your GB200 row is the closest to ours: the tensor-wise collapse you measured on EFA (10.2 s to 1.90 s with batching) matches how EFA behaves for us. Our engines above move fixed-size buckets rather than tensors for exactly that reason. One question on the prototype: do the NCCL M2N Reshard calls overlap the producer's export collectives, or run after the export completes? That boundary drives most of the complexity on our side of the problem, and we could not tell which is the case from the Nsight breakdown. A question for each side. @achidiac-nv, past the upstreaming plan in the proposal, what is your team looking at next for verl: additional checkpoint engine optimizations, or something broader? And for the verl maintainers (@wuxibin89 @ISEEKYAN): beyond weight sync, where would performance and efficiency contributions be most welcome right now (rollout scheduling and routing, checkpointing and fault tolerance, the reward path, or elsewhere)? We are planning to upstream some of our other work and would rather line it up with the project's direction. |
|
@achidiac-nv For fault tolerance, rollout replicas may leave and join, so NCCL-M2N should support dynamic communication group. |

Uh oh!
There was an error while loading. Please reload this page.
Summary
This RFC proposes an optional NCCL M2N Reshard backend for transferring updated model weights from a training engine to disaggregated rollout workers in RL workloads.
The current verl NCCL checkpoint engine reconstructs the complete model in Hugging Face format and broadcasts it to every rollout rank. That path is portable and should remain the default for now, but it sends each rollout worker more data than required by the rollout layout. For instance, with TP=4 rollout parallelism, each receiver obtains the full model and then retains one quarter of it.
NCCL M2N Reshard uses the source and destination parallel layouts to send each destination rank only the weight shard it needs. In the Qwen3-32B TP=4 workload studied here, this reduces the model payload received by each rollout GPU from 65.5 GB to 16.4 GB.
A prototype integrated this path into a representative disaggregated verl + vLLM GRPO pipeline. The following are the three headline refit (trainer→rollout weight synchronization) results:
* The trainer nodes and rollout nodes were placed on separate racks.
The proposal is to upstream the M2N Reshard backend behind an explicit configuration flag while preserving the existing backend as the default.
Motivation
Disaggregated RL training repeatedly transfers actor weights from trainer workers to rollout workers. The two groups use different distributed layouts:
For the H100 Megatron experiment, the trainer used
[DP=32, TP=4]and the vLLM rollout workers used[DP=8, TP=4]. The legacy path selected one trainer rank and broadcast the full model (65.5 GB of weights) to all 32 rollout ranks as a sequence of 1 GiB buckets. Each rollout rank then kept its TP-local quarter of the model and discarded the other three quarters.This has three costs:
For Qwen3-32B at TP=4, Reshard's layout-aware transfer changes the destination payload as follows:
The 4× payload reduction is the main mechanism. Higher endpoint bandwidth is not required for Reshard to finish earlier because it moves fewer bytes to each receiver.
Background: NCCL M2N Reshard
NCCL M2N is an experimental NCCL-based library for moving a logical tensor between disjoint source and destination meshes (potentially with different sharding/replication layouts). Each side supplies:
ReplicateorShard(dimension)placements);The operation computes the required many-to-many movement from those layouts. In the experiments, the Megatron prototype uses one persistent Reshard communicator spanning the participating trainer and rollout ranks. The FSDP prototype uses four such persistent communicators, one per TP rank. In either case, both sides execute the same ordered sequence of Reshard calls. The transport operates on GPU buffers without passing through CPU memory. In the prototype verl integration, each source tensor is first copied into a registered send buffer. Reshard then writes the destination shard into a separate registered receive buffer, from which it is copied into a CUDA IPC buffer shared with vLLM.
NCCL M2N currently lives in the
nccl_m2n/folder of theNVIDIA/nccl-extensionsrepository, and its APIs are evolving. The initial verl integration should therefore be optional and pinned to a tested NCCL/nccl4py combination.Proposed design
At a high level, the data path is:
1. Use the standard per-tensor producer contract
The recently merged
BaseEngine.get_per_tensor_param_shard()API standardizes how trainer engines expose local parameter shards to checkpoint backends, providing the metadata M2N needs to construct source descriptors. A producer yields:( hf_parameter_name, local_tensor, ShardSpec( full_shape=..., mesh=..., placements=..., to_hf=..., ), )The producer owns its native source layout. The checkpoint engine derives the rollout destination layout and converts both layouts into M2N tensor descriptors. This keeps Reshard out of the trainer implementations and allows the same checkpoint engine to consume Megatron and raw FSDP2 shards.
2. Avoid hidden gathers in the Megatron producer
There is an important caveat in applying the standard API to Megatron. According to the PR, the
ShardSpec.to_hfconversion path is intended to first gather the local MCore shards before converting them to Hugging Face format. In the Megatron experiments, these shards are distributed across the TP group, so this would reintroduce the TP gather that the proposed NCCL M2N Reshard integration is intended to remove.The prototype instead uses MBridge
export_weights_without_gather()to obtain local MCore shards and their TP placement metadata, then converts their names and layouts to Hugging Face format independently on each source rank and exposes each converted shard with its correspondingShardSpec, which records the metadata required to construct the M2N source descriptor (note that this conversion was purpose-built for the prototype: it is model-specific, relies on the legacy vanilla MBridge path, and is not a general upstream solution). As a result, each shard is already HF-named and HF-shaped locally, so itsShardSpechasto_hf=None. No full parameter is assembled before Reshard.Note: A new PR,
verl#7181, merged after this prototype was implemented, performs Megatron-to-HF conversion without a dense TP all-gather. However, in its current form, the implementation does not expose the dense HF-named local shards and placement metadata required by M2N because its API was specifically designed for a different use case (sparse-delta refits). Nonetheless, extending the same Megatron-Bridge machinery with a dense local export could provide the foundation for a general upstream producer solution (this work item is included in the upstreaming plan below).3. Support raw FSDP shards and direct fan-in
The generic FSDP producer can expose its native DTensor mesh and placements through
get_per_tensor_param_shard(). This supports a raw-shard Reshard strategy (where “raw” refers to each rank’s local parameter shard in its native FSDP distribution) without materializing the full Hugging Face model on one trainer rank. Currently, the prototype only accepts one sharded source mesh dimension in this path. For example, with FSDP16→TP4, each rollout TP rank is assembled directly from the portions of the 16 FSDP shards that overlap its destination shard (this generic path is not expected to deliver the best performance with a high trainer-side FSDP degree, since assembling each destination shard may require fragmented transfers from many FSDP ranks).For source layouts with multiple sharded mesh dimensions, such as FSDP4/TP4→TP4, the prototype instead uses a specialized direct fan-in implementation. Rather than passing the complete native FSDP/TP layout to the checkpoint engine, the producer decomposes the transfer into four independent Reshard domains, one per rollout TP rank (each mapping
[FSDP=4, TP=1]sources to[TP=1]destinations). This avoids producer collectives when the trainer and rollout TP placements align (however, a tensor that is replicated across trainer TP but sharded across rollout TP would require an FSDP all-gather followed by a TP slice before transfer).This layout transformation performed by the direct fan-in producer is richer than a raw source
ShardSpec. However, it is more complex and cannot be applied naively to arbitrary layouts. For the initial upstream version, we recommend landing the generic raw FSDP path first, then adding a documented extension for direct fan-in.4. Add Reshard as a checkpoint-engine backend
This RFC proposes adding
ReshardCheckpointEngineas an optional backend selected withbackend=reshard, while preserving the existing NCCL backend as the default. For each tensor, it derives the rollout destination layout, converts the source and destination placement metadata into M2NDistTensordescriptors, and invokes NCCL M2N Reshard.At the start of each refit,
CheckpointEngineManagerinvokesinit_process_group()on both trainer and rollout checkpoint-engine ranks. On the first call, the backend creates the persistent NCCL communicator, M2N handle, and registered symmetric GPU window; subsequent refits reuse them. Participating ranks must execute the same ordered transfer sequence, and if tensor metadata is unsupported or inconsistent, it must be rejected before the first transfer.5. Load only the destination-local shard in vLLM
The vLLM-side weight loader on each rollout rank should directly consume the HF-named shard received by that rank. It must not partition or slice that shard again. For example, with TP4, each rank receives its final quarter of a TP-sharded parameter and loads it directly instead of applying the legacy full-tensor TP slice.
The prototype uses CUDA IPC to expose the GPU buffer containing the received tensor to the colocated vLLM process.
6. Reshard batching interface
Tensor-wise transfer is a useful simple default on low-latency fabrics, but models contain hundreds of tensors that must be transferred during each refit. In some cases, batching these tensors into fewer M2N calls can provide substantial speedups. For example, in the GB200/EFA experiment, a prototype batching patch was added to the verl checkpoint engine delivering a 5× Reshard refit speedup.
This framework-side patch validates the benefit but is not the intended long-term interface. A robust batching API is currently on the NCCL M2N Reshard roadmap.
Evaluation
Common workload
All three measurements use:
Measurements are taken from the verl driver
timing_smetrics.The reported GSM8K accuracy values are used only as a gross corruption signal. These short runs are not statistically meaningful convergence comparisons.
Data point 1: Megatron trainer on H100, TP4→TP4 Reshard
Topology
x86_64).[DP=32, TP=4].[DP=8, TP=4].[DP=4, TP=4]and all 32 rollout destinations[DP=8, TP=4], forming one persistent 48-rank Reshard communicator.RING/UNIFORM· 16 CTAs.Both paths ran using the same software stack and NCCL 2.30.7.
Result
This comparison isolates the effect of the Reshard backend: both runs use the same software stack and workload.
Breakdown: Where the refit savings came from
Measurement: Nsight Systems traces.
Data point 2: FSDP2 trainer on H100, FSDP4/TP4→TP4 Reshard
Topology
[DP=8, FSDP=4, TP=4].[DP=8, TP=4].[DP=8, FSDP=4, TP=1] -> [DP=8, TP=1].RING/UNIFORM· 16 CTAs.The Reshard path used the direct fan-in described above and transferred all 707 parameters through 707 tensor-wise Reshard calls.
Result
The larger improvement relative to Megatron is consistent with increased parallelism when transferring shards from the trainer, in addition to avoiding both the full-model broadcast and producer-side FSDP reconstruction collectives.
Data point 3: Megatron trainer on GB200/EFA, TP4→TP4 Reshard + tensor batching
Topology
aarch64).[DP=16, TP=4].[DP=4, TP=4].[DP=4, TP=4]and all 16 rollout destinations[DP=4, TP=4], forming one persistent 32-rank Reshard communicator.For the Reshard path, the prototype batching patch was applied to group tensors into 1 GiB buffers:
RING/UNIFORM· 16 CTAs.Why batching is required on this EFA path
The tensor-wise Reshard mode was way slower than the batched mode on GB200/EFA:
Batching alone reduced refit by ~80% without changing the 16.4 GB TP-local payload. It avoids the accumulated launch and synchronization latency of issuing 707 tensor-wise operations over EFA. Batching is therefore required for the GB200/EFA configuration.
Result
The physical separation of the trainer and rollout pools reflects the deployment configuration of interest for this type of disaggregated RL workload: they communicate across EFA rather than sharing an NVLink domain.
Correctness and validation
Before transfer, the prototype validates the complete ordered parameter manifest, including names, dtypes, shapes, placements, and byte counts. If validation fails, the backend fails closed because per-tensor fallback is unsafe; users can instead relaunch with the legacy backend.
In our experiments, byte-validation tests passed, all three configurations completed end-to-end training, and the 10-step Reshard runs achieved GSM8K accuracy comparable to the baseline runs. These results show no sign of corrupted or misordered weights.
Configuration
Illustrative configuration:
The final names should follow the checkpoint-engine configuration conventions in the target verl revision. The existing NCCL backend remains the default.
Dependency and build strategy
The H100 and GB200 images were derived from existing verl/vLLM containers: the H100 build used
verlai/verl:vllm017.latest, and the GB200 build usedverlai/verl:vllm023.aarch64.dev1. On top of these base containers, each image added fixed, tested versions of NCCL M2N and its dependencies. NCCL 2.30.7 and its Python bindings (nccl4py) were compiled into each image without replacing PyTorch. The resulting stack was validated with CUDA, PyTorch, Megatron, vLLM, and the platform-specific fabric runtime.Because M2N is currently experimental and optional in verl, users who do not select
backend=reshardshould not need NCCL M2N ornccl4py. When selected, the Reshard backend should fail with a clear diagnostic if the required libraries or runtime capabilities are unavailable.Proposed upstreaming plan
get_per_tensor_param_shard()as the producer contract to expose local tensor shards and their source-layout metadata.ReshardCheckpointEnginebackend.Alternatives considered
Keep the full-model NCCL broadcast: This remains the most portable path and should remain the default. It is also the fallback for unsupported models. Its main cost is the full-model payload on every rollout rank.
Gather to Hugging Face format, then Reshard: Reshard still reduces the payload received by each destination rank but preserves a useless producer-side gather. The only advantage of this approach is that it does not require support for no-gather MCore-to-HF conversion.
Feedback Period
One week.
CC List
@afarjallah-nv, @kingchc, @kaushik-ks, @kwen2501, @spotluri, @wuxibin89, @ISEEKYAN
Any Other Things
Roadmap
Further optimizations: Results can be improved further through contiguous transfer planning (merges fragmented data movements into larger contiguous transfers) and tensor batching (combines many tensors into fewer M2N calls). Both are currently on the NCCL M2N Reshard roadmap to provide robust, library-level implementations.
References
All reactions