Engineering Practice: Running Large Model Training Pipelines on Domestic AI Accelerators
This article explores the engineering methodology behind validating end-to-end large model training pipelines on domestic GPU platforms. Using a representative practice—running a mixture-of-experts model with hundreds of billions of parameters across two servers with 16 accelerators for 400 consecutive training steps—it breaks down the key challenges in framework adaptation, operator coverage, memory planning, multi-node communication, and fault recovery. The discussion includes the rationale for choosing a minimal cluster, the critical steps to achieve stable training, and a pragmatic roadmap for scaling from validation to production. It concludes with a reusable evaluation framework based on numerical correctness, throughput, resource utilization, and reproducibility.
1. Background: Why “Running the Training Pipeline” Matters
The barrier to large model training has never been merely “having GPUs.” It lies in whether the entire training pipeline—data loading and preprocessing, model initialization, forward and backward computation, gradient communication and synchronization, optimizer updates, checkpoint saving and restoration, and logging/monitoring—can operate completely, stably, and efficiently on the target hardware. Any compatibility gap or performance bottleneck in any stage can interrupt training, cause abnormal results, or severely degrade throughput.
A recent representative practice: on a domestic GPU platform, end-to-end training of a mixture-of-experts model with tens to hundreds of billions of parameters was validated. A stable 400 training steps were completed on a cluster of two servers with 16 accelerators. The significance lies not in the step count itself, but in proving that the complete loop—from framework adaptation and operator support to multi-node communication—is feasible. This article uses this example as a starting point to distill a general methodology for such validation efforts.
2. Two Servers, 16 Cards: A Minimal Viable Training Cluster
Why “two servers, 16 cards”? From an engineering perspective, this is the minimal viable scale to validate a large model training pipeline:
- A single server cannot validate multi-node communication. Single-server, multi-card setups only cover high-speed inter-card interconnects. The key challenges in large model training lie in cross-node network communication—gradient AllReduce, expert parallelism AllToAll, etc. Two servers are the smallest configuration to exercise the cross-node communication stack.
- 16 cards are sufficient to validate mainstream parallel strategies. With 16 cards, one can combine data parallelism (DP), tensor parallelism (TP), pipeline parallelism (PP), and expert parallelism (EP) in various partitioning schemes. This exposes most issues in sharding logic, weight partitioning, and communication group design.
- Cost is manageable, and iteration is fast. Compared to production clusters with hundreds of cards, a small cluster enables rapid problem isolation and repeated validation. It is the most economical choice for the pipeline adaptation stage.
A common parallel configuration plan: within a single server, use tensor parallelism to exploit high-bandwidth interconnects; across servers, use data or pipeline parallelism to reduce pressure on network bandwidth. For example, TP=8, DP=2, or TP=4, PP=2, DP=2, depending on model depth, memory capacity, and network conditions.
3. Four Key Stages to Getting the Training Pipeline Working
3.1 Framework and Operator Adaptation
Large model training frameworks rely heavily on the underlying operator libraries. When running on domestic accelerators, the first step is to confirm operator coverage: do high-performance implementations exist for matrix multiplication, attention computation, normalization, activation functions, embedding lookups, etc.? For mixture-of-experts models, the efficiency of routing and expert aggregation operators is also critical. A common practice is to first verify numerical correctness with single-operator unit tests, then validate gradient propagation with small subgraphs, and finally proceed to full-network training.
3.2 Memory Planning and Optimization
Even model fine-tuning at the tens-of-billions scale creates significant memory pressure. Common techniques include:
- Mixed-precision training: Storing intermediate results in BF16/FP16 with FP32 master weights for convergence stability.
- Optimizer state sharding: Partitioning optimizer states along the data-parallel dimension to reduce per-card usage.
- Activation recomputation: Trading extra computation for memory, reducing activation storage from linear to sub-linear.
- Gradient accumulation: When per-step batch size is limited, accumulating gradients over multiple micro-steps to effectively enlarge the global batch.
The goal of memory planning is not to “save to the extreme,” but to find a balance between throughput and stability. Overly aggressive memory-saving strategies can introduce numerical risks or slow down training.
3.3 Multi-Node Communication Tuning
Cross-node communication is the lifeline of multi-node training. Key validation points include: correct initialization and grouping of communication libraries on the target hardware; whether the bandwidth and latency of collective operations (e.g., AllReduce, AllToAll) meet expectations; and whether communication can effectively overlap with computation. For clusters with limited network conditions, mitigation measures such as gradient bucketing, communication compression, and topology-aware scheduling can help. Before formal training, run standalone communication benchmarks to understand the upper bound of cluster communication capacity, then adjust parallel partitioning accordingly.
3.4 Stability and Recoverability
“Being able to run” and “running stably” are two different things. Running 400 consecutive steps without failure is essentially a stress test for stability. Engineering support requires:
- Periodic checkpointing: Save model weights, optimizer states, and data progress at fixed intervals to support lossless recovery after interruption.
- Health checks and automatic restarts: Monitor card status, memory, temperature, and communication heartbeats. On anomalies, isolate the faulty node and relaunch the task automatically.
- Observability: Record per-step latency, throughput, loss curves, gradient norms, and communication latency to aid in troubleshooting.
4. How to Evaluate “Running Successfully”: Validation Criteria Behind 400 Steps
The step count is superficial. The metrics that truly matter are:
- Numerical correctness: Does the loss decrease normally and align with a reference implementation? Are gradient norms within a reasonable range? Are there any NaN or Inf values?
- Throughput and scalability: Is per-step latency stable? Does the speedup from two servers relative to one server match theoretical expectations for the chosen parallel strategy?
- Resource utilization: Are compute utilization, memory usage, and network bandwidth balanced? Are there obvious bottlenecks?
- Reproducibility: Do results remain consistent after multiple restarts and resumptions from checkpoints?
Only when all four criteria are met can the pipeline be truly considered “working,” rather than having merely completed a few dozen lucky steps.
5. Path from Validation to Production
After completing small-scale validation, if you plan to scale to larger training runs, follow a gradual path: first freeze the parallel configuration and hyperparameter baseline at the two-server scale, then expand to more servers step by step. For each expansion, re-run communication benchmarks and numerical alignment. Early on, integrate cloud-native capabilities such as container orchestration, monitoring, alerting, and logging services to platformize job scheduling, fault recovery, and performance analysis. For teams without self-built clusters, public cloud GPU instances and container platforms can quickly provide a validation environment—for example, using Baidu AI Cloud’s compute resources and engineering toolchain to smoothly transition from prototype to production.
Conclusion
Running 400 steps on two servers with 16 cards may seem like a small number, but behind it lies a systematic effort across framework adaptation, operator verification, memory optimization, communication tuning, and stability assurance. For developers, mastering this methodology—“minimal cluster validation, metric-based evaluation, and progressive scaling”—has greater long-term value than focusing on any single successful run. It applies to large model training practices on any compute platform.
