Adapting Domestic GPUs for Training Trillion-Parameter MoE Multimodal Models: Engineering Practices

    As multimodal large models scale to the trillion-parameter level, model architectures have shifted from dense Transformers to a combination of Mixture of Experts (MoE) and sparse attention. This article systematically outlines the technical points, evaluation methods, and deployment paths for adapting and validating trillion-parameter MoE multimodal models on domestic GPUs from a general engineering perspective. It covers scaled-down configuration validation, the core pillars of distributed training, and the challenges of transitioning from pipeline validation to full-scale pretraining.

    In recent years, the parameter scale of multimodal large models has rapidly climbed to the trillion-parameter level, and model architectures have shifted from dense Transformers to a combination of Mixture of Experts (MoE) and sparse attention. At the same time, the pace of adapting domestic GPUs for large model training has significantly accelerated, gradually moving from inference scenarios to training clusters of thousands or even tens of thousands of cards. Recent industry cases show that domestic chip manufacturers can complete training pipeline validation for ultra-large parameter models under controlled configurations, with training loss curves converging normally and no numerical overflow or abnormal interruptions. This article does not target any single vendor; instead, it systematically outlines the technical points, evaluation methods, and deployment paths for this type of validation work from a general engineering perspective.

    1. Why Trillion-Parameter MoE Multimodal Models Are Difficult to Adapt

    To understand the difficulty of adaptation, it is first necessary to understand the architectural features of the target model. Taking a typical 2.8-trillion-parameter native multimodal model as an example, its technical challenges mainly come from three levels.

    1. Communication pressure from expert routing. In the MoE architecture, each token is distributed by the router to Top-k experts for computation. Experts are usually partitioned across different devices, meaning each card must execute large-scale all-to-all communication during every forward and backward pass. The communication volume is directly related to the number of experts, hidden dimensions, and batch size. If there are defects in the communication library’s implementation under multi-card topologies, it can lead to a sharp drop in throughput at best, or gradient pollution at worst.

    2. Operator complexity of dynamic sparse attention. Sparse attention is not a fixed-pattern mask; it dynamically determines the attention range based on input content. This means the forward kernel must handle variable-length, irregular computation blocks, and backward gradient propagation must precisely correspond to the forward sparse paths. These operators often lack mature, ready-made implementations on new hardware, requiring the completion of the full forward and gradient operator chain starting from mathematical definitions.

    3. Memory and scheduling coupling of multimodal branches. The vision tower and cross-modal projection module share the optimizer and data flow with the language backbone. The length distribution of image-text samples is highly uneven, easily causing load imbalance in pipeline or data parallelism. The memory peak often occurs at the junction between visual encoding and cross-modal projection, placing refined requirements on memory management strategies.

    2. Scaled-Down Configuration Validation: Breaking Through the Training Pipeline at Low Cost

    Starting pretraining directly at a full trillion-parameter scale is high-risk for any hardware platform. A common practice in the engineering community is to first perform a scaled-down configuration validation. The goal is not to obtain usable model weights, but to answer three questions: Are the operators correct? Is the communication working? Does the loss converge?

    A typical scaling-down strategy includes: truncating part of the language backbone layers (e.g., reducing from dozens of layers to 13), reducing the number of experts from full capacity to 16 routing experts while maintaining a Top-8 activation mode, and completely retaining the vision tower and cross-modal projection module. The cleverness of this approach lies in the fact that retaining the complete vision branch can verify the end-to-end correctness of the multimodal pipeline, while reducing the language part significantly lowers memory and computational overhead.

    A reference engineering observation is that under such a scaled-down configuration, training with random initialization on an image-text QA dataset for several hundred steps can stably reduce the training loss from around 8.9 to 2.2, with validation loss decreasing in sync. The single-card memory peak is controlled at around 45GiB, and it can be confirmed that the parameters of the vision branch actually participate in gradient updates. The significance of this data does not lie in model performance, but in proving that the numerical behavior of the entire forward-backward-optimization pipeline is healthy.

    It must be emphasized that scaled-down validation is not equivalent to full-scale pretraining. The gap between the two is reflected in multiple dimensions, including cluster scaling, long-term stability, checkpoint reliability, and communication efficiency, which will be detailed below.

    3. The Three Pillars of the Distributed Training Pipeline

    1. Operator completion: Both forward and gradients are indispensable. The first step in adaptation is to provide hardware-native implementations for the target model’s key operators. MoE-related operators include routing scoring, token dispatch/combine, and grouped GEMM. The attention part must cover both forward and backward passes under dynamic sparse masks. A common misconception is only verifying forward correctness; in fact, the precision alignment of gradient operators is more critical—numerical errors in the backward path accumulate over training steps, ultimately leading to loss divergence. In engineering, layer-by-layer gradient comparison (point-by-point comparison with a reference hardware’s gradients) is typically used to locate issues.

    2. Parameter sharding: Managing optimizer states with modern sharding strategies. For trillion-parameter models, even after scaling down, parameters, gradients, and optimizer states cannot reside on a single card. The industry’s mainstream approach is to uniformly shard all three using FSDP-like frameworks: each card holds only a shard of the parameters, aggregates them on-demand (all-gather) during the forward pass, and releases them immediately after computation. During the backward pass, they are aggregated again to generate gradient shards, and the optimizer updates only the local shards. The shard granularity, prefetch timing, and communication overlap strategy directly determine the balance between memory savings and computational efficiency.

    3. Collective communication: The lifeline of cross-node training. Cross-node communication relies on high-performance collective communication libraries, requiring the validation of the bandwidth and correctness of three core primitives—all-reduce, all-gather, and all-to-all—under specific NICs and topologies. MoE training is particularly sensitive to all-to-all. It is recommended to perform graded stress tests before formal training: testing from small to large messages to confirm there are no performance cliffs or packet drops at specific message sizes.

    Below is an illustrative pre-training checklist:

    1. def pretrain_checklist(dist_ctx):
    2. # 1. Communication correctness: inject known data to each rank, verify aggregation results
    3. assert dist_ctx.allreduce_sanity_check()
    4. assert dist_ctx.alltoall_sanity_check()
    5. # 2. Gradient alignment: point-by-point gradient comparison with reference implementation
    6. grad_diff = compare_gradients(model, reference_dump)
    7. assert grad_diff.max() < 1e-5
    8. # 3. Memory watermark: run several steps to confirm peak leaves a safe margin
    9. peak_mem = profile_steps(model, steps=5)
    10. assert peak_mem < 0.85 * dist_ctx.device_mem

    4. How to Judge Whether a Validation is Credible

    When disclosing validation results, the engineering community focuses more on reproducibility than on single-point metrics. A credible pipeline validation should include at least the following elements:

    • Continuous training steps and stability records: Running continuously for several hundred steps without abnormal interruptions or numerical overflow (loss showing NaN or Inf) is the basic threshold for pipeline health.
    • Segmented statistics of the loss curve: For example, comparing the mean of the early segment (e.g., steps 21-70) with the final segment (e.g., the last 50 steps) is better at ruling out random fluctuations than a single-point value.
    • Dual curves for training and validation sets: Both decreasing in sync without divergence indicates that the gradient update direction is correct, rather than just overfitting training samples.
    • Memory peaks and evidence of branch participation in updates: Clarifying that the gradient norm of the vision branch is non-zero avoids hidden errors like “the image branch is silently frozen.”
    • Gradient check results: The gradient norm of key layers is within a reasonable range, with no signs of gradient explosion or vanishing.

    5. The Gap from Pipeline Validation to Full-Scale Pretraining

    It must be clearly recognized that a dual-node scaled-down validation is only the starting point. Moving toward full-scale pretraining requires crossing four hurdles: First, cluster scalability—when scaling from 16 cards to thousands or tens of thousands, communication proportion, failure rates, and synchronization overhead will grow non-linearly. Second, long-term stability—the daily hardware failures of a 10,000-card cluster cannot be ignored, requiring asynchronous checkpoints and fast recovery mechanisms to support the effective training rate. Third, efficiency alignment—in addition to precision alignment with international mainstream products, domestic solutions must also achieve an acceptable training cost in terms of MFU (Model FLOPs Utilization). Fourth, ecosystem support—cloud product capabilities such as logging services, monitoring and alerting, and task scheduling must be deeply integrated with the training framework to support engineering operations.

    From an industry trend perspective, research institutions predict that the share of localized solutions for high-end AI chips is rapidly increasing, and there will be more and more reproducible engineering nodes for domestic GPUs on the training side. For teams hoping to deploy large model training on domestic computing power, it is recommended to build training environments relying on platforms with general cloud product capabilities such as object storage, container platforms, and monitoring/alerting (for example, the cloud infrastructure provided by Baidu AI Cloud), and follow a three-step path: “small-scale cluster pipeline validation—medium-scale efficiency stress testing—large-scale long-term stable operation” to advance steadily.

    6. Conclusion

    The training adaptation of trillion-parameter MoE multimodal models is essentially a battle of systems engineering: operator precision is the foundation, sharding strategy is the skeleton, collective communication is the bloodstream, and a reproducible validation methodology is the yardstick for measuring progress. Continuous training validation under scaled-down configurations proves that the model “can be trained,” but to answer whether it is “affordable, stable, and effective to train,” continuous investment in cluster scale, fault tolerance systems, and software ecosystems is still required. For developers, understanding this path from breaking through the pipeline to scaled training is far more valuable than chasing single-point peak performance.