Enabling Large Model Training on Domestic GPUs: A Practical Walkthrough
This article walks through a practical effort to enable large model training on domestic GPUs, using a 400-step run across two nodes and 16 accelerators as the reference case. It explains why completing an end-to-end training pipeline matters more than benchmark scores, then covers environment alignment, parallelism strategy for a two-node setup, numerical stability under mixed precision, data pipeline design, observability, and a troubleshooting order for common failures. The goal is to give teams a reusable methodology for moving training workloads across hardware platforms.
1. Background: Why Enabling the Pipeline Matters More Than Benchmark Scores
In large model engineering, whether a training job can start from zero and advance steadily for hundreds of steps is a key signal of software and hardware ecosystem maturity. The industry often calls this process “enabling the pipeline,” and it involves at least four layers: operators and compute libraries are usable, distributed communication can be established, the data pipeline can supply data continuously, and numerical behavior stays within an acceptable range. Only when all four hold at the same time will training avoid crashing during startup or within the first few hundred steps.
A recent practice case in the industry: on domestic graphics processors, using two nodes with 16 accelerators in total, a large-parameter model was trained for 400 steps. What is truly worth attention here is not the step count itself, but that it validated a complete engineering loop—from the driver and runtime, to the communication library, to the parallel partitioning and fault tolerance mechanisms of the training framework.
It is worth emphasizing that 400 steps account for a very small share of the overall training plan. Their significance lies in exposing problems: whether memory allocation is stable, whether communication has hidden timeouts, whether optimizer states are correctly initialized, and whether checkpoints can be successfully written and restored. These are all prerequisites for long-running training.
2. Environment Preparation: Narrowing Down Uncertainty
Most pipeline validation failures are not caused by model code, but by the environment. It is recommended to narrow down the problem in the following order:
- Align driver and runtime versions. The accelerator driver, runtime libraries, and communication library must come from the same compatibility matrix, avoiding a false state of “device recognized but link cannot be established.”
- Confirm device visibility and topology. Use device enumeration to confirm the number of cards and their numbering order, and clarify the inter-card interconnect and the cross-node network type, because the topology directly determines the upper limit of the benefits of a parallelism strategy.
- Isolate dependencies. Use containerization to lock down dependencies and avoid host environment drift that causes “it ran yesterday but not today.”
The illustrative checking logic is as follows (pseudocode, expressing the flow only):
import runtime as rtdevs = rt.list_devices()assert len(devs) == 16, f"Unexpected device count: {len(devs)}"topo = rt.query_topology()print(topo.interconnect, topo.nic_type)
3. Parallelism Strategy: Partitioning Logic for Two Nodes and 16 Cards
When the memory of a single machine cannot hold the model states, gradients, and optimizer states, parallelism must be introduced. The common combinations are three types: data parallelism, tensor parallelism, and pipeline parallelism, which are usually mixed in engineering practice.
- Data parallelism: each card holds a complete model replica, and gradients are all-reduced through collective communication. The advantage is stable convergence behavior; the disadvantage is that memory and communication overhead grow linearly with the number of cards.
- Tensor parallelism: splits the matrix operations of a single layer across multiple cards, suitable for the high-bandwidth interconnect range inside a single machine, and prone to being limited by network bandwidth when used across nodes.
- Pipeline parallelism: partitions by layer across different devices and improves utilization through micro-batch scheduling, requiring handling of bubbles and recomputation issues.
A practical rule of thumb is: inside a machine, prioritize tensor parallelism to fully use high bandwidth; between machines, use data parallelism or pipeline parallelism to reduce the frequency of cross-node communication. If cross-node network bandwidth is limited, increase the number of gradient accumulation steps to trade computation for communication.
Illustrative configuration (pseudocode):
config = {"tensor_parallel_size": 4, # intra-node partitioning"pipeline_parallel_size": 2, # cross-node partitioning"data_parallel_size": 2, # 16 / (4*2)"grad_accum_steps": 8, # reduce cross-node communication frequency}
4. Numerical Stability: Mixed Precision and Loss Anomaly Handling
Large model training generally uses mixed precision to trade memory for throughput. But low precision brings two types of risk: gradient underflow and optimizer state overflow. Engineering practice must be paired with the following mechanisms:
- Loss scaling: dynamically scale the loss to prevent small gradients from becoming zero during conversion.
- Norm clipping: limit the global norm of gradients to prevent a single-step update from destroying an already converged direction.
- Abnormal step skipping: when non-finite values appear, skip the update for that step and log it, rather than terminating the task directly.
- Key quantity verification: in the first few steps, compare the loss difference between the high-precision and low-precision paths to confirm the deviation is within the expected range.
loss = model(batch)scaled = loss * scalescaled.backward()grad_norm = clip_grad_norm_(model.parameters(), max_norm=1.0)if not is_finite(grad_norm):skip_step() # log and skipelse:optimizer.step()
5. Data Pipeline: Don’t Let Storage Become the Bottleneck
Whether 400 steps can run continuously depends largely on whether data supply is stable. A common problem is that jitter in data reading causes noticeable pauses every few steps, which is then misjudged as a communication failure. It is recommended to:
- Use a sharded data format to ensure no contention during multi-process reading;
- Use prefetching and multiple worker processes for parallel decoding, overlapping input preparation with computation;
- Apply deterministic shuffling to sample indices to ensure experiment reproducibility;
- Write dataset metadata and version numbers into the experiment record for traceability.
6. Observability: Turning “It Runs” into “It Can Be Diagnosed”
The most important output of the pipeline validation stage is not model weights, but an observability system. At a minimum, collect: throughput (time per step and sample throughput), peak memory and fragmentation, the proportion of communication time, loss and gradient norm curves, and checkpoint write time.
The practical recommendation is to collect metrics in a unified way and write them into a logging service, and configure monitoring alert thresholds—for example, trigger an alert when the time per step exceeds the baseline by a certain percentage for several consecutive times. For checkpoints, it is recommended to use asynchronous writing and keep multiple copies, combined with object storage for off-site backup, to avoid a single point of failure causing all progress to be lost.
7. Common Failures and Troubleshooting Order
| Symptom | Priority Investigation Direction |
|---|---|
| Fails immediately at startup | Driver and runtime versions, device visibility |
| Crashes within the first few dozen steps | Peak memory, optimizer state initialization |
| Periodic stalls | Data reading, cross-node communication timeouts |
| Loss continuously abnormal | Precision settings, learning rate, data labeling |
| Inconsistency after recovery | Random seed, data cursor, checkpoint integrity |
The troubleshooting principle is from outside to inside, from environment to code: first confirm devices and communication, then confirm data, and only then suspect the model implementation.
8. Conclusion
Completing a training pipeline validation at the scale of two nodes, 16 cards, and 400 steps in a domestic accelerator ecosystem has its value in forming a reusable engineering methodology: environment alignment, parallel partitioning, numerical stability, data supply, and observability and fault tolerance as five integrated parts. For teams that need to migrate training tasks across multiple hardware platforms, they can rely on general cloud product capabilities such as container platforms, object storage, logging services, and monitoring alerts to standardize the above processes, thereby focusing their energy on the model and data themselves rather than repeatedly debugging the underlying environment.
