Practical Guide to Training Large Models on Domestic GPUs: A 400-Step MoE Run on 16 Cards Across 2 Nodes
This article explains why validating a complete training pipeline matters more than peak performance when bringing up large models on domestic GPU hardware. Based on a 400-step training run of a large-scale Mixture-of-Experts (MoE) model on 16 accelerators across two nodes, it covers hardware and topology constraints, combining data, tensor, pipeline, and expert parallelism, managing memory and compute trade-offs, ensuring numerical stability, and building fault tolerance, checkpointing, and observability. Readers will find practical configuration examples, troubleshooting steps, evaluation metrics, and a deployment checklist for a reproducible "align first, scale later" workflow.
1. Background: Why a Working Pipeline Matters More Than Raw Speed
In large-model engineering, getting a complete training pipeline working end to end usually delivers more value than any single-point performance metric. “Working” means that data loading, computation graph construction, parallel partitioning, backpropagation, parameter updates, and checkpoint saving and restoration can run continuously and stably for hundreds of iterations on real hardware without interruption. Only after the pipeline is closed-loop does it make sense to discuss performance tuning, cost optimization, and scaling.
The event described in the source material is a domestic accelerator platform completing 400 training iterations of a very large Mixture-of-Experts (MoE) model at a scale of 16 cards across two nodes. It is worth emphasizing that 400 steps is not final convergence; it is a “stability window” in the engineering sense. It is enough to expose most adaptation issues, such as operator precision deviations, communication timeouts, accumulating memory fragmentation, and optimizer state anomalies.
2. Hardware and Topology: Typical Constraints of 16 Cards Across 2 Nodes
A common 16-card, two-node setup has eight accelerators per server, with high-bandwidth interconnects inside each node and a high-speed network between nodes. This topology creates two natural constraints:
- Intra-node bandwidth is far higher than inter-node bandwidth, so the parallel strategy should keep high-frequency communication inside a node.
- The inter-node link is the bottleneck for global synchronization, making the choice of collective communication algorithms and topology awareness especially important.
In domestic hardware adaptation scenarios, you also need to pay extra attention to driver and runtime versions, the topology recognition capability of the collective communication library, and the coverage completeness of the operator library. A common practice is to first build a “minimum reproducible pipeline” with a small model, then gradually scale up the parameter count and parallelism.
3. Parallelism Strategy: Combining Data, Tensor, Pipeline, and Expert Parallelism
For a trillion-parameter-scale MoE model, no single parallelism method can satisfy both memory and communication constraints at the same time, so a combination is usually required:
- Data parallelism: replicate the model and partition the data, requiring gradient or parameter synchronization.
- Tensor parallelism: partition the matrix multiplications within a single layer; communication is frequent, so it is best kept inside a node.
- Pipeline parallelism: partition by layers across devices, introducing bubble overhead.
- Expert parallelism: distribute different experts across devices, introducing dynamic routing communication.
A transferable rule of thumb is: keep tensor parallelism no greater than the number of cards in a single node, set pipeline parallelism according to the number of nodes, and expand expert parallelism and data parallelism over the remaining dimensions. An illustrative configuration is shown below (for structural explanation only, not specific product parameters):
# Illustrative parallelism configurationparallel_config = {"tensor_parallel_size": 8, # no more than the cards in a single node"pipeline_parallel_size": 2, # aligned with the number of nodes"expert_parallel_size": 4,"data_parallel_size": 4, # derived from the total number of cards}
4. Memory and Compute: The Core Tension in MoE Training
The memory pressure of the MoE architecture comes mainly from three parts: the attention and shared layers before routing, the large number of expert parameters, and optimizer states. In mixed-precision training, optimizer states are often the largest memory consumer. Common mitigation approaches include:
- Sharding optimizer states across the data-parallel group;
- Activation recomputation, trading compute for memory;
- On-demand loading of expert parameters and unified memory management to reduce fragmentation;
- Gradient accumulation to maintain a larger effective batch size under limited memory.
It is worth noting that recomputation is not always better when done more. It directly increases the repeated forward computation, and in scenarios where compute is already tight, it can instead slow down overall throughput. The trade-off point should be determined through actual measurements.
5. Numerical Stability: The Easiest Pitfalls During Adaptation
During domestic hardware adaptation, the problem is often not “cannot compute” but “computes incorrectly.” Typical symptoms include the loss suddenly becoming non-numeric, extremely skewed expert routing load, and periodic fluctuations in gradient norm. A recommended troubleshooting path is as follows:
- First perform numerical alignment on a single card and a single layer, comparing operator by operator against the reference implementation.
- Fix the random seed and reproduce the anomaly at a reduced model scale.
- Check the scaling strategy of mixed precision and the implementation of normalization layers.
- Observe the routing load distribution, and introduce an auxiliary load-balancing loss if necessary.
- Use gradient clipping and learning-rate warmup to reduce early-stage oscillation.
# General pattern for training stability protectionfor step, batch in enumerate(loader):loss = model(batch)loss.backward()grad_norm = clip_grad_norm_(model.parameters(), max_norm=1.0)optimizer.step()optimizer.zero_grad()if not is_finite(loss):skip_step_and_log(step, loss, grad_norm)
6. Fault Tolerance, Checkpoints, and Observability
Completing 400 consecutive iterations smoothly is usually backed by a complete set of engineering safeguards:
- Periodic checkpoints covering model weights, optimizer states, and the data-reading position;
- Resume-from-checkpoint validation to ensure the loss curve is continuous after recovery;
- Layered logging and metric collection that aggregate compute, communication, and storage metrics;
- Automatic restart on anomalies and faulty-card isolation to reduce manual intervention;
- On the resource side, you can rely on a container platform for scheduling, object storage for saving checkpoints, and monitoring and alerting services for tracking metrics.
7. The Right Way to Evaluate Performance
To assess pipeline health, you cannot look only at single-step latency. A more complete set of metrics should include average per-step time and variance, effective throughput (accounting for recomputation and gradient accumulation), communication proportion, peak memory and fragmentation rate, and performance decay under long stable runs. Only by observing variance and decay over hundreds of steps can you determine whether the pipeline is truly usable.
8. Deployment Checklist
- Build the minimum pipeline first, then scale up gradually.
- Align the parallel strategy with the hardware topology to reduce high-frequency cross-node communication.
- Establish an operator-level numerical alignment process and turn it into regression test cases.
- Make checkpoints and resume-from-checkpoint a hard requirement for pipeline acceptance.
- Replace manual log digging with a unified observability system.
- Freeze environment dependencies in a containerized environment to ensure reproducibility.
In summary, the significance of completing 400 iterations on 16 cards across two nodes lies in validating a complete path from hardware adaptation to engineering safeguards. For development teams, the truly reusable asset is not the result of a single run, but this methodology of “align first, scale later, stay observable, and stay recoverable.”
