Distributed LLM Training on 16 China-Developed Accelerators Across Two Nodes
This case study examines an end-to-end LLM training workflow that ran continuously for 400 steps on two servers with 16 China-developed accelerator cards. It covers hardware topology, software consistency, parallelism, data loading, distributed startup, monitoring, and troubleshooting, with practical checks and configuration examples for validating a multi-node training setup.
Background and Objectives
As large language models grow in parameter count and training data volume, a single server with multiple accelerators often cannot complete training within an acceptable time. Multi-node distributed training has therefore become standard practice.
This article examines a deployment using two servers equipped with a total of 16 China-developed accelerator cards. The objective was to validate the complete training workflow for a large language model and run it continuously and stably for 400 training steps.
An end-to-end workflow means more than successfully launching a job. Data loading, model construction, distributed parallelism, parameter optimization, and checkpoint saving must all work together continuously. Runs must be reproducible, and failures must be traceable.
The following sections move from hardware and software preparation to configuration, monitoring, and troubleshooting.
1. Hardware Topology and Network Planning
The environment consists of two compute nodes, each with eight accelerator cards. Planning must account for two communication paths:
| Communication scope | Typical path | Key metrics |
|---|---|---|
| Within a node | High-speed interconnect between accelerators in the same server | Point-to-point bandwidth, topology affinity |
| Between nodes | High-speed network connecting the two servers | Bandwidth, latency, packet loss |
Intra-node bandwidth is typically much higher than inter-node bandwidth. Parallelism should therefore keep communication-intensive partitions within a single node whenever possible. If tensor parallelism generates substantial traffic across nodes, training throughput can drop significantly.
Before launching a job, verify that:
- Every accelerator is healthy.
- The detected topology matches the intended design.
- The clocks on both servers are synchronized.
- Firewall rules allow access to the required training ports.
These checks may seem routine, but overlooking them is a common cause of multi-node training failures.
2. Managing the Software Stack in Layers
Organize the software environment into four layers:
- Drivers and firmware
- Low-level runtime
- Communication libraries
- Deep learning framework and training code
Pin the versions in each layer and keep them consistent across both nodes.
Version mismatches can produce two types of problems. Some prevent startup entirely—for example, a communication library may fail to locate a compatible runtime. Others are harder to diagnose: a job may run but produce small inconsistencies across nodes or hang intermittently.
Create an environment-check script and run it on each node before training:
#!/bin/bash# Run on each node, collect the output, and compare the results.echo "hostname: $(hostname)"echo "kernel: $(uname -r)"echo "python: $(python3 --version 2>&1)"python3 -c "import sys; print('site-packages ok' if sys.prefix else 'missing')"# Use vendor-provided tools to query driver and runtime versions.echo "accelerator driver: <output from vendor query tool>"
Save the output to logs and compare the relevant environment details across the two nodes. Resolve unexpected differences before launching the training job.
3. Choosing and Validating Parallelism
A 16-accelerator setup can combine data parallelism, tensor parallelism, and pipeline parallelism. Their relationship is:
Total accelerators = Data parallel size × Tensor parallel size × Pipeline parallel size
The following is an illustrative configuration, not the actual configuration used in the case study:
- Set tensor parallel size to 8, keeping tensor-parallel communication within each node.
- Set pipeline parallel size to 2, placing one pipeline stage on each node and limiting cross-node traffic to communication between stages.
- Set data parallel size to 1, giving 16 = 1 × 8 × 2.
If the model is smaller and accelerator memory is sufficient, another option is data parallel size 2, tensor parallel size 4, and pipeline parallel size 2. Increasing data parallelism may improve throughput.
The choice depends primarily on three factors:
- Whether each accelerator can hold its share of model parameters and activations
- Whether intra-node and inter-node communication volumes fit the available bandwidth
- Whether pipeline bubble overhead is acceptable
Keep parallelism settings in a separate configuration file so that runs are easy to reproduce and compare:
# Illustrative training configuration.# Field names are specific to this example; use those required by your code.parallel_config = {"world_size": 16,"num_nodes": 2,"gpus_per_node": 8,"data_parallel_size": 1,"tensor_parallel_size": 8,"pipeline_parallel_size": 2,"micro_batch_size": 2,"grad_accumulation_steps": 16,}def check_parallel_config(cfg):dp = cfg["data_parallel_size"]tp = cfg["tensor_parallel_size"]pp = cfg["pipeline_parallel_size"]assert dp * tp * pp == cfg["world_size"], ("The product of parallel sizes must equal the total accelerator count")assert cfg["num_nodes"] * cfg["gpus_per_node"] == cfg["world_size"]return Truecheck_parallel_config(parallel_config)
Running these checks before startup helps catch configuration typos before they become harder-to-diagnose runtime failures.
4. Building the Training Data Pipeline
The data pipeline determines whether accelerators receive enough work to remain busy. Common bottlenecks include slow reads, preprocessing performed serially in the main process, and uneven sample counts across data shards.
Recommended practices include:
- Prepare fixed-size shards in advance. Use a shard count that is a multiple of the data parallel size.
- Tokenize and pack data offline. During training, the pipeline should primarily read prepared data.
- Maintain independent data cursors for data-loading ranks. Derive sample order from a global random seed and the relevant rank to avoid duplicate reads across data-parallel workers.
- Prefetch in the background. Adjust the prefetch queue length based on training step time.
The following pseudocode illustrates rank-based sample assignment. Here, world_size and rank describe the workers that independently consume data:
def build_shard_indices(total_samples, world_size, rank, seed, epoch):# Generate the same global order for each epoch, then select by rank.rng = make_rng(seed + epoch)order = rng.permutation(total_samples)return order[rank::world_size]
This partitioning produces non-overlapping sample subsets within an epoch. With deterministic ordering, the saved training step and epoch can be used to reconstruct the read position when resuming training.
5. Multi-Node Startup and Communication Validation
Distributed startup depends on several key settings: node rank, node count, the primary node address, and the communication port. Both nodes use the same launch structure, with a different node rank.
# Node 0: primary nodeexport NODE_RANK=0export NNODES=2export MASTER_ADDR=<primary-node-private-IP>export MASTER_PORT=29500# Invoke the training entry point using the parallel configuration.# On node 1, change only NODE_RANK to 1.
Before starting training, perform two checks.
Connectivity
Confirm that both nodes can reach the required training ports in both directions.
Collective Communication Bandwidth
Repeatedly run an all-reduce operation on a fixed-size payload. Record execution time and calculate effective bandwidth.
Compare the results with the expected intra-node and inter-node bandwidth, accounting for communication overhead. If inter-node performance is substantially lower than expected, investigate network interface binding, routing, and packet loss before proceeding.
Validating communication first reduces the risk of discovering a network problem hours into a training run.
6. Monitoring the 400-Step Training Run
A sustained training run requires continuous monitoring of the following metrics:
- Loss: Look for an overall downward trend. Short-term fluctuations are normal, but persistent increases or non-finite values require immediate investigation and may warrant stopping the job.
- Gradient norm: A sudden increase can indicate an excessive learning rate or anomalous training samples.
- Step time and throughput: Compare timing across the two nodes. Persistent differences can point to a slow node or a network issue.
- Accelerator memory usage: Leave headroom below peak capacity so that longer sequences do not trigger out-of-memory errors.
- Checkpoints: Save at fixed step intervals and verify that the saved checkpoints can be read successfully.
Simple rules can provide basic health alerts:
def check_step_health(metrics, history):if metrics["loss"] != metrics["loss"]: # Detect NaN.return "stop: loss is NaN"if metrics["grad_norm"] > 10 * history["grad_norm_median"]:return "warn: grad norm spike"if metrics["step_time"] > 1.5 * history["step_time_median"]:return "warn: slow step, check node balance"return "ok"
Treat these thresholds as examples. Establish appropriate values from statistics collected during the first few dozen steps rather than applying fixed thresholds without validation.
7. Common Failures and Troubleshooting
Multi-node training problems generally fall into four categories.
Job Hangs
Logs stop updating, and accelerator utilization may fall to zero. A common cause is a process exiting on one node while processes on the other node continue waiting for communication.
Check process status on every node and inspect communication timeout logs.
Out-of-Memory Errors
These often occur when sequence lengths vary significantly.
Reducing the micro-batch size or enabling activation recomputation can lower memory requirements. When reducing the micro-batch size, increasing gradient accumulation can help maintain the intended effective batch size.
Abnormal Loss
A sudden loss spike can be associated with insufficient learning-rate warmup, unusually long sequences, or problematic samples.
Record the sample identifiers for abnormal steps so that the corresponding data can be reviewed.
Uneven Node Performance
Persistent differences in step time may result from cooling issues, network interface speed, or competing background processes.
Inspect each node individually rather than relying only on aggregate metrics.
For every investigation, preserve the original logs and record configuration changes. This makes recurring problems easier to diagnose through direct comparison.
8. Reusable Lessons
Three practices were central to validating this training workflow.
First, keep the environment, configuration, and data consistent across nodes. Use scripted checks rather than relying solely on manual inspection.
Second, match parallelism to the hardware topology. Keep the most communication-intensive partitioning within a node whenever possible.
Third, define training health checks and checkpoint procedures before the run. Completing 400 consecutive steps provides evidence that startup, communication, data loading, optimization, and checkpoint saving work together over that run.
When scaling beyond two nodes, retain the same validation process, add nodes incrementally, and measure throughput again. Do not assume that the current configuration will remain appropriate at a larger scale.
