Running a Pruned MoE Multimodal Training Pipeline with FSDP2 on a Domestic Chinese AI Compute Stack
This article summarizes a smoke test of FSDP2 training on a domestic Chinese compute platform. A pruned multimodal Mixture-of-Experts model trained for 400 steps without NaN, Inf, or process crashes, and gradients reached the vision branch. The article covers the three main training pressures behind this work, how FSDP2 shards training state, the operator and routing adaptations, the test setup and results, and the limits of what the test shows. It also lists practical checks for validating MoE training on new hardware.
Conclusion First: A Smoke Test with a Pruned Configuration
This test shows that an FSDP2 training pipeline on a domestic Chinese platform can run continuously for 400 steps on a pruned multimodal MoE model. No NaN or Inf values appeared, no processes crashed, and the vision branch took part in gradient backpropagation. The test did not cover full training of a trillion-parameter model, so it cannot by itself show that training a trillion-parameter model is feasible.
Three Pressures in Training Trillion-Scale MoE Multimodal Models
- Load imbalance from expert routing: At each forward pass, the gating network decides which experts receive each token. Compute load changes dynamically with the input, so some GPUs can sit idle while others become overloaded. The process also depends heavily on bandwidth between cards.
- High memory usage: Under mixed-precision training, parameters, gradients, and the first and second moments of Adam-style optimizers consume a large amount of memory. Single-card memory quickly becomes the upper limit on model size. Data parallelism or tensor parallelism alone rarely covers this overhead.
- Heterogeneous computation across vision and text branches: The vision tower differs from the language backbone in structure and compute characteristics. The cross-modal projection module also adds complexity to sequence parallelism and pipeline scheduling.
FSDP2: Sharding Training State Across Cards
FSDP2 splits parameters, gradients, and optimizer states across the cards. Each card stores only its own shard. During the forward pass, the system uses All-Gather to temporarily assemble the full weights it needs. After the backward pass, the system uses Reduce-Scatter to aggregate gradients and return each shard to its card.
This approach lowers the per-card memory footprint of parameters, gradients, and optimizer states. Activations and communication buffers do not shrink as the number of shards grows, so they still need separate management.
This adaptation kept the native training workflow of NeMo AutoModel and did not rewrite the training framework. Cross-node communication is handled by the MCCL library.
Key Module Adaptations
- Hybrid attention operators: The platform developed high-performance operators for hybrid attention mechanisms, including KDA and Gated DSA. These operators improve computational efficiency on long sequences by optimizing kernel scheduling and memory access patterns. The source does not give specific speedup figures, and this article does not estimate them.
- Expert routing and load balancing: Routing decisions and token dispatch are integrated into the FSDP2 workflow, so different experts can be placed on different devices.
- Chunk Loss: When loss is computed over a long sequence in a single pass, the peak memory used by output logits is high. Chunk Loss splits the sequence into segments, computes loss for each segment, and lowers the peak. This leaves room for larger batches.
Test Configuration: A Pruned Smoke Test, Not a Trillion-Parameter Model
The test ran on two servers with 16 AI accelerator cards in total. The model used a pruned configuration:
- Language backbone: 13 Transformer layers
- Experts: 16 routed experts, with Top-8 activated per token
- Vision branch: the full 27-layer vision tower and the cross-modal projection module
- Data: image-text paired dataset, similar in type to MedPix-VQA
- Global batch size: 16
- Sequence length: 1024
The following were not covered: trillion-parameter scale, million-token long contexts, full-scale expert parallelism, and multi-turn tool calling.
Test Results
- Training loss: The average loss from step 21 to step 70 was approximately 8.94. The average loss over the final 50 steps dropped to 2.18.
- Validation loss: Validation loss fell from 6.53 at step 100 to 4.69 at step 400. No rebound appeared in this test, but 400 steps are not enough to judge overfitting or long-term convergence.
- Memory: Device sampling recorded a peak memory usage of about 44.80 GiB.
- Stability: All 16 processes ran under sustained load without NaN, Inf, or abnormal termination.
These figures come from an internal smoke test. This article does not describe the hardware models, numerical precision, MCCL version, sampling interval, or memory measurement method, so the results should not be compared directly with data from other platforms.
Does the Vision Branch Actually Take Part in Training?
Analysis of the training artifacts shows that the image embedding layer, the first and last layers of the vision tower, and the cross-modal projection module all had nonzero gradients and parameter updates. In this configuration, the vision path was included in backpropagation.
This result only shows that gradients flowed through these modules. It does not show that image-text understanding improved. Judging that requires independent evaluation on image-text tasks.
Boundaries and Risks
- Trade-off between memory and communication: Finer sharding means more frequent All-Gather and Reduce-Scatter operations. When cross-node bandwidth is insufficient, throughput drops noticeably.
- Prefetching and overlapping communication: Prefetching the next layer’s parameters during the forward pass, and running gradient communication alongside the backward pass, can improve pipeline utilization. This benefit depends on tuning MCCL. As parameter scale grows, prefetching may consume extra memory and trigger out-of-memory (OOM) errors.
- Interaction between expert parallelism and FSDP2: All-to-All communication for experts interacts with parameter sharding, and this interaction is central to whether large-scale MoE models can run efficiently. The test scale was small, so it did not cover how this behaves at large scale.
How to Verify MoE Adaptation on Domestic Compute, and Common Pitfalls?
- Confirm that the forward pass, backward pass, and optimizer update all complete on a single machine at small scale before expanding to multiple machines.
- Check gradients module by module for nonzero values. Vision towers and projection layers are easy to miss because of freezing settings or broken computation graphs.
- Record the full test conditions, including hardware, driver, framework, and communication library versions, and the method used for memory sampling.
- Before increasing sequence length, validate numerical stability with short sequences. Then lengthen sequences step by step and watch for OOM errors and NaN values.
- When scaling up, record throughput and communication share separately. Do not rely on the loss curve alone.
