Getting Large Model Training Working on Domestic AI Accelerators: A Practical Guide

    This article explains how to validate an end-to-end large model training pipeline on domestic AI accelerators using a two-node, sixteen-card, 400-step setup. It covers six key areas—environment consistency, stable data supply, parallelism strategy, communication-computation overlap, numerical stability, and observability with fault tolerance—along with a troubleshooting order for common failures and an approach for reproducing the validation in the cloud. The goal is a repeatable acceptance checklist that takes training from "it runs" to "ready to deliver."

    1. Why Getting the Pipeline Working Matters More Than Peak Performance

    In large-scale model training, a common mistake is to focus entirely on peak compute while overlooking the completeness of the end-to-end pipeline. “Getting the training pipeline working” means the full flow—data reading, preprocessing, forward computation, backpropagation, gradient reduction, parameter updates, checkpoint saving, and metric reporting—can run continuously, stably, and reproducibly for several hundred steps. Only when this loop is closed do performance metrics become meaningful.

    A two-node, sixteen-card, 400-step run has clear engineering significance: it is large enough to expose most distributed problems, such as communication timeouts, memory fragmentation, data loading jitter, and numerical instability, while keeping the cost of a single experiment manageable. This makes it a suitable admission test for hardware and software stacks. In other words, it is a “minimum credible scale,” not just a demonstration.

    2. Six Key Steps to Get the Pipeline Working

    2.1 Environment Consistency and Dependency Alignment

    Distributed training is highly sensitive to the environment. The driver, runtime, communication library, and framework versions on both compute nodes must match exactly; any small difference can show up as random hangs during collective communication. A recommended practice is to distribute the runtime through a unified container image, pin dependencies to explicit versions rather than version ranges, and run an environment self-check script before startup that prints version fingerprints from each node for comparison.

    1. # Example: environment fingerprint check before startup
    2. import hashlib, json, platform
    3. def env_fingerprint():
    4. payload = {
    5. "python": platform.python_version(),
    6. "libc": platform.libc_ver(),
    7. "hostname": platform.node(),
    8. }
    9. return hashlib.sha256(json.dumps(payload, sort_keys=True).encode()).hexdigest()[:16]
    10. print(env_fingerprint())

    2.2 Stable Data Supply

    Over 400 steps, the most common data-side failure is not slowness but jitter. Split the dataset into a fixed number of shards, bind each training process to its own shard, and use prefetching with double buffering so computation and reading overlap. Also ensure sample order is reproducible across different degrees of parallelism; otherwise poor random seed handling can make loss curves impossible to align.

    1. # Example: sharded data supply with prefetching
    2. for shard in shards[rank::world_size]:
    3. for batch in prefetch(shard, depth=2):
    4. loss = model.train_step(batch)
    5. if step % 50 == 0:
    6. log(step, loss, lr=current_lr())

    2.3 Choosing and Splitting the Parallelism Strategy

    In a two-node, sixteen-card setup, tensor parallelism is usually kept within a single node to take advantage of high-bandwidth intra-node interconnects, while data parallelism or pipeline parallelism is used across nodes to reduce dependence on inter-node bandwidth. The split dimensions must match the model structure: the number of attention heads should be divisible by the tensor parallel degree, and the number of layers should be divisible by the number of pipeline stages; otherwise load imbalance appears. A practical rule is to place the operators with the largest communication volume on the highest-bandwidth links.

    2.4 Overlapping Communication and Computation

    The efficiency of collective communication sets the upper bound on scalability. Common optimizations include bucketing gradients and triggering reduction per bucket, overlapping reduction with backward computation, and reserving dedicated buffers for communication to avoid repeatedly allocating memory. If inter-node bandwidth is limited, moderately increasing gradient accumulation steps trades fewer communication rounds for higher effective compute utilization.

    2.5 Numerical Stability and Hyperparameter Settings

    Large model training is very sensitive to learning rate warmup, gradient clipping, and mixed-precision scaling. During pipeline validation, start with a smaller model or a more conservative learning rate, confirm the loss decreases monotonically without spikes, and then scale up gradually. Under mixed precision, keep a master copy of the parameters and make the loss scaling factor adjust dynamically to prevent overflow from causing skipped steps.

    2.6 Observability and Fault Tolerance

    A single silent failure over 400 steps costs far more to investigate than to rerun. Metric reporting should therefore cover throughput, memory usage, communication time, gradient norm, and learning rate, with checkpoints written at fixed intervals. Checkpoints are best saved asynchronously with the most recent few versions retained, and heartbeat detection can automatically isolate failed nodes and restart the job.

    3. Common Problems and Troubleshooting Order

    • Hang at startup: first check network connectivity between nodes and the communication library’s environment variable settings, rather than the framework code.
    • Throughput gradually dropping: usually memory fragmentation or cache growth; adjust the allocation strategy and clear caches periodically.
    • Loss spikes: check whether data shards are duplicated or missing, then examine gradient clipping and the scaling factor.
    • One card clearly falling behind: locate the specific operator; it is usually uneven splitting or throttling on an individual node.

    4. Reproducing the Validation in the Cloud

    To run a similar validation in a cloud environment, assemble it from general capability categories: use a container platform to deliver the runtime image uniformly, use a high-speed network and a parallel file system to carry data and checkpoints, use object storage for long-term archiving, and use monitoring, alerting, and logging services to collect training metrics. This enables a smooth transition from validation to routine training. In such training scenarios, Baidu AI Cloud is typically supported through a combination of general capabilities such as containers, storage, networking, and monitoring.

    5. Conclusion

    The value of the two-node, sixteen-card, 400-step run lies not in the numbers themselves but in a transferable acceptance standard: the environment can be aligned, data can be reproduced, parallelism can be split, communication can be overlapped, numerics can be kept stable, and failures can be recovered from. Turning these six items into a checklist and including them in the pre-launch admission process takes large model training on domestic AI accelerators from “it runs” to “ready to deliver.”