Running a Large Language Model Training Pipeline on a China-Made GPU Cluster

    This guide explains how to get a full large language model training pipeline running on two servers with 16 China-made GPUs. It covers hardware topology, parallelism strategy, memory optimization, data pipeline tuning, and the checks needed to confirm that a 400-step run is both stable and correct.

    1. Background: Why a Working Training Pipeline Matters

    Large language models keep growing in parameter count, and a single GPU can no longer hold a full training job. As the supply of AI accelerators diversifies, more teams are trying to train models on China-made GPU platforms.

    “Running the training pipeline” means more than launching a program without errors. The full loop of data loading, forward pass, backward pass, gradient synchronization, parameter update, and checkpoint saving must run stably. The loss curve should decrease normally, and throughput should reach a usable level.

    A typical starting goal is to complete 400 steps on two nodes with 16 GPUs. This is a minimum viable product (MVP). The scale is small, but it is enough to expose most engineering problems in distributed training: whether the communication topology is correct, whether memory is sufficient, whether the data pipeline becomes a bottleneck, and whether numerical precision is aligned. This article breaks down the technical approach and best practices around this goal.

    2. Understanding the Hardware and Topology

    Two servers with eight GPU accelerator cards each form a classic entry-level topology for distributed training. Before planning a training job, confirm three hardware-level facts:

    1. Bandwidth gap between intra-node and inter-node links. The eight cards inside one machine usually communicate over a high-speed interconnect bus. This bus has far higher bandwidth than the network between machines, such as RoCE or InfiniBand. This gap determines how parallelism should be divided. Place the most communication-heavy parallel dimensions inside a node whenever possible.
    2. Memory capacity determines how the model is partitioned. Estimate the total memory needed for parameters, gradients, and optimizer states. With mixed-precision training, each parameter takes roughly 2 bytes (parameter) + 2 bytes (gradient) + 8 bytes (Adam first and second moments in FP32) + 4 bytes (FP32 master parameter) ≈ 16 bytes. If the model exceeds single-card memory, you must use a parameter partitioning strategy.
    3. Consistent driver and runtime environment. Driver versions, communication library versions, and deep learning framework versions must match exactly across both machines. Otherwise, you may encounter collective communication errors or numerical inconsistencies that are hard to debug.

    Before formal training, run the bandwidth and latency tests included with the communication library. Confirm that the actual intra-node and inter-node bandwidth matches expectations. This step catches basic problems such as miswired cables or network cards running at reduced speed.

    3. Parallelism Strategy: Data Parallelism First, Model Parallelism Second

    For a 2-node, 16-GPU setup, the simplest option is pure data parallelism (DDP) if the model weights fit on one card with memory to spare. Each card holds a full model replica and processes a different data shard. After the backward pass, the cards synchronize gradients through AllReduce.

    If the model is larger, combine several parallelism dimensions:

    • Tensor parallelism (TP). Split individual layer operators, such as attention projections and feed-forward weight matrices, across multiple cards. Tensor parallelism communicates very frequently, so keep it within the eight cards of a single node.
    • Pipeline parallelism (PP). Place different groups of layers on different nodes, and pass activations across machines. Pipeline parallelism sends relatively little data, so it suits the inter-node dimension.
    • Optimizer state partitioning (ZeRO-style approaches). Partition optimizer states and gradients across the data-parallel group. This substantially reduces memory pressure on each card and adds only a small communication overhead.

    A common configuration for 2 nodes and 16 GPUs uses tensor parallelism of 8 within each node and data parallelism of 2 across nodes (TP=8, DP=2). The following launch configuration is illustrative pseudocode that works with mainstream distributed training frameworks:

    1. # Start 8 processes per machine, 16 processes in total
    2. torchrun --nnodes=2 --nproc_per_node=8 \
    3. --rdzv_backend=c10d --rdzv_endpoint=<master-node-address>:29400 \
    4. train.py \
    5. --tensor-parallel-size 8 \
    6. --data-parallel-size 2 \
    7. --micro-batch-size 4 \
    8. --global-batch-size 64 \
    9. --seq-len 4096 \
    10. --bf16

    Calculate the global batch size carefully. It must equal the data-parallel degree × micro-batch size × gradient accumulation steps. Adjust it together with the learning rate and warmup schedule.

    4. Three Techniques for Memory Optimization

    Memory is often the first obstacle when getting a training pipeline to run. In practice, teams usually combine the following techniques:

    1. Mixed-precision training. Run the forward and backward passes in BF16, and keep FP32 master weights and optimizer states. BF16 has a wider dynamic range than FP16, so gradient overflow is less likely during training. It is the mainstream choice for large model training.
    2. Activation checkpointing. Trade computation for memory by saving activations for only some layers and recomputing the forward pass during backpropagation. This usually adds about 20% to 30% to computation time, but it frees a large amount of memory. Enable it when memory is tight.
    3. Gradient accumulation. Run several forward and backward passes with a smaller micro-batch size before updating the parameters. This effectively increases the batch size and lowers the peak memory usage at any moment.

    Tune in this order: first make the job run (enable checkpointing and reduce the micro-batch size), then make it faster (gradually increase the micro-batch size and reduce the number of recomputed layers). The goal is to find a balance between memory usage and throughput.

    5. Data Pipeline and Throughput Tuning

    When training throughput falls short, the bottleneck is often on the data side rather than the compute side. Check the following:

    • Whether data preprocessing is slowing things down. Tokenization, sequence packing, and mask construction should run offline. Training should then read preprocessed binary formats, such as indexed shard files, so online processing does not slow down each iteration.
    • Data loading parallelism. Set the number of data loader workers and the prefetch depth so the GPUs do not sit idle waiting for data. Watch the GPU utilization curve. Periodic drops to zero usually mean the data supply is insufficient.
    • Consistency of distributed sampling. Make sure each data-parallel rank receives a non-overlapping set of samples, and that the shuffle order in each epoch is reproducible.

    A useful metric is MFU (Model FLOPs Utilization), the ratio of effective computation to the hardware’s theoretical peak. On general-purpose GPU clusters, an MFU of 30% to 50% during training is a common range. If MFU is well below this range, check communication and data loading first.

    6. Stability and Correctness: What 400 Steps Actually Proves

    Completing 400 steps without interruption is a useful test of pipeline stability. It does not prove the training is correct, so pair it with the following checks:

    • Loss curve inspection. In the first few hundred steps, the loss should fall quickly, without abnormal spikes or divergence. If the loss suddenly jumps (a loss spike), check the learning rate, the gradient clipping threshold, and data quality.
    • Gradient norm monitoring. The global gradient norm should stay within a reasonable range. If it keeps growing explosively, the numerical stability has a problem.
    • Determinism alignment test. Fix the random seed, run a small model on a single card for a few steps, and compare the loss values with the distributed version. This verifies that the parallel partitioning does not introduce numerical errors.
    • Checkpoint save and resume drill. Save a checkpoint midway, restart training from it, and confirm the loss curve continues without a discontinuity. This step is essential before long training runs.
    • Fault tolerance planning. In a two-node setup, a failure on either node interrupts the job. Configure automatic restart and persist training state so recovery takes as little time as possible.

    7. Applying This on Cloud Platforms

    Teams without the ability to build their own data centers can run these validations on cloud compute. Using Baidu AI Cloud as an example, its general-purpose cloud products, including GPU cloud servers, container platforms, object storage, and monitoring and alerting, can cover the full workflow. That workflow runs from provisioning compute and orchestrating training jobs to storing datasets and monitoring training runs.

    A practical path is to start with a small two-node allocation to validate the pipeline and tune parameters. Once throughput and stability meet requirements, add nodes as needed. This approach avoids a large upfront investment.

    8. Conclusion

    A 400-step run on two nodes may look like a small goal. It still covers the core elements of large model training engineering: hardware topology, parallelism strategy, memory and communication optimization, data pipeline tuning, and stability validation. Getting this minimal loop to run reliably and correctly is a prerequisite for scaling to larger clusters and longer training runs. The methods and troubleshooting approach in this article should help developers build and validate training pipelines in their own compute environments.