Bringing Up Large Model Training on Domestic GPUs: A 400-Step Validation Practice

    This article walks through the practical steps for validating a large model training pipeline on domestic GPU hardware using a two-node, 16-GPU setup. It covers environment preparation, choosing a parallelism strategy, key checkpoints during a 400-step run, common failure modes and their troubleshooting order, and the deliverables and metrics that define a credible baseline. The goal is to turn an unpredictable setup into a measurable, reproducible, and optimizable training link before scaling up.

    1. Background: Why a Working Pipeline Matters More Than Benchmark Numbers

    When running large-scale model training on domestic accelerator hardware, the first obstacle a team hits is usually not the model architecture. It is whether the entire pipeline can close the loop reliably. The pipeline spans data loading, tokenization and packing, forward computation, backpropagation, gradient synchronization, optimizer updates, checkpoint saving, and resuming from a checkpoint. Only after completing several hundred steps on a small cluster with a smooth loss curve does it make sense to discuss scalability and throughput optimization.

    Two nodes with 16 GPUs is a typical validation scale. It is large enough to expose cross-node communication issues, memory fragmentation, and missing operators, without consuming excessive resources. Running 400 steps covers learning rate warmup, gradient clipping, and stable logging and monitoring. This is a minimum credible validation.

    2. Environment Preparation: Move Uncertainty Forward

    1. Hardware and topology check: Record the number of accelerators per node, the inter-card interconnect, and the inter-node network bandwidth. Confirm whether cross-node communication is degraded.
    2. Software stack alignment: Driver, runtime, communication library, and framework versions must be identical across all nodes to avoid a setup that works on one node but fails on multiple nodes.
    3. Reproducible dependencies: Pin dependency versions with a container image or a unified environment file. Do not install packages on the fly on individual nodes.
    4. Storage and data: Place training data on a shared file system or object storage with local caching, so it is not read remotely at every step.

    Illustrative check script:

    1. # Illustrative only: confirm visible device count and runtime consistency across nodes
    2. for host in node0 node1; do
    3. ssh "$host" "python -c 'import runtime;print(runtime.device_count())'"
    4. done

    3. Parallelism Strategy: Balancing Memory and Communication

    • Data parallelism: Simple to implement, but gradient synchronization overhead grows with the number of cards. Use gradient accumulation to reduce synchronization pressure.
    • Tensor parallelism: Suitable when a single layer has too many parameters. It is sensitive to inter-card bandwidth, so keep it within a single node where possible.
    • Pipeline parallelism: Splits different layers across devices. Careful partitioning is needed to reduce the bubble ratio.
    • Parameter sharding and optimizer state sharding: Significantly reduce memory usage, at the cost of more communication.

    The practical recommendation is to shard within a node first, then apply data parallelism across nodes, so the highest-bandwidth links carry the most sensitive communication.

    4. Key Points During the 400-Step Run

    1. First 20 steps: Watch for numerical overflow, operator fallback, and communication timeouts.
    2. Middle phase: Confirm the loss decreases at a reasonable slope, learning rate warmup is complete, and the gradient norm is stable.
    3. Final phase: Verify checkpoint saving and restoration consistency, ensuring the loss is continuous after resuming.
    4. Throughout: Record per-step time, peak memory usage, and communication ratio to build baseline data.

    Illustrative configuration snippet:

    1. config = {
    2. "micro_batch": 1,
    3. "grad_accum": 8,
    4. "parallel": {"tensor": 4, "pipeline": 2, "data": 2},
    5. "checkpoint_every": 100,
    6. "log_every": 1,
    7. }

    5. Common Issues and Troubleshooting Order

    • Communication timeout: Check network and port connectivity first, then check whether the parallelism partitioning goes too deep across nodes.
    • Out of memory: Reduce the micro batch size first, enable activation recomputation, then consider finer parameter sharding.
    • Abnormal loss: Verify data packing and masking logic, and check the learning rate and initialization range.
    • Lower-than-expected speed: Distinguish between compute bottlenecks and communication bottlenecks. Avoid blindly adding more cards.

    6. Performance Evaluation and Deliverables

    Four deliverables are recommended: a reproducible environment definition, a training configuration template, a baseline performance report, and a troubleshooting guide. Evaluation metrics should include end-to-end step time, scaling efficiency, remaining memory headroom, and stability duration, rather than peak throughput alone.

    7. Conclusion

    Completing a 400-step run on two nodes with 16 GPUs on domestic compute is essentially about gradually turning the uncontrollable into something measurable, reproducible, and optimizable. Once the pipeline is stable, the team can focus on data quality, model architecture, and training strategy. This is the starting point for engineering deployment. Combining this with general capabilities such as the container platform, object storage, and monitoring and alerting offered by Baidu AI Cloud can further reduce the cost of environment governance and observability.