Bringing Up Distributed Large-Model Training on Domestic AI Accelerators
This article explains a practical method for bringing up a complete distributed training pipeline for large models on domestic AI accelerators. Using a two-node, 16-accelerator setup as a validation unit, it covers parallelism strategy selection, framework and operator adaptation, communication and topology optimization, convergence validation, and troubleshooting common failures.
1. Background and Problem Definition
Training large models usually requires collaboration across multiple servers and tens or even hundreds of AI accelerators. Compared with single-card training, multi-node and multi-card training involves not only model and data scale, but also a series of engineering issues such as hardware ecosystem support, communication topology, and framework adaptation. When using new hardware platforms, such as domestic or non-mainstream AI accelerators, one of the first critical tasks is to “bring up” a complete training pipeline on an existing training framework and run enough iterations to verify correctness. This is often a necessary step before large-scale production training.
Here, “bringing up the training pipeline” does not mean pursuing the best possible training throughput. Instead, it means completing a full and correct training loop on the target hardware platform. This can be understood at three levels:
- Complete training loop: model definition, data loading, forward computation, backward propagation, parameter updates, and checkpoint saving can all be executed normally.
- Correct communication: under a configured multi-node and multi-card topology, gradient synchronization is free from errors, precision anomalies, and hangs across cards.
- Stable iteration: several hundred consecutive iterations can be executed, and the loss curve is observed to confirm whether it decreases smoothly. This verifies correctness from both numerical and engineering perspectives.
Using a small-to-medium configuration such as “two nodes and 16 cards” as the validation unit is a reasonable choice that balances cost and representativeness. It can trigger inter-node communication while also exposing most adaptation issues within an acceptable time window.
2. Choosing a Distributed Parallelism Strategy
The core of multi-card training is the orchestration of parallelism strategies. Commonly used parallelism dimensions include:
- Data Parallelism: different batches of data are distributed to each card. Each card computes gradients, and the gradients are synchronized through collective communication operations such as All-Reduce. It is relatively simple to implement and scales well, but it can require more memory and communication bandwidth.
- Tensor Parallelism: operators within a single layer, such as matrix multiplication, are split across multiple cards and computed collaboratively. It is suitable when a single layer is too large to fit on one card, but it introduces frequent intra-layer communication.
- Pipeline Parallelism: the model is split into stages by layer and placed on different cards. Micro-batches are scheduled to form a pipeline. The main challenges are pipeline bubbles and scheduling efficiency.
- Sequence/Context Parallelism: for very long sequence scenarios, activations can be further partitioned along the sequence dimension to reduce activation memory pressure.
In practical engineering, multi-dimensional hybrid parallelism is commonly used. For a two-node, 16-card scenario, a common and stable organization is:
- Use tensor parallelism within a node to leverage high-bandwidth intra-node interconnects.
- Use data parallelism across nodes to scale overall throughput.
- Combine gradient accumulation to balance memory usage and the effective batch size.
A simplified configuration is shown below. This is pseudo-code and is only used to illustrate how the parallelism dimensions are organized:
# Pseudo-code: organizing a multi-dimensional parallelism strategyparallel_config = {"tensor_parallel_size": 2, # intra-node tensor parallelism degree"pipeline_parallel_size": 1, # pipeline parallelism degree"data_parallel_size": 8, # inter-node data parallelism degree"gradient_accumulation_steps": 4, # gradient accumulation steps"micro_batch_size": 1, # micro-batch size per device}# Total devices = tensor * pipeline * data = 2 * 1 * 8 = 16
It is important to note that a larger parallelism degree is not always better. Tensor parallelism introduces a large amount of intra-layer communication and is usually limited to intra-node deployment. Across nodes, data parallelism is generally preferred when communication overhead needs to be kept relatively manageable. A reasonable configuration is the foundation for later performance optimization.
3. Framework and Operator Adaptation
On new hardware platforms, the main difficulty in bringing up training is often not the model structure itself, but the depth of software stack adaptation. Typical work includes:
- Runtime and driver integration: ensure that the training framework can access the accelerator through a unified device abstraction layer, complete device initialization, allocate memory, and dispatch kernels.
- Operator coverage and precision alignment: large models rely on many custom or fused operators, such as attention, normalization, and optimizer updates. Each operator needs to be verified on the target hardware, and numerical alignment tests should be performed to ensure that its output error is within an acceptable range compared with the reference implementation.
- Mixed-precision strategy adaptation: low-precision computation is commonly used during training to accelerate execution and save memory. It is necessary to confirm the target hardware’s support for each precision format and verify whether mechanisms such as loss scaling work correctly.
- Communication library integration: collective communication primitives, such as All-Reduce, All-Gather, and Reduce-Scatter, must be correctly integrated with the underlying interconnect hardware. This is the foundation of correctness for multi-card training.
A practical technique during adaptation is “progressive convergence verification”: first run a very small model on a single card, then expand to multiple cards and multiple nodes, and finally scale up to the target model size. This helps avoid introducing too many variables at once, which makes problem localization difficult.
4. Communication and Topology Optimization
Once the training pipeline is running, the bottleneck often shifts from compute to communication. Key optimization directions include:
- Communication and computation overlap: overlap gradient synchronization with backward computation as much as possible to hide communication latency.
- Topology-aware placement: place groups with the most frequent communication, such as tensor-parallel groups, on high-speed intra-node interconnects to reduce cross-node traffic.
- Gradient compression and bucketing: combine gradient bucketing to merge small messages and reduce communication launch overhead.
- Efficient gradient synchronization algorithms: choose appropriate reduction algorithms and sharding strategies based on data scale to reduce redundant transmission.
In containerized deployment scenarios, training tasks can run on a container platform. Datasets and checkpoints can be stored uniformly in object storage, while task status can be continuously observed through logging services and monitoring alerts. These general cloud capabilities help teams focus more on training itself rather than infrastructure operations.
5. Convergence Validation: Why Run Several Hundred Steps?
Running one step successfully is not enough to prove that training is correct. Setting “several hundred consecutive steps” as a validation target is essentially a low-cost correctness check:
- Check the loss curve: training loss should drop rapidly at the beginning and then gradually stabilize. Oscillation, divergence, or NaN values usually indicate problems with the learning rate, initialization, precision, or gradient handling.
- Check gradient norms: stable gradient norms indicate that the backward pass is numerically healthy. Abnormal spikes often point to dirty data samples or numerical overflow.
- Check throughput and memory usage: stable per-step latency and memory usage indicate that there are no hidden resource leaks or repeated recompilations.
Several hundred steps are usually enough to cover the optimizer warmup phase and enter a stable region. This is a cost-effective “health check” window.
6. Common Failures and Troubleshooting
| Symptom | Possible causes | Troubleshooting focus |
|---|---|---|
| Multi-card hang or no response | An operator is not ready on one card; communication mismatch | Reduce the scale to reproduce the issue; enable synchronization debugging |
| Loss becomes NaN/Inf | Precision overflow; learning rate too high | Check loss scaling and initialization |
| Loss differs across cards | Gradients are not correctly synchronized | Validate communication primitives and parallel group partitioning |
| Large jitter in per-step latency | Communication contention; data loading bottleneck | Analyze communication-computation overlap and prefetching |
When troubleshooting, follow the principle of “changing one variable at a time”. For example, change only one factor at a time, such as parallelism degree, batch size, or precision. Also, use logging services to retain key metrics for later analysis and traceback.
7. Summary
Bringing up a large-model training pipeline on domestic or new AI accelerators is a systematic engineering effort. It covers parallelism strategy orchestration, software stack adaptation, communication optimization, and convergence validation. Using a two-node, 16-card setup and several hundred consecutive training steps as a validation target can expose problems under limited compute resources while also providing low-cost evidence that training is correct at both the numerical and engineering levels.
Once this methodology is established, teams can build confidence in the reliability of the hardware platform and the correctness of training before formal large-scale training. This also lays a solid foundation for later performance tuning and scale expansion.
