Distributed Training of a Trillion-Parameter MoE Multimodal Model on China-Made GPUs
This article presents a practical adaptation for training a ~2.8-trillion-parameter MoE multimodal model on a two-node, 16-GPU China-made GPU platform. It covers the minimal-intrusion design, FSDP2-based sharding, cross-node communication with MCCL, dynamic sparse attention, MoE routing, vision-language module integration, and a 400-step stability validation, then summarizes reusable engineering practices.
1. Background: The Training Bar for Very Large Multimodal Models Keeps Rising
In recent years, open-weight native multimodal large models have continued to scale. One recently discussed model with about 2.8 trillion total parameters supports up to 1 million tokens of context and combines visual understanding and tool calling. Its architecture uses a hybrid sparse attention design, such as key-value dynamic retrieval and gated sparse attention, and adopts a MoE architecture as the backbone. This enables a very large total parameter count while keeping the number of activated parameters relatively controllable for training and inference.
These architectural advances create direct engineering pressure:
- Dynamic sparse attention: Attention computation is no longer a fixed dense pattern. It depends on a subset of key tokens retrieved at runtime, so operator shapes change dynamically with the input. This places high demands on operator library completeness and compiler optimization.
- MoE expert routing: Each token is routed to several experts, creating substantial cross-GPU communication for load balancing, token dispatch, and combine.
- Joint image-text training: The vision encoder, cross-modal projection layer, and language backbone need a unified forward pass, backward pass, and parameter update flow. The gradient synchronization path is more complex.
- Memory and compute pressure: Trillion-level parameters mean the parameters alone require several terabytes of memory. Adding gradients, optimizer states, and activations makes single-GPU deployment impossible, so deep distributed parallelism is required.
This adaptation work starts from that point: on a China-made GPU platform at a two-node, 16-GPU scale, verify whether this complex architecture can run a complete and stable training loop.
2. Overall Approach: Preserve the Native Training Flow with Minimal Intrusion
2.1 Design principles
The first principle is not to break the native flow of the upstream training framework. Based on the AutoModel paradigm of mainstream large-model training frameworks such as NeMo, model definitions, data pipelines, and parallel strategies are highly modular. If model code were heavily rewritten for porting to new hardware, maintenance costs would become uncontrollable when upstream frameworks or model versions are upgraded. Therefore, this approach chooses to:
- Keep the upstream model definition unchanged at the model layer, and only replace or supplement hardware-related low-level operators;
- Reuse standard framework interfaces at the parallel strategy layer, injecting distributed strategies as configuration;
- Adapt the communication layer to the collective communication library provided by the China-made GPU vendor.
2.2 FSDP2-based memory sharding
Memory is the first bottleneck in large-model training. This approach uses FSDP2 (second-generation Fully Sharded Data Parallel) as the core parallel strategy, sharding parameters, gradients, and optimizer states across 16 GPUs. During each training step, the full parameters of a layer are gathered only when that layer is computed, and released immediately after computation.
Compared with first-generation flat sharding, FSDP2 manages state per parameter, bringing two key benefits:
- Finer granularity: Different sharding and communication strategies can be used for MoE expert parameters and dense parameters, avoiding unnecessary aggregation of expert parameters when they are not needed.
- More controllable communication-compute overlap: Per-parameter prefetch scheduling is more flexible. The next layer’s parameters can be gathered earlier during backward propagation to hide communication overhead.
For a 2.8-trillion-parameter model with mixed-precision training, even with FP8 or BF16 parameter storage plus FP32 master weights and optimizer momentum, the total state is on the order of tens of terabytes. After 16-GPU FSDP2 sharding, the static memory per GPU is compressed into a bearable range, leaving remaining memory for activations and intermediate results from long-context processing.
2.3 Cross-GPU and cross-node communication
Two nodes with 16 GPUs means communication has two tiers: intra-node high-speed interconnect and inter-node RDMA networking. In this approach, all cross-GPU communication—all-gather for parameter aggregation, reduce-scatter for gradient reduction, and all-to-all for MoE dispatch—is handled by the GPU vendor’s collective communication library (MCCL).
There are several key engineering optimizations:
- Communication group partitioning: Establish independent communication domains for the FSDP data-parallel group and the MoE expert-parallel group, avoiding blocking between communications with different semantics.
- Asynchronous communication: Overlap gradient reduction with backward computation using asynchronous streams. In particular, triggering reduce-scatter layer by layer during backward can significantly shorten tail latency.
- All-to-all shaping: Token dispatch in expert routing is a typical all-to-all pattern, and inter-node communication is sensitive to network topology. In practice, cross-machine traffic is usually reduced by limiting the expert-parallel domain to avoid crossing nodes or by using hierarchical all-to-all.
3. Core Module Adaptation: Attention, Routing, and Cross-Modal Integration
3.1 Dynamic sparse attention operators
The difficulty of hybrid sparse attention is that the logic for retrieving Top-K key tokens depends on runtime data and cannot simply reuse static dense attention operators. The adaptation approach decomposes it into three steps:
scores = compute_block_scores(Q, K_block_summary) # block-level scoringtopk_idx = top_k(scores, k=budget) # dynamic retrievalout = sparse_attention(Q, K[topk_idx], V[topk_idx]) # sparse attention
Block-level scoring and Top-K retrieval can be mapped to general matrix multiplication and sorting operators. The sparse attention body is implemented through a variable-length attention interface: each retrieval result is converted into variable-length sequence offsets (cu_seqlens), reusing highly optimized variable-length operators. For million-token contexts, ring attention or context parallelism is also needed to split the sequence dimension across GPUs, avoiding excessive per-GPU sequence length and memory explosion.
3.2 MoE dynamic routing
Expert routing adaptation focuses on two levels:
- Routing computation: The gating network outputs Top-K expert selections and weights. This is lightweight computation, but it must be deterministic: the same input must produce the same routing result across GPUs. This requires unified random seeds and precision handling.
- Token movement: Routing results determine which GPU and which expert each token is sent to. This involves four stages: data rearrangement, cross-GPU all-to-all, expert computation, and inverse permutation of results. Particular attention must be paid to consistency of expert capacity and drop policy, as well as correct gradient backpropagation for the load-balancing auxiliary loss (
aux loss).
3.3 Vision encoding and cross-modal projection
The multimodal path includes three segments: the vision encoder, the projection layer, and the language backbone. Key adaptation points include:
- The vision encoder is usually a dense architecture, such as a ViT-style structure, and can use a different parallel strategy from the language model, for example, parallelism only along the data dimension. Gradients from the two segments must be correctly aggregated before parameter updates.
- The cross-modal projection layer bridges image and text features. Its input distribution changes dynamically with the vision encoder output. Numerical stability must be monitored during training, and higher compute precision can be used for the projection layer when necessary.
- The three modules are placed under the same optimizer scheduling. Hyperparameters such as learning rate and weight decay can be configured by group, but parameter-state sharding must align with the FSDP2 grouping logic.
4. Stability Validation: 400 Consecutive Steps on Two Nodes and 16 GPUs
Whether the adaptation succeeds ultimately depends on continuous training measurements. This validation ran 400 consecutive training steps in a two-node, 16-GPU environment, focusing on the following metrics:
- Loss curve: Align with the same configuration on a reference platform to confirm correct forward numerics and gradient backpropagation, with no abnormal spikes.
- Throughput stability: Per-step time remains stable over hundreds of steps, with no memory leak or communication degradation as step count grows.
- Memory watermark: Memory usage is balanced across GPUs, the MoE load-balancing loss converges, and there is no single-GPU OOM risk.
- Checkpoint resume: After saving and restoring a distributed checkpoint, training state, including optimizer shards, can resume losslessly.
The significance of 400 steps is not the number itself, but that it covers multiple checkpoint cycles and multiple communication pressure peaks, enough to expose most stability defects.
5. Lessons and Best Practices
Looking back at the entire adaptation process, several lessons are broadly useful for similar work:
- Prioritize reuse of upstream framework abstractions, confining hardware differences to the two lowest layers: operators and communication. Avoid intruding into model definitions.
- Run the dense path first, then activate sparse modules one by one. Each time a module is enabled, run a loss alignment regression to narrow the problem scope.
- Communication grouping is a watershed for MoE training performance. Be sure to distinguish data-parallel, expert-parallel, and context-parallel communication domains and tune them separately.
- For long-context scenarios, derive the memory budget from activations, not only from static parameters. When necessary, introduce activation recomputation to trade compute for space.
As the China-made compute ecosystem continues to improve in operator libraries, communication libraries, and compiler toolchains, trillion-parameter multimodal model training on China-made platforms is moving from “feasible” to “usable.” For enterprises and developers evaluating training infrastructure, framework compatibility, communication efficiency, and stability validation methodology are more valuable for decision-making than single-point compute metrics.
