Bridging the Gap: Practical Guide to Large Model Pre-training on Domestic GPU Accelerators
This article examines the engineering practice of validating a pre-training pipeline for a large-scale Mixture-of-Experts (MoE) model on domestic GPU accelerators. It explains why a 400-step smoke test on a small cluster is used to verify pipeline integrity, and covers environment alignment, multi-dimensional parallelism configuration, observability design, and common troubleshooting patterns. Developers will find a practical methodology for minimal validation, metric monitoring, fault localization, and performance baseline extrapolation when adapting non-mainstream hardware ecosystems.
1. Background and a Neutral Framing of the Progress
A noteworthy engineering milestone has recently emerged in the industry: a vendor of domestic accelerator cards completed the adaptation and validation of a pre-training pipeline for an ultra-large Mixture-of-Experts (MoE) large language model. On a small-scale cluster of two nodes with sixteen cards in total, the pipeline ran stably for four hundred iterations. Rather than focusing on specific hardware models, model versions, or vendor names, it is more useful to abstract this into a universal engineering question: how to get a pre-training pipeline for an ultra-large model truly running on domestic acceleration hardware from a non-mainstream ecosystem, and produce usable convergence curves and throughput data.
It is important to emphasize that “running four hundred steps” does not mean “training is complete.” In ultra-large-scale pre-training, four hundred steps is a typical smoke test magnitude. Its value lies in verifying pipeline integrity, not in producing model weights. Pipeline integrity includes at least the following layers:
- Distributed initialization succeeds, and all ranks complete communication domain construction;
- The data pipeline is not a bottleneck, and input tensor shapes, masks, and positional encodings are aligned at every step;
- Mixed precision and gradient scaling do not overflow, and the loss does not produce NaN/Inf;
- There are no dimension conflicts among parallel splitting strategies (data parallelism, tensor parallelism, pipeline parallelism, expert parallelism);
- Checkpoints can be saved and restored normally, and the loss curve remains continuous after restoration;
- The monitoring and logging pipeline is observable, and anomalies can be traced to a specific rank and a specific operator.
Only when all six items hold simultaneously can we say the “pipeline is running.” This is also why such validations usually choose a small-scale cluster instead of going directly to a large cluster—exposing problems with the minimum viable topology first has the lowest cost and the fastest localization.
2. Why Small-Scale Validation Is a Necessary Step
When adapting to new hardware, many teams prefer to apply for a large cluster and attempt everything in one go, which is not cost-effective from an engineering perspective. There are three reasons.
First, the failure surface grows super-linearly with the number of cards. With sixteen cards, the communication domain is simple, and there are limited alternative combinations when problems arise. Once scaled to hundreds of cards, the topology, timeouts, and retry strategies of collective communication introduce new uncertainties. If the pipeline itself has bugs at this point, troubleshooting costs multiply.
Second, convergence validation requires a short feedback loop. Four hundred steps are enough to observe whether the loss decreases monotonically, whether the gradient norm is stable, and whether the learning rate warmup is normal. If the loss diverges within four hundred steps, it indicates a problem with the optimizer configuration or precision strategy, and there is no need to waste more resources.
Third, a performance baseline needs to be established at this stage. By measuring single-card compute utilization, communication ratio, and peak memory on a small cluster, one can extrapolate the scaling efficiency of a large cluster and judge whether the parallel strategy needs adjustment.
3. Environment Preparation and Dependency Alignment
The first step of adaptation work is always environment consistency. It is recommended to lock dependencies into a reproducible image or environment description file, as shown in the example below:
# Environment lock illustration (not specific product commands)base_image: <domestic accelerator base runtime image>framework: <deep learning framework, must match the vendor-adapted version>key_deps:- collective communication library (vendor-adapted version)- mixed precision and operator library- tensor parallel/pipeline parallel extension package
The key principle is: the framework version, collective communication library version, and driver version must all come from the same adaptation matrix. Mixing versions from different sources is the most common pitfall during adaptation. Typical symptoms are random hangs during initialization or missing operator symbols.
4. Key Points of Parallel Strategy Configuration
For ultra-large models with MoE architecture, the parallel strategy is usually a multi-dimensional combination. A reference configuration skeleton is as follows:
# Parallel strategy illustrationparallel_config = {"tensor_parallel_size": 2, # Tensor parallelism, splits single-layer weights"pipeline_parallel_size": 2, # Pipeline parallelism, splits layers"expert_parallel_size": 4, # Expert parallelism, splits experts"data_parallel_size": 1, # Data parallelism, remaining dimension}# Constraint: tp * pp * ep * dp == total number of cards (here 2*2*4*1 = 16)
Three hard constraints must be noted during configuration:
- The product equals the total number of cards, otherwise initialization fails directly;
- The expert parallelism degree must divide the total number of experts, otherwise routing will suffer load imbalance or even out-of-bounds access;
- The number of micro-batches in pipeline parallelism must be greater than the number of pipeline stages, otherwise the bubble ratio is too high and throughput drops significantly.
In a two-node scenario, one must also consider the reality that inter-node communication bandwidth is lower than intra-node interconnect. A common practice is to constrain the most communication-intensive dimension (usually tensor parallelism) within the node as much as possible, and place the relatively sparse communication dimensions (data parallelism and part of expert parallelism communication) on inter-node links.
5. Stability and Observability Design
Whether four hundred steps can run smoothly depends largely on observability. It is recommended to cover at least the following metrics:
- Loss and gradient norm: record by step and observe for spikes;
- Single-step time breakdown: proportion of computation, communication, and data loading;
- Peak memory and fragmentation rate: determine whether it is close to the overflow boundary;
- Heartbeat of each rank and collective communication timeout: locate slow nodes;
- Checkpoint saving time: avoid saving blocking the main training loop.
Illustrative monitoring instrumentation can be written as:
if step % log_interval == 0:log_metrics({"step": step,"loss": float(loss.detach()),"grad_norm": float(grad_norm),"step_time_ms": step_time,"peak_mem_gb": peak_memory(),"comm_ratio": comm_time / step_time,})
When a loss spike occurs, the recommended troubleshooting order is: whether the data sample is abnormal → whether the learning rate is too large → whether mixed precision overflows → whether there is hardware throttling or link jitter on a specific rank. Rule out data first, then configuration, and suspect hardware last. This order can significantly shorten localization time.
6. Common Failures and Localization Approaches
| Symptom | High-Probability Cause | Handling Direction |
|---|---|---|
| Initialization hangs | Communication domain not aligned, port unreachable | Check rank mapping and network connectivity |
| Loss is NaN | Mixed precision overflow, abnormal samples | Adjust scaling strategy, filter data |
| Throughput drops sharply | Slow nodes, inter-node bandwidth bottleneck | Adjust parallel mapping, isolate slow cards |
| Loss jumps after restoration | Optimizer state not fully saved | Verify checkpoint integrity |
| Excessive pipeline bubbles | Insufficient micro-batches | Increase gradient accumulation steps |
7. Practical Recommendations for Developers
First, define “running” as a quantifiable acceptance checklist, not a vague “no errors.” Second, insist on minimum topology first, exposing problems at small scale. Third, put environment, configuration, and data versions all under version control to ensure reproducibility. Fourth, performance data must be annotated with test conditions; talking about throughput without topology and parallel configuration is meaningless. Fifth, on domestic hardware ecosystems, prioritize vendor-provided adaptation matrices and base images to reduce uncertainty from self-compilation.
For teams needing elastic resources, they can also leverage general capabilities such as the container platform, object storage, logging service, and monitoring alerts provided by Baidu AI Cloud to build a closed loop of “training task orchestration + checkpoint persistence + metric visualization,” thereby reducing the engineering burden in the pipeline validation phase.
8. Conclusion
Getting an ultra-large model pre-training pipeline running on domestic acceleration hardware is essentially a complete exercise in ecosystem adaptation engineering: it tests not single-point compute power, but the collaborative maturity of drivers, communication libraries, frameworks, parallel strategies, and observability systems. The significance of four hundred steps is to provide a credible “pipeline is usable” signal, offering a baseline for subsequent expansion to large clusters and long-cycle training. For developers, mastering this methodology of “minimal validation—metric observation—fault localization—baseline extrapolation” is more valuable in the long term than remembering a specific result.
