Establishing a 16-GPU Dual-Node LLM Training Pipeline: A Successful 400-Step Run
This article details the engineering practices for establishing a distributed large model training pipeline across two servers equipped with 16 GPUs, culminating in a complete 400-step training run. It covers the criteria for a successful pipeline, hardware and network topology, software stack layering, parallel strategy selection, and the multi-node launch process. The focus is on addressing multi-node coordination and execution stability rather than evaluating model performance.
I. Background and Problem Definition
The engineering challenges of large model training often lie not in the model structure itself, but in coordinating multiple accelerators across multiple machines to run stably for a sufficient number of training steps. While single-node training is sufficient for prototyping, multi-node scenarios introduce new failure points, including network connectivity, startup parameter consistency, environment versioning, and storage read/write operations.
This article focuses on a practical case of establishing a “dual-node, 16-GPU training pipeline.” Two servers, each equipped with approximately 8 accelerators (16 in total), successfully executed a training task for 400 steps. Since the original materials only provide this conclusion without public metrics like throughput or loss curves, this article does not make quantitative judgments on model effectiveness or performance. Instead, it focuses on the key components and methods required to implement such a pipeline.
1.1 Criteria for “Pipeline Success”
“Pipeline success” means the entire training workflow—from data reading, forward computation, backward propagation, gradient synchronization, and parameter updates to checkpoint saving—runs continuously in a multi-node environment without interruption or anomalous results. This can be broken down into three criteria:
- All nodes start normally and complete process group initialization;
- Training steps continuously progress to the target value without manual intervention;
- Logs, metrics, and checkpoints are written correctly and can be used for recovery.
1.2 Goals and Boundaries
- Goal: Complete 16-GPU distributed training and execute 400 steps.
- Boundaries: Do not evaluate the final model capabilities or make horizontal comparisons with other solutions.
II. Hardware Topology and Network Design
2.1 Nodes and Accelerators
A dual-node, 16-GPU setup means each server hosts approximately 8 accelerators. Intra-node communication between cards utilizes local high-speed interconnects, while inter-node communication relies on the data center network. Since the bandwidth difference between these two types of links is typically significant, parallel strategies should strive to limit high-traffic communication operations within the node to reduce cross-node data transfer.
2.2 Network and Storage
Inter-node communication requires a stable, high-bandwidth network; otherwise, gradient synchronization will become a bottleneck. Training data and checkpoints are usually stored in shared storage, and every node should access them via the same path. If the data path is inconsistent across nodes, some nodes may fail to read the data and block, manifesting as the training hanging on a specific step for a long time.
Before launching, verify the following checklist:
- System clocks across all nodes are synchronized; otherwise, aligning log timelines and timeout judgments will be prone to errors;
- Specified ports are bidirectionally accessible between nodes;
- Read/write permissions for shared directories are consistent, and the mount status is normal;
- Dataset versions and checksum values are identical across all nodes.
III. Software Stack Layering
The software stack for multi-node training can be divided into five layers:
- Driver and Runtime: Accelerator drivers and device runtime libraries; versions must be identical across all nodes.
- Collective Communication Layer: Responsible for cross-card reduction, gather, and other communication operations.
- Deep Learning Framework: Provides automatic differentiation, operator scheduling, and distributed wrappers.
- Training Code: Data pipeline, model definition, optimizer, and learning rate scheduler.
- Scheduling and Monitoring: Process launching, log collection, metric reporting, and alerting.
Version consistency is the most easily overlooked issue. If the same task loads different runtime versions on different nodes, common symptoms include initialization hangs or numerical drift, and the error messages often do not point to the root cause. Therefore, it is recommended to uniformly print the version information of each node in the startup script for post-mortem comparison.
IV. Parallel Strategy Selection
At a scale of 16 GPUs, three common parallel methods are typically used:
| Strategy | Partitioning Target | Communication Characteristics | Applicable Scenarios |
|---|---|---|---|
| Data Parallel | Sample batches | Synchronize gradients per step | Preferred when the model fits on a single GPU |
| Tensor Parallel | Single-layer weight matrices | Frequent intra-layer communication | Single layers are too large; best limited to intra-node |
| Pipeline Parallel | Model layer segments | Pass activations between segments | Many layers; requires cross-node partitioning |
When selecting a strategy, first estimate the single-GPU memory footprint. If the sum of parameters, gradients, optimizer states, and activations exceeds the single-GPU capacity, model parallelism or memory optimization techniques must be introduced. In a dual-node scenario, a common combination is limiting tensor parallelism to within the node and applying data parallelism across nodes. The specific partition ratio needs to be determined based on the model structure and measured memory usage, rather than relying solely on empirical rules.
V. Training Launch Process
5.1 Pre-launch Checks
- Whether the number of accelerators, driver versions, and runtime versions are consistent across each node;
- Whether the master node address and port are accessible from all nodes;
- Whether shared directories are successfully mounted and data integrity is verified via checksums;
- Whether random seeds and data partitioning configurations are consistent.
5.2 Example Configuration
The following configuration is for illustrative purposes only; field names and values are placeholders and do not represent the actual parameters of the original practice:
job:name: multi-node-pretrain-demonodes: 2accelerators_per_node: 8total_accelerators: 16max_steps: 400parallel:data_parallel_size: 16tensor_parallel_size: 1pipeline_parallel_size: 1checkpoint:save_interval_steps: 100output_dir: /shared/ckpt/demologging:interval_steps: 10
5.3 Multi-node Launch Method
All nodes use identical launch parameters, differing only in the node rank. An example is shown below:
# Node 0 (Master node)<launcher> --nnodes 2 --node-rank 0 --nproc-per-node 8 \--master-addr <master_node_internal_ip> --master-port <port> train.py --config job.yaml# Node 1<launcher> --nnodes 2 --node-rank 1 --nproc-per-node 8 \--master-addr <master_node_internal_ip> --master-port <port> train.py --config job.yaml
Here, <launcher> represents the distributed launching tool provided by the current environment. All parameters in angle brackets must be replaced with actual values, and the target nodes should be confirmed before execution. The master node must start before other nodes, or the scheduling system must ensure all nodes are ready simultaneously; otherwise, the initialization phase will wait until it times out.
5.4 Key Structure of the Training Main Loop
for step in range(start_step, max_steps):batch = next(data_iter)loss = forward_backward(model, batch) # Forward and backward pass, gradient sync usually happens hereoptimizer_step()if step % log_interval == 0:report_metrics(step, loss) # Log loss, throughput, and memory usageif step % save_interval == 0:save_checkpoint(model, optimizer, step) # Save checkpoint
