Bringing Up Large-Model Training on Domestic GPUs: A Practical Guide
This article walks through the practical work of bringing up an end-to-end large-model training pipeline on domestic accelerators. It explains why a stable 400-step run matters more than peak throughput, how the three bandwidth tiers in a two-node, sixteen-card setup shape parallelization choices, how to split tensor, pipeline, and data parallelism accordingly, and which software-stack checkpoints to verify. It also covers observability, checkpointing, and a four-step path from validation to production.
1. Why a Working Training Pipeline Matters More Than Raw Speed
Adapting large-scale pretraining to domestic accelerators usually goes through three stages: getting single-card operators working, scaling across multiple cards in one node, and achieving end-to-end stability across a multi-node cluster. Many teams make smooth progress in the first two stages but repeatedly fail in the cross-node stage. The cause is often not a lack of compute, but a semantic mismatch somewhere in the pipeline.
A “working training pipeline” means completing the full loop on the target hardware and software stack: data loading, forward computation, backward propagation, gradient synchronization, parameter updates, and checkpoint saving and restoration. It also means keeping the loss curve smooth and free of silent errors over several hundred iterations. What this validates is correctness and reproducibility, not peak throughput.
The choice of 400 steps carries engineering meaning as well. It is enough to expose mid-to-late-stage issues such as learning-rate warmup, gradient clipping, numerical overflow, and communication timeouts, while still completing in hours, which makes it suitable as a regression baseline.
2. Typical Topology and Bottleneck Identification on Two Nodes with Sixteen Cards
A configuration of two nodes with eight cards each is the smallest reproducible unit in current mainstream training clusters. It typically has three tiers of bandwidth difference:
- Intra-node high-speed interconnect: the eight cards within a node are directly connected by high-bandwidth links, with the lowest latency.
- Intra-node memory and host channel: data preprocessing and checkpoint writes pass through here.
- Inter-node network: relatively the lowest bandwidth, and the main constraint on scaling efficiency.
Understanding these three tiers explains a common phenomenon: after scaling parallelism from a single node to two nodes, throughput does not grow linearly. If tensor parallelism is split across the inter-node link, every step must transfer large amounts of activations and gradients, and the communication share quickly overtakes computation. The general principle in practice is therefore to place the most communication-intensive parallelism dimension inside the node and leave the lower-volume dimensions to the inter-node link.
3. The Logic of Splitting Parallelism Strategies
Take mainstream three-dimensional parallelism as an example, where each dimension is assigned by communication characteristics:
| Parallelism Dimension | What Is Split | Communication Characteristics | Suggested Placement |
|---|---|---|---|
| Tensor parallelism | Weight matrices within a single layer | High frequency, large volume per transfer | Intra-node |
| Pipeline parallelism | Sub-networks segmented by layer | Point-to-point, moderate volume | Intra-node or inter-node |
| Data parallelism | Input batches | One gradient reduction per step | Inter-node |
A common combination for sixteen cards is tensor parallelism 2, pipeline parallelism 2, and data parallelism 4, so that the inter-node link only handles gradient reduction and pipeline bubble scheduling. It is important to emphasize that the specific split must account for constraints such as whether the number of model layers is divisible by the number of pipeline stages and whether the number of attention heads is divisible by the tensor parallelism degree. Configurations cannot simply be copied.
An illustrative configuration expression (pseudocode, used only to show the structure):
# Illustrative parallelism configuration, not a specific framework APIparallel = {"tensor_model_parallel_size": 2, # Intra-node high-bandwidth links"pipeline_model_parallel_size": 2,"data_parallel_size": 4, # Inter-node gradient reduction}# Global batch = micro batch * gradient accumulation * data parallelismglobal_batch = micro_batch * grad_accum_steps * parallel["data_parallel_size"]
4. Key Checkpoints for Software Stack Adaptation
The difficulty of adapting to domestic hardware concentrates on the consistency of operator semantics and numerical behavior. It is recommended to confirm the following items one by one:
- Operator coverage and fallback: confirm that high-performance implementations exist for core operators such as attention, normalization, and linear layers; check whether a usable fallback path exists when they are missing, and whether precision stays consistent after falling back.
- Mixed-precision strategy: the forward pass can use lower precision in exchange for throughput, while parameter updates and loss accumulation should retain higher precision, and loss scaling should be applied to suppress gradient underflow.
- Communication library semantics: the averaging method for gradient reduction and support for bucketing and computation-communication overlap directly determine scaling efficiency.
- Random numbers and initialization: random seeds across parallel ranks must be distinguishable and reproducible; otherwise weights get duplicated during initialization, which shows up as abnormally high loss.
- Data pipeline: shard reading must align with the parallel topology to avoid different ranks reading duplicate samples.
A frequent failure is the “silent error”: the program does not report an error, but the loss suddenly rises after a few dozen steps. The recommended troubleshooting order is: fix the random seed to reproduce, print the single-step gradient norm, disable mixed precision for comparison, and shrink to a single node for retesting, narrowing the problem scope layer by layer.
5. Building Stability and Observability
Whether 400 steps complete smoothly depends largely on whether monitoring is in place. It is recommended to collect at least three categories of metrics: single-step time and memory usage on the compute side, reduction time and timeout counts on the communication side, and the loss and gradient norm distribution on the numerical side. Feeding these metrics into a unified logging, monitoring, and alerting system with threshold reminders allows intervention before a failure escalates.
The checkpoint strategy is equally critical. It is recommended to save at fixed step intervals and to keep both model weights and optimizer state; otherwise the learning-rate schedule will be misaligned after restoration. The write process can first write to a temporary directory and then atomically rename, avoiding half-written files caused by interruption. Training jobs can be scheduled through a container platform, with checkpoints archived to object storage, decoupling job reconstruction from data retention.
6. The Path from Validation to Production
A working pipeline is only the starting point. A four-step progression is recommended: first, fix a small-scale configuration to establish a regression baseline; second, gradually scale up the batch size and parallelism while recording the scaling-efficiency curve; third, inject fault drills to verify resume-from-checkpoint and node replacement; fourth, produce configuration templates and environment images so that reproduction does not depend on individual experience.
To reduce the cost of building and operating a cluster, some of these stages can be handled by general cloud capabilities: a container platform handles environment consistency and elastic scheduling, object storage holds the corpus and checkpoints, and logging, monitoring, and alerting services provide full-pipeline observability. Baidu AI Cloud offers corresponding capabilities in these general categories, which can be combined as needed.
Overall, the core methodology for completing large-scale training validation on domestic accelerators is not mysterious: first clarify the bandwidth tiers, then split parallelism accordingly; first ensure numerical correctness, then pursue throughput; first make observability solid, then talk about scaling.
