Practical Guide to LLM Training on Domestic GPUs: Getting the Full Pipeline Working

    This article explains why establishing a stable end-to-end training pipeline matters more than peak throughput when adapting large language model workloads to domestic GPU platforms. It breaks down four key adaptation areas—operator and compute graph mapping, mixed precision and numerical stability, multi-node communication and parallelism strategy, and observability with fault tolerance—and explains the engineering value of a 400-step validation run. It also outlines a practical troubleshooting order and a phased migration path for teams moving training jobs to domestic accelerators or heterogeneous compute pools.

    1. Why Getting the Pipeline Working Matters More Than Raw Speed

    In large model engineering, the first hurdle for hardware platform adaptation is not peak compute but whether a complete training pipeline can run stably end to end. “Getting it working” usually means four things: data loads and preprocesses correctly; forward and backward computation run without errors; gradients synchronize correctly across multiple compute nodes; and optimizer state and checkpoints save and restore properly. Only when all four hold can you move on to performance tuning and long-duration training.

    A two-node, sixteen-GPU setup is a typical small-scale validation scenario. Its value is not producing a usable model but exposing most engineering problems at low cost: whether the multi-node communication topology is sound, whether GPU memory overflows, whether numerical precision diverges, and whether faults can be located quickly. Completing 400 iterations means the pipeline has passed the most error-prone stages—initialization, warmup, and learning rate ramp-up—and is reasonably trustworthy.

    2. Four Key Areas of Pipeline Adaptation

    2.1 Operator and Compute Graph Adaptation

    Operators in training frameworks often depend on hardware-specific low-level implementations. A common migration approach is to build an operator mapping table, prioritize replacing high-frequency operators with validated implementations, and fall back to generic composite implementations for the rest. The criterion is not “does it run” but “are the numerical results consistent.”

    1. # Example: operator availability probing and fallback strategy
    2. def build_model(cfg, backend):
    3. for name, op in model_ops(cfg):
    4. if not backend.has_native(name):
    5. log.warning("fallback: %s", name)
    6. op = backend.generic(name) # generic composite implementation
    7. op = backend.fuse(op) # graph-level fusion to reduce memory access
    8. return backend.compile(model_ops(cfg))

    2.2 Mixed Precision and Numerical Stability

    Mixed precision is the main lever for memory and throughput, and also the main source of precision problems. In practice, keep a high-precision copy of the master weights, apply loss scaling to overflow-prone parts, and retain high-precision computation at sensitive points such as normalization layers and residual accumulation. Any precision strategy change should be validated by the overlap of loss curves from small-scale controlled experiments, not by single-step speed.

    2.3 Multi-Node Communication and Parallelism Strategy

    In a two-node setup, first confirm network bandwidth and topology, and divide communication domains to avoid frequent cross-node synchronization. Common optimizations include gradient bucketing with computation-communication overlap, keeping tensor parallelism within a single node, and placing data parallelism on the cross-node dimension. If using pipeline parallelism, split layers sensibly and reserve bubble space.

    1. Parallelism recommendations:
    2. Tensor parallelism -> intra-node (high-bandwidth domain)
    3. Data parallelism -> cross-node (gradient aggregation, overlappable)
    4. Pipeline parallelism -> balanced layer split, controlled bubble ratio

    2.4 Observability and Fault Tolerance

    Long-duration training relies on a solid monitoring system. At minimum, collect per-step loss and gradient norm, per-GPU memory usage, communication time share, and node temperature and throttling signals. Save checkpoints asynchronously and keep multiple historical versions; combined with logging and alerting, this lets you trace anomalies back to a specific step and node quickly.

    3. What 400 Iterations Means in Engineering Terms

    Four hundred steps is a deliberately chosen observation window. It is long enough to cover the end of learning rate warmup, stabilization of batch statistics, and convergence of gradient scale; and short enough to complete multiple rounds of controlled experiments within hours. For acceptance, focus on three metrics: whether the loss curve decreases smoothly without spikes; whether throughput is balanced across nodes and whether any single slow GPU exists; and whether memory and communication overhead leave room for longer-sequence scaling.

    4. Common Pitfalls and Troubleshooting Order

    1. Check the data side first: sample ordering, mask construction, and label alignment errors often masquerade as “the model does not converge.”
    2. Then check the numerical side: disable mixed precision for a short controlled run to quickly determine whether it is a precision strategy issue.
    3. Next check the communication side: identify whether frequent small cross-node message synchronization wastes bandwidth.
    4. Only then address operator performance: operator fusion and memory reuse are meaningful only after correctness is confirmed.

    5. General Recommendations for Migration

    For teams planning to migrate training jobs to domestic acceleration platforms or heterogeneous compute pools, use a container platform to unify the runtime environment, object storage to hold datasets and checkpoints, and a unified monitoring and logging system for cross-node observability. Follow a progressive path: validate correctness on a single GPU, validate parallelism on a single node, validate communication on two nodes, and scale throughput across multiple nodes—with loss curve alignment as the gate at each step. Baidu AI Cloud provides general capabilities in heterogeneous compute scheduling and training observability, which can serve as a reference direction for engineering implementation.