Practical Guide to Large Model Training on Domestic GPUs: A 400-Step Baseline

    This article walks through the engineering work required to validate a large model pre-training pipeline on domestic accelerator cards, using a stable 400-step run on two nodes with sixteen cards as the baseline. It covers why this milestone matters, how interconnect topology and memory budgeting cap scalability, the software stack work spanning operators, graph compilation, and collective communication, how to align parallelism dimensions with communication volume, the numerical stability practices that keep loss curves flat, the observability needed for long-running jobs, and a troubleshooting order for common failures. The goal is a reproducible, low-risk path from correctness checks to larger-scale training.

    1. Why a 400-Step Run Is the Practical Gate for Domestic Compute

    When adapting large model pre-training to domestic accelerators, a common pattern appears: single-card operator tests all pass, and small single-node models converge, but once the job scales to multiple nodes and cards with parameter counts in the billions, training starts to show loss spikes, communication timeouts, or out-of-memory errors within a few dozen steps. For this reason, “two nodes, sixteen cards, 400 consecutive iterations with stable metrics” is treated as a meaningful milestone: it shows the pipeline is no longer just a demo and has the foundation to scale further.

    The 400-step mark is not arbitrary. It typically covers the exposure window for three classes of problems: the transient phase of initialization and learning-rate warmup, the phase where gradient accumulation and optimizer momentum gradually stabilize, and the phase that tests communication topology stability under sustained pressure. Passing all three smoothly makes troubleshooting much cheaper when scaling to more nodes later.

    2. Hardware Layer: Interconnect Topology and Memory Budget Set the Scalability Ceiling

    The real bottleneck in multi-node training is often not peak compute but bandwidth between cards and between nodes. In practice, confirm three things first:

    • Whether a high-speed interconnect exists inside each node, and whether cards share the same topology domain;
    • Whether the inter-node network is high-bandwidth and low-latency, and whether traffic crosses multiple switch hops;
    • Whether each card has enough usable memory for parameters, gradients, optimizer states, and activations.

    A rough memory budget estimate (showing order-of-magnitude relationships only, not specific product figures):

    1. Per-card memory ≈ parameters × (2 + 2 + 4 × optimizer state multiplier) / parallelism
    2. + activations (grows with batch size, sequence length, and layer count)
    3. - memory recovered through recomputation

    When the budget is insufficient, the sensible order is: enable activation recomputation first, then adjust the parallelism split dimensions, and only then reduce the global batch size while increasing gradient accumulation steps.

    3. Software Stack: Operator Coverage, Graph Compilation, and Communication Library Adaptation

    Most of the adaptation effort for domestic compute concentrates in this layer. A “from the inside out” order is recommended:

    1. Operator layer: confirm whether high-frequency operators such as normalization, attention, rotary position embedding, and fused multiply-add have high-performance implementations. When they are missing, compose the correct result from combined operators first, then replace them incrementally.
    2. Graph and compilation layer: ensure numerical correctness in eager mode first, then enable graph mode and operator fusion, avoiding the introduction of compilation and parallelism variables at the same time from the start.
    3. Communication layer: collective communication primitives must support deadlock-free calls under multi-dimensional parallelism combinations, and timeout thresholds should be configurable to help locate slow nodes.

    A minimal pipeline self-check script:

    1. # Goal: verify correctness, communication, and numerical stability before scaling up
    2. for step in range(400):
    3. with torch.amp.autocast(dtype="bfloat16"):
    4. loss = model(batch) / grad_accum_steps
    5. loss.backward()
    6. grad_norm = clip_grad_norm_(model.parameters(), max_norm=1.0)
    7. if step % 50 == 0:
    8. log(step, loss=loss.item(), grad_norm=grad_norm, lr=scheduler.get_lr())
    9. optimizer.step()
    10. scheduler.step()
    11. optimizer.zero_grad(set_to_none=True)

    4. Parallelism Strategy: Align Split Dimensions with Communication Volume

    A common combination is data parallelism plus tensor parallelism, with pipeline parallelism and sequence parallelism added when needed. Three selection principles apply:

    • Keep tensor parallelism within the intra-node high-speed interconnect domain to avoid high-frequency cross-node communication;
    • Overlap gradient synchronization in data parallelism with backward computation to reduce exposed communication time;
    • Pipeline parallelism introduces bubbles, so split layers as evenly as possible and use a reasonable number of micro-batches to dilute the bubble fraction.

    It is worth stressing that higher parallelism is not always better. Finer splits reduce per-card compute but raise the communication share; once communication becomes the dominant term, adding more cards only lowers overall efficiency.

    5. Numerical Stability: The Real Difficulty of a Smooth 400 Steps

    Mid-training crashes in large model training are usually numerical rather than code errors. Practices that work in practice include:

    • Prefer low-precision formats with a friendlier dynamic range, and keep higher precision for sensitive operators (normalization, loss accumulation, optimizer updates);
    • Scale the loss correctly by the number of micro-batches to avoid magnitude drift during gradient accumulation;
    • Apply global gradient norm clipping and continuously observe its fluctuation range;
    • Configure weight decay and learning-rate warmup separately to avoid overly aggressive updates early on;
    • On the data side, ensure sample ordering is deterministic and reproducible across different parallel layouts, making it easier to bisect and locate the anomalous step.

    6. Observability and Long-Running Stability

    Getting the pipeline to run is only the starting point; long runs depend on observability. Collect at least four categories of metrics with unified timestamps for alignment: throughput and per-step time, communication time per parallel group, memory usage and fragmentation changes, and loss and gradient norm curves. Make checkpoints write asynchronously to storage, paired with object storage, so that after a failure the job resumes from the previous step instead of starting over. Logs and metrics can feed into a unified logging service with monitoring and alerting, with threshold alerts for slow nodes and loss anomalies.

    7. Common Failures and Troubleshooting Order

    Symptom Priority Investigation Direction
    Loss spikes after the first few dozen steps Learning-rate warmup, clipping threshold, low-precision overflow
    No progress at a given step for a long time Slow node, communication timeout, storage read blocking
    Steadily growing memory usage Fragmentation, unreleased cache, activation references not released
    Metrics inconsistent after resuming training Optimizer state and random seeds not fully saved

    8. Conclusion

    Validating a large-scale pre-training pipeline on domestic accelerator cards comes down to bringing five things into an acceptable range at the same time: hardware topology, the software stack, parallelism strategy, numerical stability, and observability. Using two nodes and sixteen cards over 400 steps as the baseline, securing correctness and reproducibility first and then scaling up gradually is the lowest-risk path. Teams building compute platforms can combine general capabilities such as the container platform, object storage, and monitoring and alerting offered by Baidu AI Cloud to turn the above workflow into a standardized training pipeline.