Practical Guide to Running Large Model Training on Domestic AI Accelerators
This article shares a practical methodology for validating a complete large model training pipeline on domestic AI accelerators using a two-node, sixteen-card setup. It explains why a stable end-to-end run matters more than peak metrics, how to prepare the hardware topology and software stack, how to balance parallelism, memory, and communication, and which mechanisms keep a 400-step run reproducible. It also covers baseline performance observation and a troubleshooting path for common failures.
1. Background: Why a Complete Pipeline Matters More Than Peak Metrics
When running large model training on domestic AI accelerators, the first obstacle a team hits is usually not accuracy or throughput, but whether the pipeline runs end to end. The pipeline here means the full closed loop: data loading, preprocessing, operator execution, gradient synchronization, optimizer updates, and checkpoint saving and restoration. Only when this loop runs continuously for hundreds of steps on a real cluster without breaking do you have the foundation for tuning and scaling.
A two-node, sixteen-card setup is a representative scale. Intra-node interconnect bandwidth is ample, so cross-node communication becomes both the bottleneck and the most common source of failures. At the same time, this scale is large enough to expose most engineering issues around parallel partitioning, memory allocation, and numerical stability, without making trial and error too expensive. This is why a 400-step continuous run is a common acceptance gate in engineering practice.
2. Environment Preparation: Eliminate Uncertainty Up Front
2.1 Confirm Hardware and Topology
Start by documenting the device inventory, the intra-node interconnect method, and the cross-node network bandwidth, and record the topology. Topology determines how you map parallel dimensions later. If a partitioning dimension that requires frequent communication is placed on the cross-node link, performance degrades significantly.
2.2 Align the Software Stack
Driver, runtime, communication library, and framework versions must be strictly identical across all nodes. In practice, pin the environment with a version manifest plus checksums. This avoids silent drift on individual nodes, which otherwise leads to intermittent errors that are hard to reproduce.
2.3 Minimal Runnable Validation
Before launching full training, run three progressive layers of validation:
L1 Single-card operator self-check: numerical alignment of basic operators such as matmul, reduction, and normalizationL2 Single-node multi-card communication self-check: connectivity and bandwidth baseline for all-reduce/broadcastL3 Two-node cross-node self-check: correctness and stability of cross-node collective communication
Only after all three layers pass should you move to model-level training. This keeps the problem domain as small as possible.
3. Parallel Strategy: Rebalancing Memory and Communication
A two-node, sixteen-card setup typically combines data parallelism with intra-model partitioning. Data parallelism scales the global batch size, while intra-model partitioning (tensor partitioning, pipeline partitioning) distributes the parameters and activations of a single layer across cards. Three design points matter:
- Communication tiering: Keep high-frequency, fine-grained partitioning communication inside a single node, and put low-frequency, coarse-grained synchronization on the cross-node link.
- Memory budget: Build a budget table covering five items: parameters, gradients, optimizer states, activations, and temporary buffers. Leave headroom for fragmentation so training does not exit mid-run due to an allocation failure.
- Batch size and learning rate coordination: When the global batch grows with card count, adjust the learning rate and warmup steps accordingly. Otherwise you will not observe a stable downward trend within 400 steps.
4. Stability Design: Making 400 Steps Continuously Reproducible
Continuous training failures are usually caused by engineering details rather than the algorithm. Recommended mechanisms:
- Determinism switches: Fix random seeds and disable non-deterministic operator paths so issues are reproducible.
- Gradient clipping and numerical checks: Check the gradient norm and whether the loss is non-finite at every step. On anomaly, abort immediately and preserve the state.
- Checkpoint strategy: Save at fixed step intervals. The saved content must cover the model, optimizer, learning rate schedule, and data loading position, so training can resume from any step.
- Layered logging and metrics: Collect training metrics, communication metrics, and hardware metrics separately, and aggregate them through a general logging service and monitoring/alerting capability so information is not missing during a failure.
Illustrative monitoring logic:
for step, batch in enumerate(loader, start=1):loss = model.train_step(batch)if not is_finite(loss):log.error("non-finite loss at step %d", step)save_checkpoint(step, reason="abnormal")breakif step % save_interval == 0:save_checkpoint(step)if step >= total_steps:break
5. Performance Observation: From “It Runs” to “It Runs Reasonably”
Once the pipeline runs, establish a baseline instead of chasing peak numbers blindly. Track three categories of metrics: per-step time and its variance, cross-node communication share, and peak memory plus fragmentation. If per-step time variance is high, first check whether data loading and preprocessing are the bottleneck. If the communication share is too high, adjust the partitioning mapping or the gradient accumulation strategy. A 400-step run is long enough to produce a trustworthy mean, which can serve as a reference baseline for later scale-out.
6. Common Issues and a Troubleshooting Path
- Fails immediately at startup: Usually environment inconsistency or device visibility configuration. Go back to the L1/L2 self-checks.
- Interrupted after tens of steps: Check the memory growth curve and anomalous data samples first.
- Loss spikes: Check the learning rate, warmup length, and normalization implementation.
- Sudden throughput drop: Look for a slow node, link jitter, or contention on checkpoint writes.
7. Conclusion
Completing a two-node, sixteen-card, 400-step continuous run on domestic AI accelerators is essentially about progressively converging the “uncontrollable” into the “controllable”: a controllable environment, controllable communication, controllable memory, and controllable anomalies. Once this methodology settles into a repeatable process, further scaling of model size rests on a solid foundation. For teams planning to run training workloads on domestic compute platforms, generic capabilities such as the container platform, object storage, and monitoring/alerting offered by Baidu AI Cloud can be combined to build a standardized training and operations loop.
