Two-Node 16-GPU Training Pipeline: Topology, Parallelism, and Validation Checklist

    This article outlines how to build a two-node, 16-GPU distributed training pipeline for large language models on self-developed-architecture GPUs in a non-mainstream ecosystem. It covers hardware and network topology, parallelism strategy selection, distributed initialization code, what 400 training steps do and do not prove, stability and performance monitoring, checkpointing, and the items that remain unverified.

    Why Run Multi-Node, Multi-GPU Training

    Large language model parameter counts keep growing. Memory and compute on a single GPU quickly become insufficient, so multi-node, multi-GPU distributed training has become standard practice. On self-developed-architecture GPUs in a non-mainstream ecosystem, the difficulty usually lies not in the model itself but in hardware interconnect, communication library adaptation, and operator compatibility.

    Industry reports have claimed that a training pipeline for a large language model was completed on two nodes with 16 GPUs and that 400 iterations were run. The report did not provide batch size, sequence length, loss curves, or throughput data, so this article does not repeat its performance conclusions. The following sections follow the engineering workflow and describe what must be determined and measured when building this pipeline.

    1. Hardware and Network Topology

    A two-node 16-GPU topology usually consists of two nodes with 8 GPUs per node. Before setup, record the following items in a written checklist, because later parallelism decisions depend on these numbers.

    • GPU model and memory capacity: determines the maximum shard size a single GPU can hold.
    • Intra-node interconnect: link type and theoretical bandwidth between GPUs. Tensor parallelism is most sensitive to this.
    • Inter-node network: NIC model, protocol (InfiniBand or RoCEv2), whether RDMA is enabled, and switch topology.
    • Measured bandwidth and latency: use a collective communication benchmark to measure All-Reduce bandwidth and latency separately within a single node and across nodes. Theoretical values are only a reference; measured values determine the partitioning strategy.

    If hardware models or network details cannot be disclosed for confidentiality reasons, publish only measured metrics, such as intra-node and inter-node All-Reduce bandwidth and small-message latency. These numbers let readers judge whether the approach fits their scenarios.

    2. Choosing a Parallelism Strategy

    A single parallelism strategy rarely balances compute efficiency and memory usage at the same time. Common combinations for two nodes and 16 GPUs include 3D parallelism (TP + PP + DP), or tensor parallelism plus ZeRO/FSDP. The table below lists the differences among three basic strategies.

    Strategy Primary communication Communication frequency Memory benefit Recommended placement
    Tensor parallelism (TP) All-Reduce of activations Multiple times per layer Shards weights and activations Intra-node (within 8 GPUs)
    Pipeline parallelism (PP) Point-to-point activation transfer between adjacent stages Once per micro-batch Splits by layer Across nodes
    Data parallelism (DP) / FSDP All-Gather of parameters and Reduce-Scatter of gradients Once or multiple times per step Shards optimizer states, gradients, and parameters Depends on inter-node bandwidth

    When choosing, check in the following order:

    1. Whether the TP group can fit entirely within one node. If it spans nodes, inter-node bandwidth must be clearly above the measured requirement; otherwise, it is not recommended.
    2. Whether the number of PP stages matches the number of nodes. With two nodes, PP=2 means each node carries half of the model layers.
    3. Whether a single GPU’s memory can hold the sharded parameters, gradients, optimizer states, and activations. A rough estimate can be made from the model parameter count first.
    4. Whether inter-node communication volume is within the measured bandwidth limit. Communication volume can be estimated by dividing the bytes transferred per step by bandwidth.

    For 16 GPUs, TP=8, PP=2, and DP=1 is one feasible configuration. If the model is smaller, TP=8, DP=2 with FSDP may also be more suitable. Which is better depends on the results of the four checks above, not on someone else’s configuration.

    3. Training Initialization and Code

    The following code shows the basic structure of distributed initialization. It relies on standard PyTorch interfaces, but the communication backend name and device interface must be replaced with the actual names in the vendor documentation. The example is not directly runnable; it only illustrates the order of steps.

    1. import os
    2. import torch
    3. import torch.distributed as dist
    4. # torchrun injects the following environment variables
    5. rank = int(os.environ["RANK"])
    6. local_rank = int(os.environ["LOCAL_RANK"])
    7. world_size = int(os.environ["WORLD_SIZE"])
    8. BACKEND = os.environ.get("DIST_BACKEND", "nccl") # Replace with the communication backend name in the vendor documentation
    9. DEVICE_TYPE = "cuda" # Replace with the device type registered by the vendor
    10. TP, PP = 8, 2
    11. assert world_size % (TP * PP) == 0, "world_size must be divisible by TP*PP"
    12. DP = world_size // (TP * PP)
    13. dist.init_process_group(
    14. backend=BACKEND,
    15. init_method="env://",
    16. rank=rank,
    17. world_size=world_size,
    18. timeout=torch.distributed.constants.default_pg_timeout,
    19. )
    20. torch.cuda.set_device(local_rank) # Replace with the vendor's device binding interface
    21. device = torch.device(DEVICE_TYPE, local_rank)
    22. def build_groups(tp, pp, dp):
    23. """Every process must call new_group in the same order; otherwise, a deadlock can occur."""
    24. groups = {}
    25. for p in range(pp):
    26. for d in range(dp):
    27. ranks = [p * dp * tp + d * tp + t for t in range(tp)]
    28. g = dist.new_group(ranks)
    29. if rank in ranks:
    30. groups["tp"] = g
    31. for d in range(dp):
    32. for t in range(tp):
    33. ranks = [p * dp * tp + d * tp + t for p in range(pp)]
    34. g = dist.new_group(ranks)
    35. if rank in ranks:
    36. groups["pp"] = g
    37. for p in range(pp):
    38. for t in range(tp):
    39. ranks = [p * dp * tp + d * tp + t for d in range(dp)]
    40. g = dist.new_group(ranks)
    41. if rank in ranks:
    42. groups["dp"] = g
    43. return groups
    44. groups = build_groups(TP, PP, DP)
    45. # Instantiate only the layers for this PP stage to avoid loading the full model onto a single GPU
    46. # model = build_model_stage(stage_id=..., groups=groups)
    47. # model = model.to(device)
    48. # BF16 does not need GradScaler. Only FP16 training needs it enabled.
    49. use_fp16 = False
    50. scaler = torch.amp.GradScaler(DEVICE_TYPE, enabled=use_fp16)

    An example launch command follows; run it once on each of the two nodes:

    1. torchrun --nnodes=2 --nproc_per_node=8 --node_rank=$NODE_RANK \
    2. --master_addr=$MASTER_ADDR --master_port=29500 train.py

    Before running, also confirm the following environment information and write it into the documentation:

    • Framework version, communication library version, and driver version
    • Container image tag and base operating system
    • Device node mount method and container permissions
    • Whether environment variables are consistent across nodes

    Mixed-precision training commonly uses BF16 or FP16. BF16 has a larger dynamic range and generally does not require loss scaling. FP16 requires GradScaler. In either case, compare the output error of the same operator on the self-developed-architecture GPU and on reference hardware; otherwise, loss may become NaN early in training.

    4. Stability Validation: What Does 400 Steps Mean?

    Completing 400 steps means the pipeline did not crash during that period. It does not mean the model has converged, nor does it prove long-running stability. Four hundred steps is usually only a smoke test.

    To judge whether training is trustworthy, record the following data:

    • Training configuration: global batch size, sequence length, precision, TP/PP/DP configuration, and random seed.
    • Loss and gradients: loss and grad_norm per step, plus the number of NaN or overflow occurrences.
    • Throughput: tokens/s, per-step time, and comparison with a single-node baseline.
    • Stability events: number of OOMs, communication timeouts, and job restarts.

    One effective check is to run the first several steps with the same data and random seed on a single node with 8 GPUs and on two nodes with 16 GPUs, then compare the loss curves. The two should match within an acceptable error margin. A clear deviation is likely caused by parallelism partitioning, gradient synchronization, or operator precision.

    For troubleshooting, consider the following:

    • NaN loss: first check whether grad_norm suddenly increases, then compare the outputs of key operators on reference hardware, and finally check whether gradient clipping is in effect.
    • OOM: inspect peak memory and fragmentation. If the vendor allocator supports configurations such as expandable segments, try enabling them. Also check whether activation recomputation is enabled.
    • Communication hang: shorten timeouts to expose problems earlier, and enable vendor-provided communication debug logs to identify which process group is waiting.

    5. Performance Tuning and Monitoring

    Communication and Compute Overlap

    DDP or FSDP usually supports gradient bucketing so that backward computation and gradient communication run in parallel. To confirm whether overlap is effective, use a profiling tool to inspect the timelines of compute and communication streams and see whether communication is hidden by computation. If hiding is poor, adjust the bucket size or check whether the custom communication library supports non-blocking calls.

    Monitoring Metrics and Alerts

    At a minimum, monitor the following metrics and set alert thresholds. Thresholds should be adjusted according to vendor specifications and your own baseline:

    • GPU utilization, temperature, and power: set the temperature threshold according to vendor specifications.
    • Communication time: alert when the proportion of communication time in a step rises abnormally.
    • Loss and grad_norm: alert on NaN or when grad_norm exceeds historical average by multiple times.
    • Throughput: alert when it drops more than 10% relative to baseline, a common starting point.
    • OOM count and communication timeout count: alert whenever they occur.

    Checkpoint Resume

    Periodically saving checkpoints is necessary. Note the following:

    • Write to a temporary file first and rename it after writing completes, to avoid corrupted files from interrupted saves.
    • Save model parameters, optimizer states, random number states, and the data loader’s read position. If any of these is missing, the resumed training may not follow the original trajectory.
    • After resuming, compare whether loss is close to the trend before the interruption.
    • Frequent saves consume storage bandwidth and capacity; the save interval must balance compute loss and storage cost.

    6. Conclusion and Unverified Items

    The key to building a two-node 16-GPU training pipeline lies in four areas: topology, parallelism strategy, initialization correctness, and long-running stability. Each area should be confirmed with measured data rather than experience alone.

    What can currently be confirmed is that the pipeline can initialize and complete 400 iterations. The following items have not been verified and should not be used to draw conclusions:

    • Memory and throughput behavior at the hundred-billion-parameter scale
    • Stability during long runs (thousands of steps or more)
    • The complete process for failure recovery and checkpoint resume
    • Model convergence quality on the validation set

    Follow-up validation can proceed in this order: first fix the random seed and align loss between single-node and two-node runs, then gradually increase sequence length and model scale, and finally perform long-running and fault-injection tests. Record the configuration and metrics at each step so others can reproduce them.