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

    This article walks through a practical validation workflow for large model pretraining on domestic accelerator cards, using a 400-step run on 16 GPUs across two nodes as a representative acceptance sample. It covers environment baseline hardening, choosing parallel strategies that balance memory and communication, mixed-precision stability, observability metrics, and a troubleshooting order for common failures, along with quantifiable criteria for declaring the run successful.

    1. Why Completing 400 Steps Is a Meaningful Milestone

    When running large-scale pretraining on domestic accelerator cards, the hard part is rarely single-card compute. It is whether the entire pipeline can close the loop reliably. A full training validation is usually broken into stages: single-node single-card functional checks, single-node multi-card communication checks, multi-node multi-card scalability checks, and long-run stability and convergence checks. Completing 400 iterations on 16 GPUs across two nodes covers every critical stage from environment setup to gradient synchronization, and from mixed precision to checkpoint writing, which makes it a representative acceptance sample.

    400 steps is not an arbitrary number. It is long enough to trigger learning rate warmup, gradient clipping, and optimizer momentum accumulation, and it also surfaces problems that only appear after dozens of steps, such as periodic logging, checkpoint writes, and gradual memory fragmentation. At the same time, it finishes within an acceptable time budget, which makes it a good regression baseline.

    2. Environment Setup: Eliminate Uncertainty Up Front

    The most common cause of pipeline failure is not model code but environment drift. Lock down the following baseline before you start:

    • Pin driver, runtime, and communication library versions into a single version manifest so nodes stay consistent.
    • Standardize collective communication backend environment variables across nodes, especially NIC selection, timeout thresholds, and retry counts.
    • Measure baseline bandwidth and latency between nodes to confirm the actual topology matches expectations.
    • Stress-test read and write bandwidth on shared or object storage so the checkpoint stage does not become the bottleneck.

    Illustrative configuration (categories of settings only, not a specific product interface):

    1. export NCCL_IB_HCA=mlx5
    2. export NCCL_SOCKET_IFNAME=eth0
    3. export NCCL_DEBUG=INFO
    4. export TORCH_NCCL_BLOCKING_WAIT=1

    Timeout and retry settings matter most in multi-node runs. Defaults are often designed for single-node use, so a small amount of cross-node jitter can trigger a timeout and abort the whole job, which shows up as “the run exits completely after a few dozen steps.”

    3. Parallel Strategy: A Two-Dimensional Trade-off Between Memory and Communication

    Two nodes with 16 GPUs is a small configuration, but it already involves cross-node communication, so the parallel strategy directly determines whether the run completes. Common options include data parallelism, tensor parallelism, pipeline parallelism, and sequence parallelism, usually mixed in practice.

    • Data parallelism: simple to implement and scales well, but optimizer states and gradient replicas add memory and bandwidth pressure, so it is usually paired with sharded optimizer states.
    • Tensor parallelism: reduces per-layer memory usage but communicates frequently, so keep it inside a single node and avoid crossing nodes.
    • Pipeline parallelism: reduces the number of layers per card but introduces bubbles, so it needs sensible partitioning and scheduling.
    • Sequence parallelism: significantly relieves activation growth in long-context scenarios.

    A useful rule of thumb: put the most communication-heavy parallel dimension inside the node and the less communication-heavy dimension across nodes. Deploying tensor parallelism across nodes will very likely cause throughput to collapse or communication to time out within 400 steps.

    4. Numerical Stability: Using Mixed Precision Correctly

    Mixed precision is the main source of memory and throughput gains, and also a frequent cause of pipeline interruptions. Pay attention to three points:

    1. Match the loss scaling strategy to the optimizer. Dynamic scaling is more robust when gradients are sparse or very small early in training.
    2. Keep normalization layers and loss computation at higher precision to avoid accumulation error.
    3. Periodically monitor the norm of key tensors, and locate the specific layer immediately if a norm grows too fast.

    Illustrative monitoring code:

    1. for step, batch in enumerate(loader):
    2. with autocast(dtype=torch.bfloat16):
    3. loss = model(batch).loss
    4. loss.backward()
    5. grad_norm = torch.nn.utils.clip_grad_norm_(model.parameters(), 1.0)
    6. if step % 10 == 0:
    7. logger.info({"step": step, "loss": loss.item(), "grad_norm": grad_norm})
    8. optimizer.step()
    9. optimizer.zero_grad(set_to_none=True)

    5. Observability: Make Every Segment of the 400 Steps Explainable

    The output of pipeline validation is not just “no errors.” It is a set of comparable metric curves. Collect at least: per-step time, communication wait ratio, peak memory and fragmentation rate, gradient norm, loss value, and checkpoint duration. Feed these metrics into logging and monitoring with alerting, and use the container platform to guarantee environment consistency, so you can quickly tell whether scaling is linear when you expand later.

    The pass criteria can be quantified: 400 steps without interruption, loss decreasing monotonically or staying flat, per-step time fluctuating within an acceptable range, and checkpoints restoring successfully so training can resume.

    6. Common Failures and Troubleshooting Order

    • Stuck at initialization: check the communication backend and NIC selection first.
    • Whole job exits midway: check timeout thresholds and storage writes.
    • Out of memory: adjust parallel partitioning and activation recomputation.
    • Abnormal loss: fall back to higher precision and verify the data pipeline.

    7. Conclusion

    Completing 400 iterations on 16 GPUs across two nodes turns “can it train stably” from a subjective judgment into a quantifiable, reproducible engineering conclusion. Get environment hardening, parallel partitioning, numerical stability, and observability right, and you have a reliable foundation for scaling to larger clusters. This is also the methodology Baidu AI Cloud has repeatedly validated in its compute platform practice.