FSDP2-Based Multimodal MoE Training on 16 Domestic GPUs Across Two Nodes
This article describes a practical adaptation of the multimodal MoE model K3.1 Pro for training on a two-node, 16-GPU domestic accelerator cluster using PyTorch FSDP2. It covers model loading and sharding, gradient synchronization with communication overlap, gradient clipping and BF16 numerical stability, and reliability validation over 400 continuous training steps. It also discusses fault detection, automatic recovery, activation memory management, and runtime monitoring. The results indicate that domestic compute can support a complex model training workflow at this validation scale, while the scope of validation remains limited.
Background: Domestic Compute Begins to Take On Training Workloads
Over the past few years, large model parameter counts have continued to grow, placing higher demands on cluster stability, performance, and software ecosystem support. Domestic GPUs were previously used mostly for inference, while pretraining and full-parameter fine-tuning usually still relied on foreign high-end accelerators. Recently, a cloud provider’s GPU cluster completed training adaptation for a multimodal large model codenamed “K3.1 Pro.” In a two-node, 16-GPU configuration, the model ran continuously for 400 steps without a training interruption. This result shows that domestic compute can already support the training workflow of a complex model, although the validation scale remains limited. The boundaries are discussed later in this article.
The model uses a mixture-of-experts (MoE) architecture and accepts multimodal inputs. Expert routing causes compute load and memory usage on each GPU to change dynamically, and the model parallelism strategy is also more complex. This makes training more sensitive to communication bandwidth and synchronization mechanisms. Traditional data parallelism cannot meet the requirements, so the team chose PyTorch’s native FSDP2 (Fully Sharded Data Parallel 2) to shard parameters, gradients, and optimizer states across GPUs, spreading per-GPU memory pressure across the cluster.
1. Building a Multimodal Training Path with FSDP2
Compared with the first generation of FSDP, FSDP2 mainly improves two areas: sharding is performed at the granularity of individual parameters and represented with DTensor; and communication scheduling is finer-grained, making it easier to overlap with computation. During adaptation, the team completed three main tasks.
1.1 Model Loading and Sharding
When loading weights, all GPUs must receive consistent parameter partitions. The team used uniform sharding rules to generate partition indices. The multimodal model contains a text encoder, a vision encoder, and a fusion decoder. Because these three components have different structures, the team set different sharding priorities for them. The vision encoder has fewer parameters but is compute-intensive, so it uses full-layer replication to avoid cross-node communication. The text and fusion layers are split along tensor dimensions to make memory distribution more balanced. Weights are read through memory mapping (mmap) to avoid loading all parameters at once and causing host memory overflow.
Data sample allocation is handled by data loaders such as DistributedSampler, ensuring that each sample is read by only one GPU. FSDP2 is responsible only for parameter sharding. Separating these responsibilities makes troubleshooting easier.
1.2 Gradient Synchronization and Communication Overlap
During backpropagation, FSDP2 uses Reduce-Scatter to reduce gradients into their respective shards, so each GPU retains only the gradient segment it is responsible for. During forward and backward computation, parameter shards are temporarily aggregated on demand through All-Gather. The team did not treat FSDP2 gradient synchronization as a simple AllReduce, because the two differ in communication volume and memory usage.
Intra-node communication uses high-speed interconnects such as NVLink, while inter-node communication uses InfiniBand or RoCE Ethernet. To improve throughput, the team registered a backward hook for each parameter shard and launched reduction immediately after the shard gradient became ready, without waiting for gradients from the entire model. Expert routing in MoE layers means that some experts are not activated in a batch. Based on this, the team performed communication only for activated expert shards, reducing unnecessary transfers.
1.3 Gradient Clipping and Numerical Stability
In multimodal models, gradient magnitudes differ significantly across modalities, making training prone to divergence. The team used global gradient norm clipping: each GPU first computes the sum of squares for its local shards, then obtains the global norm through one reduction, and finally scales all shards uniformly. The communication overhead of this step needs to be evaluated separately. Before implementation, it is also necessary to confirm whether the framework version in use natively supports shard-level clipping.
Training uses BF16 precision. BF16 has the same exponent range as FP32, so dynamic loss scaling is usually not required. The team focused on outlier detection and gradient norm monitoring. If FP16 were used instead, loss scaling would need to be applied. In the logs of this 400-step training run, no NaN or Inf appeared, and the loss curve declined steadily overall.
2. Stability Validation in a Two-Node, 16-GPU Environment
The test environment consisted of two servers, each with 8 GPUs, interconnected through a multi-rail RDMA network. The 400 steps were a fixed number of iterations, and each step included a complete forward and backward pass. During training, any node failure, link jitter, or memory leak could interrupt the job, so these results mainly reflect the reliability of the overall hardware and software stack.
2.1 Fault Detection and Automatic Recovery
The team set a time limit for synchronization at each step, and a timeout triggered a watchdog reset. On the communication side, the control plane and data plane were separated. The control plane used reliable TCP connections, while the data plane used RDMA. RDMA reliability depends on the queue type (RC or UD) and retransmission configuration, and different links need to be evaluated separately. When the system detected that the packet loss rate exceeded a threshold, it switched to a TCP fallback path.
During the test, a PCIe link within one node degraded once. After the system detected this, it reduced communication parallelism and adjusted the topology, and training was not interrupted.
2.2 Memory and Activation Management
Multimodal inputs often involve long sequences, and activation memory grows quickly with sequence length. The team implemented dynamic activation checkpointing, deciding whether to recompute forward activations during backward based on currently available memory. Because FSDP2 sharding causes per-GPU memory headroom to change during training, the placement of checkpoints was also adjusted accordingly. Recomputation adds compute overhead, so the strategy needs to balance memory headroom against speed.
The team also preallocated a memory pool and periodically defragmented it to reduce performance jitter caused by frequent cudaMalloc calls.
2.3 Runtime Monitoring
Monitoring covered per-GPU utilization, temperature, memory usage, NVLink bandwidth, and network retransmission rate. During operation, compute utilization was tracked within this overall monitoring scope.
