Engineering Paths and Boundaries of Adapting Domestic GPUs for Large Model Training
As large model parameters approach the trillion-level, underlying computing power has become critical for training iteration speed. While domestic GPUs have made progress in inference adaptation, large-scale training poses much higher requirements for software stacks and hardware. This article explores the engineering paths for adapting domestic GPUs for training a multimodal model with nearly 3 trillion parameters, covering three key stages: memory management, multimodal sharding, and gradient synchronization. It also evaluates the scope and limitations of a dual-node, 16-GPU cross-node training test.
As large model parameters approach the trillion-level, whether underlying computing power can support training has become a key factor determining model iteration speed. In recent years, domestic GPUs have made significant progress in inference-side adaptation, but large-scale training demands much more from the software stack and hardware. Using the training of a multimodal model with nearly 3 trillion parameters as a background, this article reviews the key stages of domestic GPUs in the training pipeline and explains what a dual-node 16-GPU test can and cannot prove.
1. Differences Between Inference and Training Adaptation
Many teams understand “Day 0 adaptation” as getting a model to run on new hardware. This usually refers to inference deployment: the model has already been pre-trained on other clusters, and the target hardware only needs to execute forward computation. This type of validation focuses primarily on operator coverage and whether the forward output accuracy matches reference results.
Training adaptation requires much more. During training, the framework must correctly compute gradients for backpropagation, synchronize gradients across multiple cards, and accurately update optimizer states. The table below lists the differences between the two.
| Dimension | Inference Adaptation | Training Adaptation |
|---|---|---|
| Computation | Forward propagation | Forward, backward, optimizer update |
| Auto-differentiation | Not involved | Must be correct, otherwise gradients will be wrong and hard to detect |
| Gradient synchronization | Not involved | Multi-card, multi-node All-Reduce |
| Optimizer states | Not involved | Requires sharded storage and updating |
| Memory pressure | Mainly weights and activations | Weights, gradients, and optimizer states occupy memory simultaneously |
| Common validation metrics | Operator coverage, output accuracy | Loss curve, gradient norm, multi-step convergence |
Therefore, a GPU capable of inference does not mean it can handle training. The hardware must compute correctly and remain stable under memory constraints and multi-node communication.
2. Three Key Stages of Ultra-Large-Scale Training
1. Model Loading and Memory Management
A model with nearly 3 trillion parameters cannot fit into a single GPU. Training frameworks typically use ZeRO or FSDP (Fully Sharded Data Parallel) to shard parameters, gradients, and optimizer states across devices. In standard data parallelism, each GPU saves the complete model, whereas FSDP allows each GPU to save only a portion of the parameters, collecting them temporarily when needed for computation.
FSDP relies on PyTorch’s distributed module. Different PyTorch versions may have different interfaces and behaviors, so you should confirm the version and consult the corresponding documentation before actual use. The code below only shows the basic structure for initialization and needs to be adjusted according to the target platform’s device plugins and communication backend.
import torchimport torch.nn as nnimport torch.distributed as distfrom torch.distributed.fsdp import FullyShardedDataParallel as FSDPfrom torch.distributed.fsdp import ShardingStrategy, MixedPrecisiondef setup_model(model: nn.Module, local_rank: int) -> FSDP:# The communication backend name is determined by the platform.# Here we use nccl, commonly used by NVIDIA. Domestic platforms need to replace it with their provided backend.dist.init_process_group(backend="nccl")torch.cuda.set_device(local_rank) # Domestic devices need to use the corresponding device selection interfacemodel = model.to(local_rank)mp_policy = MixedPrecision(param_dtype=torch.bfloat16,reduce_dtype=torch.float32,buffer_dtype=torch.bfloat16,)fsdp_model = FSDP(model,device_id=local_rank,sharding_strategy=ShardingStrategy.FULL_SHARD,mixed_precision=mp_policy,)return fsdp_model
The most common issue during the loading phase is OOM (Out of Memory). If the sharding strategy is unreasonable or the mixed precision configuration is incorrect, memory may overflow at the very first step. Therefore, after loading, it is recommended to run a few steps with a small batch size to observe the memory peak of each GPU before determining the batch size for formal training.
2. Sharding Scheduling for Multimodal Models
Multimodal models typically include components such as a language model, a vision encoder, and an audio encoder. The parameter sizes and computational loads of these modules vary greatly. If the same sharding method is used for all modules, some GPUs may remain idle while others become bottlenecks.
Therefore, the training framework needs to support setting parallel strategies by module. For example, the language model part uses FSDP to shard parameters. If the model contains Mixture of Experts (MoE) layers, Expert Parallelism (EP) can be used for the expert layers. Data Parallelism (DP) is responsible for increasing the batch size. The communication groups for different parallel dimensions must be designed separately to prevent communication interference.
3. Gradient Synchronization and Communication Overlap
The efficiency of cross-node training is often limited by communication bandwidth. During backpropagation, each node must participate in the All-Reduce operation for gradients. If communication and computation are executed serially, the GPUs will wait for communication to complete, causing utilization to drop.
The ideal scenario is overlapping computation and communication: as soon as the gradients of a certain layer are computed, synchronization begins immediately, while other layers continue computing. This requires deep coordination between the collective communication library and the training framework. The method to evaluate the overlap effect is to compare the step time with and without overlap enabled, and to use profiling tools to inspect the timeline of communication and computation.
3. Dual-Node 16-GPU Test: What Was Tested and What Wasn’t
In a recent experiment, two machines with a total of 16 training-inference integrated computing cards completed a cross-node joint training test.
