Multi-Node Multi-Card LLM Training on Domestic Accelerator Cards: Practical Pipeline Guide
This article presents a practical methodology for validating a complete large-language-model training pipeline on domestic heterogeneous accelerator cards. Using a two-node, sixteen-card setup as an example, it explains hardware topology, software-stack adaptation, distributed parallelism, common failure modes, and validation practices for convergence and throughput.
1. Background and Problem Definition
As the parameter counts of large language models continue to grow, training compute demand is rising exponentially. While the supply of compute from domestic heterogeneous accelerator cards is gradually improving, engineers often encounter a core question in real deployments: how to get a complete training pipeline running on a new hardware platform.
Here, “getting the training pipeline running” does not simply mean that the model can execute without errors. It means meeting several progressively stronger conditions:
- Can start: the multi-node, multi-card environment initializes correctly, and communication is established between nodes and accelerators;
- Can perform forward and backward passes: one complete training iteration, including forward computation, loss computation, backward propagation, and parameter update, executes end to end;
- Can converge stably: after running for hundreds of steps, the loss decreases as expected, with no divergence or numerical anomalies;
- Can achieve throughput: the amount of data processed per unit time, measured in tokens/s or samples/s, reaches a usable level, and hardware utilization is reasonable.
The example case of running 400 steps on two nodes with 16 cards is a typical validation scenario. It uses a relatively small multi-node, multi-card environment to quickly verify whether the software stack, parallelism strategy, and numerical correctness meet the standard for training. The following sections break down the methodology.
2. Layers of the Training Pipeline
To understand how to get the pipeline running, it helps first to see which layers make up a training pipeline. A problem in any layer can break the pipeline:
- Hardware layer: accelerator cards, high-speed inter-card interconnect, inter-node network such as RDMA or high-speed Ethernet, and host CPU and memory;
- Driver and runtime layer: device drivers, collective communication libraries, and runtime management tools that dispatch computation from upper layers to the hardware;
- Framework and operator layer: the training framework and its underlying operator libraries, responsible for computation graph construction, operator scheduling, mixed precision, and automatic differentiation;
- Parallelism and scheduling layer: combinations of data parallelism, tensor parallelism, pipeline parallelism, and other strategies, along with communication scheduling;
- Application and data layer: data loading pipelines, model definitions, optimizers and learning-rate schedules, and checkpoint saving.
If any layer is mismatched, the problem usually appears early in the pipeline as an initialization failure, an unsupported operator, a communication timeout, or numerical divergence. The essence of getting the pipeline running is to align these layers step by step and validate them progressively.
3. Hardware Setup: The Foundation of Two-Node Multi-Card Training
A two-node, sixteen-card setup means that each node hosts eight accelerator cards, and the two nodes are connected through a high-speed network. During hardware setup, three aspects matter most:
- Intra-node topology recognition: confirm the device ID and memory capacity of each accelerator card, and determine whether inter-card communication uses a high-speed interconnect;
- Inter-node bandwidth: communication overhead in multi-node training mainly comes from cross-node collective communication. Cross-node bandwidth and latency directly affect parallel scaling efficiency;
- Device mapping: when writing code, bind logical processes to physical devices correctly to avoid multiple processes contending for the same card.
The following pseudocode illustrates a typical binding and initialization flow. The communication backend should be replaced with the collective communication implementation provided by the accelerator vendor.
# Illustrative code: multi-node, multi-card distributed training initializationimport osdef init_distributed():# Initialize the process group. The backend must use the collective communication backend provided by the accelerator vendor.dist.init_process_group(backend="<accelerator_collective_backend>")local_rank = int(os.environ["LOCAL_RANK"]) # Device index within the nodeglobal_rank = int(os.environ["RANK"]) # Global process indexworld_size = int(os.environ["WORLD_SIZE"]) # Total number of processes (16 in this case)# Bind the current process to the corresponding accelerator cardset_device(local_rank)# Agree on data shards for each process during initialization to ensure inputs do not overlapreturn global_rank, world_size
4. Software Stack Adaptation: The Key to a Working Pipeline
When bringing up a pipeline on new hardware, the largest amount of work is often not writing the model, but adapting the software stack. Key areas include:
- Operator coverage and numerical alignment: operators such as attention, normalization, and activation must have efficient and numerically equivalent implementations on the accelerator. Missing operators can be filled in through composition, replacement, or reference implementations, but care must be taken to avoid a situation where the pipeline “runs but is extremely slow”;
- Mixed precision strategy: large-model training commonly uses half precision with loss scaling to balance speed and stability. During adaptation, verify that the numerical behavior of half-precision forward and backward passes is consistent with the reference implementation, and avoid loss failing to decrease due to precision issues;
- Communication primitive support: gradient synchronization for data parallelism relies on AllReduce, while tensor parallelism relies on AllGather and ReduceScatter. Confirm that these collective communication primitives are complete and efficient on the hardware backend;
- Randomness and reproducibility: fix random seeds so that initialization and data sampling are reproducible. This is a prerequisite for diagnosing numerical issues.
5. Combining Distributed Parallelism Strategies
In a sixteen-card environment, using data parallelism alone may put significant pressure on device memory. In practice, multiple parallelism strategies are often combined:
- Data parallelism: each card holds a full model replica, processes different data, and aggregates gradients through synchronization. It is simple to implement, but memory usage grows linearly with model size;
- Tensor parallelism: matrix operations within a single layer are split across multiple cards, reducing memory and compute pressure on each card. The tradeoff is frequent intra-layer communication, so it is best deployed within high-speed intra-node interconnects;
- Pipeline parallelism: the model is split across cards by layer, and executed in a pipelined manner using micro-batches. It is suitable for cross-node scaling, but pipeline bubbles must be handled properly.
A reasonable mapping principle is: communication-intensive tensor parallelism should be kept within intra-node high-speed interconnects, while pipeline parallelism, which has relatively sparse communication, can be used across nodes. This reduces pressure on cross-node bandwidth.
6. Common Challenges and Troubleshooting
| Symptom | Common root cause | Troubleshooting direction |
|---|---|---|
| Initialization hangs or times out | Collective communication backend is not connected, or network or environment variables are misconfigured | Check the process group, network and ports, and whether nodes can reach each other |
| Unsupported operator error | Incomplete operator library coverage on the accelerator | Locate the missing operator, and try an equivalent replacement or reference implementation |
| Loss does not decrease or diverges | Mixed-precision overflow, learning rate too high, or overlapping data shards | Adjust loss scaling, verify data partitioning, and reproduce for comparison |
| Throughput is too low | Cross-node communication bottleneck, unreasonable parallel partitioning, or data loading cannot keep up | Analyze communication overhead, adjust parallel mapping, and optimize the data pipeline |
The significance of running 400 steps is that this number of steps is enough to cover initialization, multiple gradient updates, and learning-rate warmup. It can quickly verify whether the pipeline is truly stable and trainable, rather than stopping at the level of “it can run for one step.”
7. Validation and Best Practices
After the pipeline is running, convergence validation is recommended as follows:
- Controlled comparison: using the same data, model structure, and hyperparameters, compare the loss curve against a reference platform and confirm that the trend is consistent and the magnitude is close;
- Small-scale convergence: use a smaller model or shorter sequence to quickly close the full training loop, then gradually increase scale;
- Throughput and utilization evaluation: measure tokens/s and the compute/communication ratio on each card to determine whether there is an obvious bottleneck;
- Stability long run: run continuously for hundreds to thousands of steps and observe whether occasional numerical jitter or communication anomalies occur.
From an engineering perspective, it is helpful to combine general capabilities such as compute resources, containerized runtime environments, object storage for data and checkpoints, and logging, monitoring, and alerting. These make it easier to reproduce environments quickly, view training logs centrally, and set anomaly alerts. In cloud environments, such capabilities are often provided as standardized service categories, helping teams focus their effort on adaptation and tuning.
8. Summary
Getting a large-model training pipeline running on domestic heterogeneous accelerator cards is a systems-engineering task that spans hardware, drivers, frameworks, operators, and parallelism strategies. Its core path can be summarized as: first align the layers, then validate them step by step, and finally evaluate convergence and throughput. A small-scale two-node, multi-card validation is a cost-effective starting point. It exposes software-stack and numerical issues at relatively low cost and lays a reliable foundation for larger-scale training. With this methodology, engineers can reuse a practical framework for bringing up and tuning new hardware platforms or model structures.
