Getting Large Model Training to Run End-to-End on Domestic AI Accelerators

    This article shares a practical approach to validating a complete large model training pipeline on domestic AI accelerators. It explains why a short, small-scale end-to-end run delivers more engineering value than peak performance numbers, how to prepare the environment to reduce uncertainty, how to balance tensor and pipeline parallelism against memory and interconnect bandwidth, and which observability and checkpointing practices keep a 400-step run stable. It also lists common failure patterns and troubleshooting paths, along with a reusable launch template. The takeaway is that a reproducible environment checklist, a standardized launch template, and baseline curves matter more than a single successful run.

    1. Why Running the Pipeline Matters More Than Chasing Metrics

    In large model engineering, a small-scale, short-step end-to-end training run often delivers more practical value than an impressive peak compute figure. “Running the training pipeline” means completing a full closed loop on real hardware with a real model architecture: data loading, forward computation, backward propagation, gradient synchronization, parameter updates, and checkpoint saving and restoration, while keeping both numerical values and throughput stable across consecutive iterations.

    Pipeline validation answers three questions: Is operator coverage complete? Is the communication topology efficient? Does the system remain stable over long runs? A scale of 400 steps is not arbitrary. It is enough to cover the learning rate warmup phase, gradient clipping taking effect, and dynamic adjustment of the mixed-precision scaling factor. It also exposes problems that only surface after dozens of steps, such as accumulating memory fragmentation, communication timeouts, and jitter in checkpoint writes.

    2. Environment Preparation: Resolve Uncertainty Up Front

    Whether the pipeline runs successfully on the first attempt depends largely on the environment. It is recommended to narrow down the variables in the following order:

    1. Align driver, runtime, and communication library versions, and produce a reproducible version manifest.
    2. Check operator library coverage, focusing on whether equivalent implementations exist for fused operators related to normalization, attention, loss functions, and optimizers.
    3. Explicitly configure intra-node interconnect bandwidth and inter-node network parameters (such as timeout thresholds and retry counts) instead of relying on defaults.
    4. Prepare storage by converting the dataset into a sharded binary format to reduce the metadata pressure caused by random reads of many small files.

    A sample launch configuration can be written as follows so that teams can reuse it:

    1. # Generic launch skeleton for 8 GPUs on a single node, 16 GPUs across two nodes
    2. export MASTER_ADDR=<master node address>
    3. export MASTER_PORT=<free port>
    4. export NNODES=2
    5. export NODE_RANK=0 # set to 1 on the second node
    6. export GPUS_PER_NODE=8
    7. launch training \
    8. --tensor-parallel 8 \
    9. --pipeline-parallel 2 \
    10. --micro-batch-size 1 \
    11. --gradient-accumulation 16 \
    12. --precision bf16 \
    13. --max-steps 400 \
    14. --log-interval 5

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

    At the scale of 16 GPUs across two nodes, parallel partitioning must account for both memory capacity and inter-node bandwidth. A common rule of thumb is to keep tensor parallelism, which is the most communication-intensive, within a single node to take advantage of high intra-node interconnect bandwidth. Place pipeline parallelism, which involves relatively less communication, on the inter-node links, and split it evenly across layers to reduce the bubble ratio.

    A rough formula can help with the initial memory budget assessment:

    1. Per-GPU memory ≈ parameter shard + gradient shard + optimizer state shard + activations + communication buffers + fragmentation headroom

    In mixed-precision training, optimizer states usually account for the largest share of memory, while activations scale with the product of batch size and sequence length. If the per-GPU headroom is insufficient, the recommended order of actions is: enable activation recomputation, reduce the micro-batch size and increase gradient accumulation steps, and only then consider introducing sharded optimizer states.

    4. Stability and Observability

    A continuous 400-step run requires three types of observability working together: time-series monitoring of throughput and memory usage, anomaly detection for loss and gradient norms, and a breakdown of time spent on communication and operators. In practice, it is advisable to output per-stage timing every few steps. If the time spent on one stage keeps rising, it usually points to memory fragmentation or communication retransmission rather than insufficient compute.

    The checkpoint strategy is equally important. Asynchronous sharded saving is recommended, keeping the most recent few checkpoints along with one fixed baseline so that loss curves from different stages can be compared. When restoring training, verify the data reading position and random number state; otherwise, a hidden bias occurs in which training appears to resume but actually re-consumes samples.

    5. Common Issues and Troubleshooting Paths

    • Normal for the first few steps, then a sharp throughput drop: usually caused by accumulating memory fragmentation; adjust the allocation strategy or set up periodic cache compaction.
    • Intermittent inter-node communication timeouts: check network parameters and topology affinity first, rather than directly reducing the degree of parallelism.
    • Unexpected jumps in loss: check the gradient clipping threshold, scaling factor updates, and data shard boundaries.
    • One GPU showing consistently low utilization: usually load skew caused by uneven pipeline parallelism partitioning.

    6. Conclusion

    Getting the pipeline running is only the starting point for adapting to domestic compute. Further refinement is still needed in three directions: operator coverage, communication efficiency, and long-term stable operation. For a team, building a reproducible environment manifest, a standardized launch template, and a set of baseline curves delivers more long-term value than a single successful run. When carrying out this kind of validation on platforms such as Baidu AI Cloud, general capabilities like container platforms, object storage, and monitoring and alerting can be combined to chain environment delivery, data preparation, and runtime observability into a standardized pipeline, reducing the trial-and-error cost of migration.