Practical Guide to Training Large Models on Domestic GPUs: Completing a 400-Step Run

    This article explains why completing 400 consecutive training steps is a key milestone for validating a large model training pipeline on domestic GPUs. It covers environment alignment before multi-node runs, trade-offs in parallelism strategy, communication and topology optimization, and the observability, checkpointing, and fault recovery practices needed for a stable run. Readers will learn how to interpret the results and decide on next steps for scaling out.

    1. Why Completing 400 Steps Is a Meaningful Milestone

    In large model engineering, being able to start training and being able to keep training running stably are two different levels of maturity. The former only requires that the environment loads and the operators execute. The latter requires continuous, error-free operation across forward pass, backward pass, parameter updates, gradient synchronization, and checkpoint saving.

    The industry commonly treats several hundred consecutive iterations as the baseline threshold for pipeline validation, for three reasons:

    1. It covers a full iteration cycle: 400 steps are enough to expose defects that only appear over long runs, such as memory leaks, fragmentation buildup, and numerical overflow.
    2. It triggers all code branches: logic such as learning rate warmup, gradient clipping, checkpoint writing, and log aggregation is often first executed only after a number of steps.
    3. It creates a comparable baseline: with a stable loss curve and throughput data, scaling out to more nodes has a reference point.

    Completing 400 steps on two nodes with 16 devices therefore validates the maturity of the software stack rather than peak compute.

    2. Aligning the Environment Before Validation

    The most common source of failure in cross-node training is not the model code but environment inconsistency. The following alignment checklist is recommended before launch:

    • Driver, runtime, communication library, and framework versions must be identical on every machine; distribute a unified image rather than installing on each machine individually.
    • Declare environment variables for compute and communication libraries explicitly instead of relying on defaults.
    • Run a basic operator self-check and a point-to-point communication self-check on each machine to confirm bandwidth and latency meet expectations.
    • Keep data paths consistent, with reproducible sample indexing and sharding rules.

    Illustrative pre-launch self-check logic:

    1. # Pseudocode: environment self-check
    2. assert backend.is_available()
    3. assert backend.device_count() == expected_per_node
    4. all_reduce(scalar_tensor(1.0)) # communication connectivity
    5. report(versions, env_vars, topology)

    3. Trade-offs in Parallelism Strategy

    Two nodes with 16 devices is a typical small-scale validation scenario, so the parallelism strategy should not be overly complex. The usual engineering trade-offs are:

    • Prioritize data parallelism: it is simple to implement and scales nearly linearly, making it suitable for the validation stage.
    • Use gradient accumulation instead of a larger batch: when memory is constrained, trade accumulation steps for an equivalent batch size, at the cost of longer per-step time.
    • Enable mixed precision cautiously: confirm the loss scaling strategy and numerical stability to avoid NaN in the loss.
    • Enable memory recomputation as needed: it trades roughly 30% extra computation for memory space, so balance throughput against feasibility.

    A common way to compute the effective batch size:

    1. global_batch = micro_batch * grad_accum_steps * world_size
    2. world_size = node_num * device_per_node = 2 * 8 = 16

    4. Communication and Topology Optimization

    The performance bottleneck in multi-node training usually appears during gradient synchronization. Practical optimization measures include:

    1. Bucket gradients and overlap computation with communication so backward computation and data transfer proceed in parallel.
    2. Set a reasonable transfer granularity per operation: too small amplifies launch overhead, too large weakens the overlap effect.
    3. Prefer high-speed interconnect channels, and separate the control plane from the data plane.
    4. Turn off unnecessary logging and high-frequency metric reporting so control overhead does not consume bandwidth.

    If measurements show communication taking too large a share of per-step time, investigate topology and NIC binding first, then consider adjusting the parallelism dimensions.

    5. Stability, Monitoring, and Recovery

    Whether 400 steps complete smoothly depends largely on observability:

    • Metrics: per-step time, memory usage, gradient norm, loss and learning rate, and the share of time spent on communication.
    • Logs: tag the source by rank so an anomaly can be traced directly to a specific device.
    • Checkpoints: save at fixed step intervals and keep the most recent few; make the write asynchronous to reduce stalls.
    • Fault tolerance: restart automatically when a node fails and resume from the latest checkpoint; on resume, verify that the optimizer state and data cursor are consistent.
    1. Every 50 steps: save a checkpoint + output throughput and memory snapshot
    2. Every 10 steps: verify the loss is finite; skip the batch and log it if not

    6. Interpreting Results and Next Steps

    After 400 steps complete, you get three types of conclusions: pipeline availability, a performance baseline, and bottleneck identification. To scale to more nodes, focus on scaling efficiency rather than absolute throughput. To support real workloads, add long-duration stability testing and data quality checks. In real engineering practice at Baidu AI Cloud, this kind of validation is typically used together with common capabilities such as container platforms, object storage, logging services, and monitoring and alerting to shorten environment setup and problem diagnosis time.