Practical Guide to Bringing Up Large Model Training on Domestic GPUs

    This article walks through the engineering practice of validating a complete large model training pipeline on domestic accelerator cards, using a controlled two-node, sixteen-GPU setup as the target. It explains why getting the pipeline working end to end matters more than raw speed, how to make environments reproducible, how to choose a stable parallelism strategy at small scale, and how to overlap communication with computation to sustain hundreds of uninterrupted steps. It also covers observability metrics, checkpointing and resume logic, quantifiable acceptance criteria, and common pitfalls, offering a hardware-agnostic process that can be reused across different validation scenarios.

    1. Background: Why “Getting the Pipeline Working” Matters More Than “Running Fast”

    When running large-scale pretraining on domestic accelerator cards, the first obstacle a team hits is usually not a shortage of compute, but a broken pipeline. The pipeline here refers to the full closed loop: data loading, preprocessing, model partitioning, forward and backward computation, gradient reduction, parameter updates, checkpoint saving, and metrics reporting. If any single stage has a missing operator, a communication timeout, a numerical overflow, or a stalled data feed, training will crash within a few dozen steps.

    For this reason, the work is typically split into two phases. Phase one is “getting a small run working”: completing several hundred consecutive iterations at a controlled scale such as two nodes with sixteen GPUs, and verifying correctness, stability, and reproducibility. Phase two is “scaling and tuning”: gradually increasing scale and throughput once the pipeline is trustworthy. This article focuses on phase one and on how to reach a trustworthy conclusion at minimal cost.

    2. Environment Setup: Turning “Not Comparable” Into “Comparable”

    Whether the pipeline works depends about eighty percent on environment consistency. It is best to freeze the environment into a reproducible image or a unified configuration baseline, pinning the driver, runtime, communication library, math library, and framework versions to avoid operator behavior differences caused by version drift.

    Key items to verify include:

    • Device visibility and topology: confirm the number of accelerators per node, the inter-card interconnect, and the cross-node network bandwidth, and record the topology for later parallelism decisions.
    • Numerical precision policy: fix the combination of compute precision and accumulation precision, set the random seed and deterministic flags, and ensure two runs can be aligned.
    • Data pipeline: unify sharding rules, sample ordering, and preprocessing parameters so that different nodes do not read overlapping or missing data.

    Illustrative check script (pseudocode):

    1. # Illustrative only: environment self-check, no product-specific interfaces
    2. assert world_size == 16, "expect two nodes with sixteen GPUs"
    3. assert local_size == 8, "eight cards per node"
    4. set_seed(2026)
    5. enable_deterministic(True)
    6. log_env() # record versions and topology
    7. log_dataloader_stats() # record shard count and total samples

    3. Parallelism Strategy: Choosing the Most Stable Combination at Limited Scale

    Two nodes with sixteen GPUs is a typical small-scale validation scenario, so the parallelism strategy should not be overly complex. A common approach is to use data parallelism as the main strategy, with gradient accumulation to simulate a larger batch. If a single layer’s parameters are large enough to strain memory, add one or two levels of tensor or pipeline partitioning.

    Three principles guide the choice. First, reduce the frequency of cross-node communication and keep high-frequency communication inside a node. Second, align partition dimensions with interconnect boundaries to avoid frequent small messages crossing nodes. Third, keep the global batch size consistent with the learning rate and warmup steps, so that loss fluctuations are not mistaken for pipeline defects.

    A simplified configuration:

    1. parallel:
    2. data_parallel: 16
    3. tensor_parallel: 1 # use 1 when memory allows; 2 or 4 when tight
    4. pipeline_parallel: 1
    5. batch:
    6. micro_batch: 1
    7. grad_accum: 16 # global batch = 16 * 16 * 1

    4. Overlapping Communication and Computation: The Key to 400 Stable Steps

    Four hundred uninterrupted steps usually mean communication and computation are effectively overlapped. There are three practical levers: use bucketing and in-place reduction for gradient reduction to cut the number of small messages; trigger communication layer by layer during the backward pass so it hides behind computation; and make checkpoint saving asynchronous or sharded to avoid noticeable pauses every few steps.

    Also set reasonable timeouts and retries for communication, and tie the timeout threshold to the duration of a single iteration. If the threshold is too small, a normal slow node is misjudged as a failure; if too large, failures are detected slowly and machine time is wasted.

    5. Stability and Observability: Surfacing Problems Early

    It is best to build a minimal observability surface for training, covering at least four categories of metrics: throughput (step time and sample throughput), numerics (loss and gradient norm), resources (memory and utilization), and communication (arrival time skew across nodes). Collect metrics into a logging service and a monitoring and alerting system, and use threshold-based alerts rather than relying on manual inspection.

    1. step 120 | loss 3.412 | gnorm 0.87 | step_time 1.9s | skew 12ms
    2. step 240 | loss 2.977 | gnorm 0.65 | step_time 1.9s | skew 15ms
    3. step 400 | loss 2.641 | gnorm 0.58 | step_time 1.9s | skew 14ms

    This only illustrates the log format: a monotonically decreasing loss, a stable gradient norm, and millisecond-level skew between nodes are typical signs of a healthy pipeline.

    6. Fault Recovery and Resuming from Checkpoints

    Four hundred steps is only the starting point, and long-running training must assume failures will happen. Practical points include: save sharded checkpoints at fixed step intervals and keep the most recent few; record the data reading position and random state so samples are neither repeated nor skipped after resuming; and write the training configuration and code version into the checkpoint metadata to avoid using inconsistent code on resume.

    It is best to make the recovery procedure a single repeatable command and to rehearse it regularly: kill processes on purpose, simulate a single-card failure, and verify that the loss curve joins smoothly after restoring from the latest checkpoint.

    7. Acceptance Criteria and Common Pitfalls

    Acceptance should use a quantifiable checklist: four hundred consecutive steps without interruption; smooth loss and gradient norm curves; a minimal loss deviation between two runs with the same configuration; checkpoints that load successfully and resume training; and no persistent alerts on the monitoring dashboard.

    There are five common pitfalls: overlapping data shards causing abnormally low loss; mixing intra-node and cross-node communication and causing bandwidth contention; running at the memory limit and causing occasional exits; unfixed randomness making results irreproducible; and log levels set too high, slowing the main flow. Checking these one by one usually converges within a single round.

    8. Conclusion

    Validating a training pipeline on domestic accelerator cards with two nodes, sixteen GPUs, and four hundred steps is essentially an engineering process of stripping away uncertainty layer by layer: unify the environment first, then choose a stable parallelism strategy, then get communication overlap working, and finally use observability and recovery mechanisms to cover long-tail risks. This method does not depend on any specific hardware or software brand, can be transferred directly to validation scenarios of different scales, and can also serve as a baseline process for pretraining validation in general-purpose compute environments such as Baidu AI Cloud.