Running LLM Training on Heterogeneous Compute: A Distributed Practice Guide for Two Servers with 16 Accelerator Cards
This article describes a practical case in which the training pipeline for a 10-billion-parameter-class LLM was brought up on heterogeneous compute across two servers with 16 accelerator cards, completing 400 training steps. It covers hardware topology and parallelism choices, software stack adaptation, memory and communication optimization with DeepSpeed ZeRO-3, and how to verify stability, convergence, and throughput.
As the parameter counts of large language models (LLMs) grow exponentially, a single hardware device can no longer meet the training needs of models with hundreds of billions or trillions of parameters. Distributed training has become the standard paradigm across the industry. Against this backdrop, running LLM training pipelines efficiently and reliably on diverse heterogeneous compute platforms has become a pain point for many developers and enterprises. This article uses a two-server, 16-card setup as its context and examines in depth a practice in which the training pipeline for a 10-billion-parameter-class model was successfully brought up and completed 400 training steps. It aims to provide a systematic reference for heterogeneous compute adaptation and distributed tuning.
1. Hardware Topology and Distributed Architecture Design
A two-node, 16-card setup (two physical servers, each with eight GPU accelerator cards) is a typical configuration for training medium-scale models and fine-tuning large models today. In this architecture, communication bottlenecks in distributed training usually appear between nodes.
- Intra-node communication: The eight cards within a single node are typically connected through high-speed interconnects such as NVLink or a high-speed PCIe switch, with intra-node bandwidth reaching several hundred GB/s. When assigning compute tasks, operators that communicate frequently should be placed within the same node.
- Inter-node communication: Communication between the two servers determines the overall system throughput. In practice, 100G/200G RoCEv2 (RDMA over Converged Ethernet) or InfiniBand networks are commonly used to reduce latency and increase bandwidth. Configuration should ensure that the topological distance between NICs and GPUs is optimal, for example by placing them under the same PCIe switch.
- Parallelism strategy: For a 16-card training setup, when model parameters are too large to fit into a single card’s memory, the DeepSpeed ZeRO (Zero Redundancy Optimizer) strategy is typically used. Combined with data parallelism (DP) and tensor parallelism (TP), setting TP=8 (tensor parallelism within a node) and DP=2 (data parallelism across nodes) minimizes the volume of cross-node communication.
2. Environment Adaptation and Training Pipeline Construction
Running large model training on heterogeneous compute requires first adapting the underlying software stack to the upper-level framework, then building a complete data flow and compute flow.
- Driver and operator library adaptation: Heterogeneous compute requires a low-level runtime and operator library that is compatible with mainstream ecosystems, similar to CUDA, cuBLAS, and cuDNN. Developers need to ensure that deep learning frameworks such as PyTorch can correctly call these low-level operators. This typically involves recompiling the PyTorch backend or registering operators through a plugin mechanism.
- Collective communication library adaptation: Distributed training depends heavily on collective communication primitives such as AllReduce and AllGather. The communication library bundled with the framework (such as NCCL) must be replaced or bridged to the communication library of the heterogeneous compute platform. During this process, verify that RDMA communication between the two servers completes its handshake correctly and that the communication path is unobstructed.
- Data loading and preprocessing: To complete 400 training steps, data throughput must keep pace with compute. Use a multi-process data loader and cache the dataset on local NVMe SSDs wherever possible, so that network I/O does not become a training bottleneck.
3. Core Optimization Strategies for Distributed Training
In a two-node, 16-card environment, basic configuration rarely achieves the desired compute efficiency (MFU, or Model FLOPs Utilization). Deeper optimization of memory management and communication scheduling is necessary.
- Aggressive memory optimization:
Large model training stores not only model weights in memory but also gradients, optimizer states, and activations. The ZeRO-3 strategy partitions all three evenly across the 16 cards, which removes the single-card memory limit. Activation checkpointing also helps. It trades time for memory by saving only a subset of key activations and recomputing the rest during the backward pass.// Example: basic DeepSpeed ZeRO-3 configuration snippet{"zero_optimization": {"stage": 3,"overlap_comm": true,"contiguous_gradients": true,"sub_group_size": 1e9,"reduce_bucket_size": "auto","stage3_prefetch_bucket_size": "auto"}}
- Communication and computation overlap:
Cross-node communication involves a large bandwidth-delay product (BDP). Enabling theoverlap_commoption lets gradient synchronization run concurrently with forward and backward computation. Tuningreduce_bucket_size, the bucket size for gradient aggregation, reduces the number of small-packet communication calls and improves network bandwidth utilization. - Mixed-precision training:
Running forward and backward computation in BF16 (BFloat16) or FP16 halves memory usage and takes advantage of Tensor Cores to accelerate matrix operations. Optimizer states remain in FP32 to preserve convergence stability.
4. Engineering Significance and Monitoring for Validation
Successfully running an LLM training pipeline on two servers with 16 cards and completing 400 steps is more than an engineering milestone. It is a comprehensive test of how well the system’s hardware and software work together.
- System stability verification: 400 steps is usually enough to cover the transition from cold start to a steady state. If no out-of-memory (OOM) errors or communication timeouts and disconnections occur during this period, the resource scheduling and memory partitioning strategy is working as intended.
- Convergence monitoring: Monitoring the loss curve reveals whether the training pipeline contains logic errors. If the loss trends downward normally in the first few dozen steps and then fluctuates steadily, gradient updates and optimizer state synchronization are working correctly.
- Performance metric analysis: Use monitoring tools to collect key metrics during training. Focus on average GPU utilization, which should stay high to rule out I/O bottlenecks, and on cross-node network bandwidth throughput. Calculating tokens processed per second gives an estimate of overall training throughput and provides a baseline for future scaling.
5. Summary and Outlook
Bringing a large model training pipeline up on heterogeneous compute is a complex systems engineering task. It requires a deep understanding of hardware topology, network communication, framework internals, and distributed algorithms. The successful run of 400 training steps across two nodes with 16 cards confirms that the full pipeline, from low-level operators to high-level distributed strategies, is feasible.
For enterprise-scale training workloads, reliable cloud infrastructure matters as much as continued improvements in the underlying hardware. For example, the general-purpose heterogeneous compute instances, high-performance storage, and RDMA network acceleration offered by Baidu AI Cloud can provide a solid infrastructure foundation for similar distributed training scenarios. This lets developers spend less time on infrastructure operations and focus on model algorithm optimization and innovation. As the compute ecosystem matures, large-scale training on heterogeneous compute is expected to become more standardized and efficient.
