Connecting the Training Pipeline for Large Language Models on Domestic GPUs: A Practical Guide

    This article walks through the engineering practice of running a large language model training pipeline on domestic GPU accelerators, using a two-node, sixteen-card setup that completed 400 consecutive steps as the key milestone. It covers cluster topology and environment preparation, parallelism strategy and memory budgeting, numerical stability with mixed precision, data pipeline design, observability and fault tolerance, and a troubleshooting table for common failures. Readers will find a structured approach to moving from short smoke tests to stable, reproducible long-running training.

    1. Why Completing 400 Steps Is a Meaningful Milestone

    In large-scale pretraining, the hard part is rarely writing the model architecture. It is keeping the entire pipeline moving forward on real hardware in a stable and reproducible way. A smoke test of only a few dozen steps usually validates tensor shapes and interface alignment. Once the iteration count grows into the hundreds, problems surface in concentrated form: memory fragmentation, communication timeouts, numerical overflow, corrupted checkpoints, and missing logs. For this reason, “two nodes and sixteen cards completing 400 consecutive steps” is better understood as an engineering threshold. It means the data pipeline, parallel partitioning, mixed precision, fault tolerance, and monitoring have begun to work together.

    For domestic accelerators, this milestone also validates the maturity of the software stack, including how well the driver, runtime, collective communication library, compiler, and framework adaptation layer cooperate. Only when the loss curve stays smooth and throughput fluctuation remains controlled over a longer range of steps can we say the pipeline is ready to scale further.

    2. Cluster Topology and Base Environment Preparation

    Two nodes with sixteen cards is a typical small-scale multi-node training scenario, usually with eight accelerators per node, high-bandwidth interconnect inside each node, and a high-speed network between nodes. Environment preparation is best done in this order:

    1. Hardware and driver baseline check: confirm that all accelerators are the same model and that firmware and driver versions are unified, so version drift does not cause differences in collective communication behavior.
    2. Collective communication connectivity check: run basic primitives such as all-reduce and broadcast first, then move on to training, so network issues are not mistaken for model issues.
    3. Storage and data read stress test: verify the throughput ceiling of shared storage or a parallel file system, and confirm that concurrent reads from multiple processes do not become a bottleneck.
    4. Dependency isolation: use a container platform or virtual environment to pin dependency versions and keep the multi-node environment reproducible.

    A schematic startup structure is shown below (it only expresses parallelism and node relationships, not actual commands):

    1. Node A: rank 0..7 (8 cards within one node)
    2. Node B: rank 8..15 (8 cards within one node)
    3. Parallel config: data parallel=8, tensor parallel=2, pipeline parallel=1
    4. Global batch = per-card micro-batch × gradient accumulation × data parallel degree

    3. Parallelism Strategy and Memory Budgeting

    Partitioning across sixteen cards requires balancing communication overhead against memory usage. A common practice is to keep tensor parallelism inside a node to take advantage of the high-bandwidth interconnect, and to spread data parallelism across nodes so gradient synchronization uses the inter-node network. If the model has many layers and does not fit on a single card, pipeline parallelism can be introduced, but watch the bubble ratio and scheduling complexity.

    Break the memory budget into four parts: parameters, gradients, optimizer states, and activations. Mixed precision training significantly reduces the first two and the optimizer states, while activations can be traded for memory through recomputation. In practice, the safer approach is to fix the global batch first, then adjust micro-batch size and gradient accumulation step by step, watching whether peak memory leaves enough headroom to avoid allocation failures triggered by accumulated fragmentation during long stable runs.

    4. Numerical Stability and Mixed Precision Details

    Whether 400 steps complete smoothly depends largely on whether numerical behavior stays under control. Pay attention to three points:

    • Loss scaling: dynamic scaling during low-precision backpropagation prevents gradient underflow, and the scaling factor should adapt automatically based on overflow.
    • Normalization and residuals: normalization layers and residual connections are sensitive to precision, so higher-precision accumulation is usually kept there.
    • Gradient clipping: a reasonable clipping threshold suppresses occasional spikes and prevents one bad step from contaminating later weights.

    Also persist key scalar metrics (loss, gradient norm, scaling factor, learning rate) step by step to form traceable curves. When a spike appears, the curves help determine whether the cause is an anomalous data batch or a communication/compute anomaly.

    5. Data Pipeline Design

    Common data-side problems include duplicate samples, uneven sharding, and read jitter. Engineering practice can use deterministic sharding, prefetching, and multi-process loading, with a fixed random seed for reproducibility. Before formal training, run a “data consistency check”: read the first few batches under different parallel degrees and compare sample order and labels, so changes in parallelism do not introduce hidden bias.

    6. Observability, Fault Tolerance, and Long Stable Runs

    Long stable runs depend on a solid observability system. Logs, monitoring alerts, and metric dashboards can be combined to collect throughput, memory, temperature, network retransmissions, and communication latency. For fault tolerance, checkpoints should be saved asynchronously in shards with multiple historical versions retained, and recovery should verify file integrity and step consistency. If a card starts throttling or a link becomes unstable, the system should automatically isolate it and restart the task rather than rolling back the entire training run.

    7. Common Failures and How to Locate Them

    Symptom Possible cause How to locate
    Stuck at initialization Communication link setup failed Verify basic communication primitives first
    Throughput drops sharply Storage jitter or uneven data sharding Check read latency and queue depth
    Loss becomes NaN Improper scaling or anomalous data Trace back recent batches and gradient norm
    Occasional allocation failure Accumulated memory fragmentation Adjust recomputation and micro-batch ratio

    8. Deployment Suggestions on Baidu AI Cloud

    To reproduce a similar pipeline in the cloud, you can use a container platform for environment orchestration, object storage for datasets and checkpoints, and monitoring alerts plus logging services to build a unified observability layer, combined with elastic scaling to handle workload peaks. The overall approach treats four threads as the main lines: reproducible environments, verifiable data, observable processes, and recoverable failures, gradually advancing from short smoke tests to hundreds of steps and even longer training validation cycles.