Getting a Large Language Model Training Pipeline Running End-to-End on Domestic AI Accelerators
This article walks through an engineering practice that completed 400 training iterations of a large parameter language model on 16 domestic accelerator cards across two nodes. It explains why end-to-end pipeline validation matters, how to prepare and self-check the environment in layers, how to choose a parallel strategy at this scale, how to handle mixed precision and numerical stability, and what monitoring and troubleshooting practices production training requires. Readers will find a reusable checklist of common pitfalls and four core engineering capabilities for migrating larger, longer training jobs onto a domestic hardware and software stack.
1. Background and Why It Matters
A recent engineering effort reported running the training pipeline of a large parameter language model on 16 domestic accelerator cards across two nodes, completing 400 iterations stably. The significance is not the model quality produced by 400 steps, but a clear engineering milestone: the training job can start end-to-end, keep iterating, and exit normally on this hardware and software stack, instead of crashing midway due to missing operators, communication timeouts, or out-of-memory errors.
From an engineering perspective, a short end-to-end training run usually answers four questions:
- Are the hardware and drivers usable, and is the compute correctly detected?
- Can the deep learning framework and acceleration libraries correctly invoke the underlying operators?
- Is collective communication across multiple nodes and cards stable, and is the topology reasonable?
- Is the training script reproducible in details such as mixed precision, gradient accumulation, and checkpoint saving?
Only when all four answers are “yes” can you say the pipeline is running end-to-end. The value of such a practice is therefore closer to a compatibility baseline test, providing a credible starting point for longer and larger training runs.
2. Environment Preparation: Resolve Uncertainty Up Front
The first principle of a localized training environment is “align versions before discussing performance.” Lock down an explicit software list before you start, and bake it into a container image to avoid environment drift across machines:
- OS and kernel versions;
- Accelerator driver and companion runtime library versions;
- Deep learning framework version and its corresponding acceleration backend plugin;
- Collective communication library version and network plugin version;
- Compiler, math libraries, codec, and compression dependencies.
A sample environment self-check script can look like this. The goal is to surface problems before the actual training run:
# 1. Confirm device visibility and countlist_devices_tool --list# 2. Basic multi-card connectivity check on a single noderun_allreduce_bench --num-gpus 8 --size 1G# 3. Cross-node network and port connectivitycheck_port --host node-a --port 29500check_port --host node-b --port 29500
The key here is not the specific commands but the idea of layered self-checks: narrow down the problem domain layer by layer across the device layer, the single-node communication layer, and the cross-node network layer. Many “training won’t start” failures are actually located by the third step.
3. Parallel Strategy: How to Split 16 Cards Across Two Nodes
At the scale of 16 cards across two nodes, the common parallel combination is “data parallelism plus optional model/tensor or pipeline parallelism.” The choice is driven mainly by two constraints: single-card memory capacity and cross-node bandwidth.
- If a single card’s memory can hold the model parameters, gradients, and optimizer states, prefer pure data parallelism, which has a simple communication pattern and the best scaling efficiency;
- If memory is tight, introduce tensor or pipeline parallelism to split a single layer or a block of layers across cards, at the cost of more frequent communication and greater sensitivity to cross-node bandwidth;
- If you shard optimizer states (e.g., ZeRO-style strategies), you can significantly reduce per-card memory pressure, but need more frequent gradient and state exchanges.
A typical launch configuration might look like this (parameters are illustrative and should be adjusted to the actual environment):
config = dict(global_batch_size=256,micro_batch_size=2,gradient_accumulation_steps=8, # 256 / (2 * 16) = 8parallel=dict(dp=16, tp=1, pp=1),precision="bf16",checkpoint_interval=50,)
Note that the identity global_batch_size = micro_batch_size × number of cards × accumulation steps must be self-consistent; otherwise you get the subtle problem of “normal throughput but abnormal convergence.”
4. Mixed Precision and Numerical Stability
Mixed precision is the most error-prone part of a localized pipeline. BF16 has a larger dynamic range than FP16 and is usually less prone to overflow, making it a safer default; however, on some operators, insufficient accumulation precision can still occur. Three lessons from practice:
- Preserve reduction precision: use FP32 for critical accumulation of gradients and optimizer states to avoid amplified error over long sequences;
- Watch loss scaling: if using FP16, pair it with dynamic loss scaling and monitor whether the scaling factor backs off frequently;
- Align operator semantics: different backends may differ in implementation details for LayerNorm, Softmax, and attention operators, so during short validation runs, compare whether the loss curves over the first few dozen steps are in the same range.
5. Stability, Monitoring, and Fault Localization
Completing 400 steps smoothly shows the pipeline has basic robustness, but production training also needs a complete observability system. Cover at least the following metrics:
- Throughput: time per step, sample throughput, communication share;
- Memory: peak memory, fragmentation rate, cache growth trend;
- Communication: collective communication latency distribution, slow-node identification;
- Numerical: loss curve, gradient norm, parameter update magnitude;
- System: temperature, power, throttling events.
Logs and metrics should be collected uniformly into a logging service and a monitoring/alerting system, with threshold alerts set for signals such as “gradient norm spikes” and “single-card throughput significantly below the average.” Checkpoints should be saved asynchronously with multiple historical versions retained, to avoid losing a whole training run due to a single-point write failure.
6. Common Pitfalls Checklist
- Environment variables not consistent across nodes, causing rank mapping errors and jobs stuck at initialization;
- Wrong network interface selected, so communication goes over a low-speed link, showing up as “it runs but is extremely slow”;
- Data loading becomes the bottleneck, with GPU utilization staying low for long periods;
- Random seeds not fixed, so loss curves from two experiments are not comparable;
- Optimizer state missing during checkpoint save and restore, causing an obvious loss jump after resuming training.
7. Conclusion
The significance of “400 steps on 16 cards across two nodes” is moving localized training from “can it start” to “can it repeat stably.” For developers, the truly reusable output is not the result of a single run, but four engineering capabilities: layered self-check methods, parallel splitting principles, numerical stability strategies, and an observability system. When these capabilities settle into standardized processes, and combined with common cloud infrastructure such as container platforms, object storage, logging services, and monitoring/alerting, migrating to larger-scale, longer-cycle training gains a reliable engineering foundation.
