Getting Large Model Training to Run End-to-End on Domestic AI Accelerators: A Two-Node, 16-Card, 400-Step Practice
This article explains how to validate a complete large model training pipeline on domestic AI accelerator cards, using a two-node, 16-card, 400-step run as the reference scenario. It covers pre-flight environment checks (version matrices, node and network connectivity, deterministic dependency installation), how to choose parallelism across tensor, pipeline, and data dimensions, and the memory and precision settings that keep training stable. It also outlines communication and throughput tuning based on a minimal observability set, checkpoint and fault-tolerance design for continuing beyond 400 steps, and a troubleshooting path for common failures. The goal is a credible, reproducible validation rather than peak throughput.
1. Background: Why Getting the Pipeline Working Matters More Than Raw Speed
In large model engineering, teams often hit a practical wall: the hardware has arrived and the framework is installed, but the training script fails as soon as it starts, or the loss does not drop, throughput is extremely low, or the process silently exits after a few dozen steps. “Getting the training pipeline working” means completing an end-to-end loop on the target hardware and software stack, covering data loading, forward computation, backward propagation, gradient synchronization, optimizer updates, and checkpoint saving, and being able to advance stably for hundreds of steps. This article uses a typical validation scenario, completing 400 steps of training on two nodes with 16 cards, to discuss how to perform a credible and reproducible training validation on a domestic accelerator platform.
The value of pipeline validation is not in pursuing peak throughput but in exposing problems. Four hundred steps is a deliberately chosen scale: it is enough to trigger periodic behavior in the data pipeline, link establishment and reconnection in the communication library, gradual memory fragmentation, and initialization and updates of optimizer states, without consuming too much machine time. If the loss curve is smooth within 400 steps, per-step time variance is under control, and no process exits abnormally, the hardware and software combination can be considered ready to scale up.
2. Environment Preparation: Move Uncertainty Ahead of Startup
Most training failures are not algorithm problems but environment inconsistencies. Three types of checks are recommended before starting.
First, the version matrix of the driver, runtime, and framework. There is a strong coupling among the accelerator driver, compute runtime, communication library, deep learning framework, and operator library. A clear version list should be created and kept identical across all nodes. Version drift between nodes is the most hidden source of failures, typically showing up as some ranks hanging during link establishment.
Second, connectivity pre-checks for nodes and networks. The core of a two-node setup is cross-node bandwidth and topology. Confirm that every card can be enumerated, that inter-card interconnect links are healthy, that the network interface used for parameter synchronization between nodes meets expected bandwidth and latency, and check firewall and port availability.
A sample pre-check script can be organized like this:
# 1) Card enumeration and visibilityfor i in 0 1 2 3; do echo "node$i"; done# 2) Verify device count and driver version per node, output to a unified log# 3) Run cross-node bandwidth and latency baseline tests, record to a baseline file# 4) Check port connectivity to ensure the collective communication init port is available
Third, deterministic installation of software dependencies. Use container images or a unified environment definition file to pin dependencies and avoid the irreproducible “it works on my machine” state. All sources of randomness (data sampling, parameter initialization, dropout) should have seeds set explicitly and recorded in logs, which is a prerequisite for reproduction and problem localization.
3. Parallelism Strategy: How to Split Across Two Nodes and 16 Cards
With multiple cards on a single machine, the high inter-card bandwidth is usually saturated first, and cross-node links only handle necessary gradient synchronization. A common practice is to keep data parallel groups within a node and place tensor or pipeline parallelism on the cross-node dimension, reducing the frequency of cross-node communication. The right combination depends on model structure, per-layer computation, and memory headroom, not a fixed formula.
A practical decision order is: first check whether a single card can hold the model states (parameters, gradients, optimizer states); if not, introduce tensor parallelism to split a single layer; if many layers cause obvious pipeline bubbles, consider pipeline parallelism with gradient accumulation to dilute the bubbles; use data parallelism to scale throughput linearly. Mixture-of-experts structures also require accounting for load imbalance from expert routing and the all-to-all communication overhead.
In configuration, express intent with explicit parameters rather than magic numbers:
# Sample: relationship between parallel dimensions, batch size, and accumulation stepsconfig = dict(tensor_parallel=2, # Split within the node to use high-bandwidth interconnectpipeline_parallel=2, # Split across nodes to reduce per-card memory pressuredata_parallel=4, # Remaining cards used for data parallel throughput scalingmicro_batch=1,grad_accum=8, # global batch = micro_batch * grad_accum * data_parallel)
The global batch size needs to be tuned together with the learning rate and warmup steps. During validation, fix the global batch to a value that is easy to compare, observe the loss descent slope, and then decide whether to scale it up.
4. Memory and Precision: Keys to Keeping 400 Steps Stable
Insufficient memory is a frequent cause of pipeline interruption, and it often only surfaces after a few dozen steps, because optimizer states and memory fragmentation accumulate gradually. Options to try in order include: enabling mixed precision with a reasonable loss scaling configuration; using activation recomputation to trade time for space; using sharded optimizer states to reduce resident memory per card; setting a memory allocation strategy to reduce fragmentation; and enabling offloading when necessary, while being aware that it adds bandwidth pressure.
Mixed precision is not optimal just by turning it on. If the loss becomes NaN or gradients stay constant for a long time, check whether loss scaling is too aggressive, whether there are numerically sensitive normalization layers and accumulation operations, and keep high-precision copies of key statistics. It is recommended to treat the first 400 steps as a “numerical stability observation window,” recording gradient norms and update norms segment by segment, since abnormal trends often signal problems earlier than the final loss.
5. Communication and Throughput Tuning: From Running to Running Steadily
The performance bottleneck in cross-node training is usually communication. Tunable items include gradient bucketing size and fusion strategy (too small buckets make startup overhead dominant, too large buckets lengthen first-byte wait), the degree of overlap between computation and communication, the algorithm and protocol selection for collective communication, and multi-channel utilization on the network side. Tuning should be based on baseline data, changing one variable at a time.
Build a minimal observability set covering five metrics: per-step time, communication wait ratio, data loading wait ratio, peak memory, and gradient norm. If the data loading wait ratio is high, the problem is in the input pipeline rather than computation; if the communication wait ratio is high, check topology and bucketing first instead of blindly adding cards.
step 100 | time 1.42s | comm 18% | io 6% | mem 61GB | gnorm 0.83step 200 | time 1.40s | comm 19% | io 6% | mem 61GB | gnorm 0.79step 400 | time 1.41s | comm 18% | io 7% | mem 61GB | gnorm 0.81
6. Stability and Observability: The Ability to Continue After 400 Steps
Getting 400 steps to run is only the start; whether training can continue to tens of thousands of steps depends on fault-tolerance design. At minimum, you should have: periodic checkpoint saving with metadata recording, ensuring recovery from any interruption with data progress aligned; automatic restart on abnormal exit with centralized log collection; and centralized collection of key metrics with threshold-based alerts. A checkpoint should include the model, optimizer, learning rate scheduler, random states, and data read position; missing any one of them will cause a discontinuous curve after recovery.
7. Common Failures and Troubleshooting Paths
- Fails at startup: usually a version matrix mismatch or blocked ports; check initialization logs before model code.
- Slows down midway: prioritize the input pipeline and memory fragmentation, then check communication topology.
- Abnormal loss: check numerical precision configuration and the match between learning rate and global batch.
- A single straggler: locate the specific node and device, and check hardware health and thermal throttling.
8. Conclusion
Validating a large model training pipeline on domestic AI accelerators is more about methodology than parameters: make the environment deterministic first, derive the parallelism strategy from memory and bandwidth constraints, drive tuning with a minimal set of observability metrics, and use checkpoints and fault-tolerance design to ensure long, stable runs. Baidu AI Cloud can provide engineering support for this kind of validation work through general capabilities such as heterogeneous compute scheduling, containerized training platforms, and monitoring and alerting, helping teams turn one successful 400-step run into a sustainable, iteratively improving training pipeline.
