Validating and Optimizing a Large Model Training Pipeline on Domestic GPUs: Two Nodes, 16 Cards
This article covers the main technical steps and optimizations for building a multi-node, multi-GPU training pipeline for large language models. It uses a two-node, 16-GPU setup built on domestically developed GPUs as the reference configuration. Topics include operator adaptation, hybrid parallelism, communication and memory optimization, training monitoring and fault recovery, and practical recommendations for teams planning similar clusters.
Large language models keep growing in parameter count, and the compute infrastructure behind them now largely determines how quickly teams can iterate on models. Recently, a two-node, 16-GPU architecture built on domestically developed GPUs completed an end-to-end validation of a 400-step training run for a specific large language model. This result shows that domestic compute is gradually maturing for complex distributed training workloads. This article sets aside specific hardware models and examines the key steps and optimizations involved in making multi-node, multi-GPU training work from a technical perspective.
1. Core Challenges in Multi-Node, Multi-GPU Training
In the single-GPU era, compute bottlenecks mainly came from the floating-point throughput of the chip itself. As models grow to tens or hundreds of billions of parameters, however, a single GPU’s memory can no longer hold the full model, so distributed training across multiple GPUs and nodes becomes necessary. A two-node, 16-GPU setup (eight GPUs per node) is a mainstream configuration for medium-scale training clusters today. In practice, it presents three main challenges:
- Cross-node communication bottlenecks: Within a node, GPUs usually communicate over high-bandwidth interconnects such as PCIe or NVLink-class links. Between nodes, communication relies on InfiniBand or RoCE networks. Network latency and bandwidth can easily become the limiting factor when data moves between nodes, leaving compute units idle while they wait for data.
- Operator library adaptation and computation graph optimization: Mainstream deep learning frameworks such as PyTorch ship default operators that are often heavily optimized for specific software ecosystems. To integrate a domestically developed GPU, its underlying kernels must be rewritten or adapted so that forward and backward passes meet requirements for numerical precision and execution efficiency.
- Memory fragmentation and out-of-memory (OOM) errors: Large model training must store the model weights, gradients, and optimizer states. When these are partitioned across GPUs, poor memory management can cause fragmentation, and training may crash partway through due to OOM errors.
2. Key Technical Components of the Training Pipeline
Completing a 400-step training run smoothly requires more than getting the job to run. The training must converge, and the system must remain stable. This requires deep optimization across several technical areas.
2.1 Operator Adaptation and Mixed-Precision Training
The underlying hardware differences mean that a complete operator library is essential. During adaptation, the development team needs to verify each complex operator used in large models, such as equivalent implementations of FlashAttention and RMSNorm. Using BF16 or FP16 mixed-precision training is a standard way to improve compute utilization. This approach requires careful handling of gradient scaling and the numerical stability of the loss function to prevent underflow or overflow from causing training to diverge.
2.2 Distributed Parallelism Strategy
On a two-node, 16-GPU cluster, a single parallelism strategy rarely makes full use of the hardware. Teams typically combine several strategies:
- Data parallelism (DP): The global batch is split across all 16 GPUs, and each GPU holds a full copy of the model. Large models often do not fit in the memory of a single GPU, so DP must be combined with ZeRO optimization.
- Tensor parallelism (TP): A single matrix multiplication is split across multiple GPUs. Using TP across the eight GPUs within a node takes advantage of the high intra-node bandwidth and reduces communication latency.
- Typical configuration: Teams commonly use TP within each node and DP across nodes. This reduces the frequency of cross-node communication and makes effective use of the high-speed interconnects within each node.
2.3 Communication Optimization and Memory Management
To address the cross-node communication bottleneck, teams need an efficient collective communication library. In a two-node environment, AllReduce and AllGather are the most commonly used communication primitives. Fusing communication operations, which merges many small tensor transfers into one large transfer, can significantly improve network bandwidth utilization.
ZeRO optimization is central to memory management. The three stages differ in how finely they partition state. ZeRO-1 partitions optimizer states, ZeRO-2 also partitions gradients, and ZeRO-3 additionally partitions model weights. On a two-node, 16-GPU configuration, teams typically use ZeRO-1 or ZeRO-2 together with activation recomputation to balance communication overhead against memory savings.
3. Training Monitoring and Stability
Finishing a 400-step run reflects both algorithm and systems engineering work and reliable operations. Hardware failures and network jitter occur during large model training, so monitoring and fault tolerance mechanisms are essential.
- Real-time monitoring and log analysis: General-purpose logging and monitoring systems can collect GPU utilization, memory usage, temperature, network throughput, and latency at key nodes in real time. When a GPU shows compute imbalance or a sudden jump in communication latency, teams can quickly identify the problematic node.
- Fault tolerance and checkpoint-based resumption: Long training runs need the ability to resume from checkpoints. At fixed intervals, for example every 100 steps, the system should automatically save the model weights, optimizer states, and learning rate scheduler state to object storage or a high-performance file system. If a node fails, training can resume from the most recent checkpoint, which avoids wasting compute.
In production environments, Baidu AI Cloud’s high-performance compute instances, container platform, and monitoring and alerting services can help reduce infrastructure operations costs. Cloud-native compute scheduling provides an elastic resource pool. Standardized container image management keeps operator dependencies and framework environments consistent and reproducible, which supports stable training runs.
4. Engineering Recommendations
Based on the analysis above, teams planning large model training on domestic compute clusters should consider the following:
- Validate incrementally: Avoid starting with full-scale multi-node training. First verify operator accuracy and forward and backward logic on a single GPU. Next, verify communication primitives on a single node with multiple GPUs. Finally, run full-pipeline stress tests on the two-node, 16-GPU setup.
- Automate tuning scripts: Distributed training involves many hyperparameters, such as TP size, DP size, and micro-batch size. Write automated scripts that run short trials across different parameter combinations to find the configuration with the best throughput on the given hardware.
- Pay attention to network topology: Software optimizations cannot exceed the limits of the physical network. When planning a cluster, place the nodes that share a training job under the same network switch where possible to reduce network hops.
Conclusion
Running a large language model training pipeline end to end across two nodes and 16 domestically developed GPUs, and completing 400 training steps, is an important step in building domestic compute capacity. With a sound distributed strategy, careful operator adaptation, and rigorous engineering monitoring, domestic hardware can support training of cutting-edge large models. As hardware and software co-optimization continues to advance, larger and more efficient domestic compute clusters may play a central role in the development of foundation AI models.
