Engineering Large Model Training Pipelines on a Domestic Compute Cluster: A 16-Accelerator Practice
This article presents a practical engineering case of running a large language model training pipeline on a two-node, 16-accelerator domestic compute cluster for 400 consecutive training steps. Rather than focusing on a specific product, it examines general technical challenges such as hardware and network topology, software stack layering, distributed parallel strategy selection, staged validation, troubleshooting, and performance and stability optimization. It also summarizes a vendor-neutral methodology based on the principles of validating from small to large, verifying layer by layer, and monitoring the full path, helping teams build reliable large model training capabilities on their own compute infrastructure.
1. Background and Problem Statement
As the parameter scale of large language models continues to grow, single-machine, single-card training has long been unable to meet practical requirements. Whether for pretraining from scratch or large-scale instruction tuning, multi-machine, multi-card distributed training has become the industry standard. At the same time, more enterprises and research institutions are starting to build complete training capabilities on non-traditional compute platforms, which introduces a series of new engineering challenges:
- Whether operator coverage and computational precision on the new hardware platform meet training requirements;
- Whether communication bandwidth and topology between machines will become scaling bottlenecks;
- Whether the adaptation among training frameworks, parallel strategies, and low-level drivers is mature;
- How to ensure stability, recoverability, and reproducibility of results during long-cycle training.
This article uses a typical training practice as its thread: on a cluster consisting of two servers and 16 accelerators in total, it runs the full training pipeline of a mainstream large model and executes 400 training steps continuously and stably. The article does not focus on any specific product; instead, it focuses on general technical problems and breaks down the key stages step by step.
2. Overall Architecture of the Training Environment
2.1 Hardware and Network Topology
A two-node, 16-accelerator configuration is a typical small-to-medium-scale training cluster. Within each node, accelerators usually communicate through a high-speed interconnect bus; cross-node communication relies on a high-performance network. When planning the topology, note the following:
- Prioritize intra-node communication: Place communication-intensive parallel dimensions, such as tensor parallelism, inside the node as much as possible, using intra-node high bandwidth to reduce communication overhead;
- Minimize cross-node communication: Place dimensions with relatively controllable communication volume, such as data parallelism, at the cross-node level;
- Network protocol selection: RDMA-based high-performance network protocols can significantly reduce the latency of cross-node collective communication and are foundational infrastructure for two-node training.
2.2 Layering of the Software Stack
A working training environment usually contains the following layers from bottom to top:
- Driver and runtime: Responsible for device management, memory allocation, and kernel scheduling;
- Compute and communication libraries: Provide basic operators such as matrix operations, as well as collective communication primitives such as AllReduce and AllGather;
- Training framework: Responsible for computation graph construction, automatic differentiation, and distributed strategy orchestration;
- Model code and configuration: Define model structure, parallel partitioning, and hyperparameters.
A version mismatch or missing operator at any layer can prevent training from starting or cause it to fail mid-run. Therefore, before正式开跑, it is recommended to use a small model and small batches of data for a “smoke test” to verify the availability of the software stack layer by layer.
3. Choosing Distributed Parallel Strategies
3.1 Three Basic Parallelism Methods
- Data parallelism (DP): Split data across different devices, compute gradients separately, and then aggregate them. It is simple to implement, but each device must store a complete model replica, resulting in high memory overhead;
- Tensor parallelism (TP): Split the weight matrices of single-layer operators across multiple devices to jointly complete one forward/backward computation. Communication is frequent, so it is suitable for intra-node placement;
- Pipeline parallelism (PP): Split the model by layers across different devices to form a pipeline. Communication volume is small, but pipeline bubbles must be handled.
3.2 Partitioning Recommendations for the 16-Accelerator Scenario
For a two-node, 16-accelerator scenario, a common empirical configuration is: use 8 cards within a node for tensor parallelism, and 2-way cross-machine data parallelism or pipeline parallelism. The rationale is:
- Tensor parallelism involves multiple collective communications per layer, and intra-node bandwidth can handle this;
- Only gradient synchronization or activation transfer is retained across nodes, making communication frequency and data volume more controllable;
- If the model is large and memory is tight, optimizer state sharding (sharded data parallelism) can be added to further reduce per-card memory usage.
Below is a schematic startup configuration (a general example only, not a specific tool command):
# Schematic: 2 nodes, 8 cards per node, 16 processes in totallauncher --nnodes=2 --nproc_per_node=8 \--tensor_parallel_size=8 \--pipeline_parallel_size=1 \--data_parallel_size=2 \train.py --config model_config.yaml
4. Establishing and Validating the Training Pipeline
4.1 Staged Validation Method
Starting full training directly is high-risk. It is recommended to proceed in stages:
- Single-card validation: Confirm that the model can complete forward and backward computation on a single card, and that loss decreases normally;
- Single-node multi-card validation: Introduce tensor parallelism and check numerical consistency after partitioning;
- Two-node full validation: Add the cross-node dimension and focus on whether communication is normal and whether throughput meets expectations;
- Long-stability validation: Run hundreds of consecutive steps and monitor the loss curve, memory usage, device temperature, and communication time.
4.2 Significance of 400 Consecutive Steps
Completing 400 consecutive training steps is not just a number; it validates several key capabilities:
- Numerical correctness: Loss continues to decrease without divergence, indicating that operator precision and parallel partitioning have not introduced errors;
- Memory stability: No out-of-memory errors caused by memory leaks or fragmentation during long-running execution;
- Communication reliability: Cross-node collective communication has no timeouts or packet loss under long-term high load;
- Throughput consistency: Step times remain stable, indicating no hidden resource contention or scheduling jitter.
4.3 Troubleshooting Common Issues
| Symptom | Possible cause | Investigation direction |
|---|---|---|
| Loss divergence or NaN | Learning rate too high, precision overflow, incorrect partitioning | Lower the learning rate, check mixed-precision configuration, align with single-card results |
| Throughput far below expectation | Excessive communication share, pipeline bubbles | Adjust parallel partitioning, enable communication-computation overlap |
| Out of memory | Activations too large, recomputation not enabled | Enable activation recomputation, reduce micro-batch size |
| Training hangs mid-run | Cross-node communication timeout | Check network status, adjust communication timeout parameters |
5. Performance and Stability Optimization Practices
- Mixed-precision training: Use half-precision computation with single-precision accumulation to significantly improve throughput with almost no accuracy loss;
- Communication-computation overlap: Pipeline gradient synchronization with backward computation to hide communication latency;
- Activation recomputation: Trade computation for memory so that larger models or larger batches can fit on a single card;
- Periodic checkpoints: Save model and optimizer states at fixed intervals, combined with resumable data loading, to ensure training can resume from a breakpoint after a failure;
- End-to-end monitoring: Build a unified monitoring dashboard for loss, gradient norm, learning rate, throughput, memory, and device utilization, enabling rapid localization when anomalies occur.
In enterprise production environments, general cloud capabilities such as container platforms, object storage, logging services, and monitoring and alerting can also be used to integrate training job orchestration, data management, and metric observation into standardized workflows, reducing operational overhead.
6. Conclusion and Outlook
Running 400 training steps on two nodes with 16 accelerators essentially validates the availability of a complete pipeline: from hardware drivers and communication libraries to the training framework and model code, every layer must work correctly together. This article summarizes a vendor-neutral methodology from five dimensions: architecture design, parallel strategy, staged validation, troubleshooting, and performance optimization. For teams that want to conduct large model training on their own compute resources, it is recommended to follow the principles of “start small and scale up, validate layer by layer, and monitor throughout” and proceed steadily. As the operator ecosystem and compiler optimization continue to improve, large model training on diverse compute platforms will become more mature and efficient.
