Training Large Models on Dual-Node 16-GPU Clusters: Practical Notes for Domestic AI Accelerators

    This article shares practical experience from running a large-model training task on a domestic (China-made) GPU cluster comprising two nodes and 16 accelerators. It covers topology planning, software stack adaptation, parallel strategy selection, memory management, stability checks, common troubleshooting, and job scheduling considerations. The goal is to help engineering teams evaluate domestic accelerators as an alternative for distributed training. While the original run completed 400 training steps, the article emphasizes that model size, dataset details, loss curves, and throughput metrics were not disclosed, so production readiness requires further validation. The methods described are applicable to accelerators from any vendor.

    Introduction

    As large language models grow in parameter count, the demand for training compute rises accordingly. Getting a training pipeline to run on domestic GPUs involves much more than simply powering on the hardware — the data loader, forward pass, backward pass, and gradient synchronization must all work reliably within the same software stack. This article uses a small-to-mid-scale cluster of two nodes with 16 accelerators as an example to highlight the key items to verify during adaptation, along with practical checklists you can apply directly.

    Key Takeaway

    The confirmed result of the original practice: on a 2-node, 16-card configuration, the training job completed 400 iterations, demonstrating that the pipeline can start up and sustain execution. However, the original practice did not disclose model size, training data, loss curves, throughput, or failure counts, so conclusion cannot be drawn about convergence quality or long-run stability. The methods described below apply to accelerators from any vendor.

    1. Topology Planning

    A typical dual-node, 16-card setup consists of two servers, each equipped with 8 accelerators. Intra-node communication relies on vendor-private interconnects or PCIe switches, while inter-node communication is handled over 200G or 400G RoCE or InfiniBand networks. The specific interconnect protocols, unidirectional bandwidth, and NIC models must be confirmed against vendor documentation and measured results.

    Topology awareness is the first step. Tensor parallelism (TP) generates a high volume of communication traffic and should be confined within a single node. Data parallelism (DP), which synchronizes gradients once per step, is better suited to cross-node networks. Before deployment, use the vendor’s topology discovery tools or standard commands such as lspci and ibstat to verify the physical connections, and measure both intra-node and inter-node bandwidth separately.

    2. Software Stack Adaptation

    The training pipeline typically depends on five layers: device drivers, runtime libraries, operator libraries, communication libraries, and framework adapters. The driver and runtime versions determine which operator and communication library versions are available; mismatched version combinations are a common cause of startup failures.

    The operator library must cover matrix multiplication (GEMM) and attention computation. In the Transformer architecture, the attention implementation has the greatest impact on throughput, so it should be prioritized during validation. The framework layer connects through PyTorch’s device extension mechanism; upper-level training code should remain largely unchanged to minimize risk from modifications.

    It is strongly recommended to record the versions of driver, runtime, framework, and communication libraries in an environment manifest. After every version change, rerun a smoke test before proceeding.

    3. Choosing the Parallel Strategy

    The original practice used TP=8 combined with DP=2 — that is, 8-way tensor parallelism within each node, with data parallelism across the two nodes. This choice is reasonable, but the selection should be made based on model parameter count, sequence length, global batch size, and memory budget.

    Tensor parallelism performs collective communication at every layer and is best placed inside a single node where bandwidth is high. Data parallelism synchronizes gradients only once per step, placing lower demands on inter-node bandwidth. If the model is too large for the 8-way shards to fit on a single card, pipeline parallelism or ZeRO sharding should be introduced as alternatives.

    4. Memory Management

    Out-of-memory (OOM) errors are common in large-model training. Taking a 7B-parameter model as a hypothetical example, with BF16 mixed precision and the AdamW optimizer, each parameter consumes roughly 16 bytes: BF16 weights (2 bytes), gradients (2 bytes), FP32 master weights (4 bytes), first-order momentum (4 bytes), and second-order momentum (4 bytes). This totals about 112 GB. With TP=8 sharding, each card carries approximately 14 GB of model states, leaving the remaining memory for activations.

    Activation recomputation can reduce activation memory at the cost of extra compute. ZeRO can further shard the optimizer states. Before deployment, measure peak memory with a small batch size and observe the degree of memory fragmentation.

    5. Stability Checks

    During training, three numbers require continuous attention: whether the loss shows NaN or sudden spikes, whether the gradient norm is being clipped to a reasonable range, and whether the learning rate warmup is progressing as scheduled. Additionally, verify that the optimizer states on all 16 cards remain consistent. One approach is to compute a checksum of the model parameters every few steps and compare across ranks.

    To determine whether the pipeline is usable, examine the loss curve, step time, accelerator utilization, and failure count together — not just whether the program exits without error.

    6. Monitoring Code Example

    The following code only depends on PyTorch and the Python standard library, and can run in any distributed environment. It checks at each step whether the loss is finite and below a threshold, and logs only on rank 0.

    1. import logging
    2. import math
    3. import torch
    4. import torch.distributed as dist
    5. logger = logging.getLogger("train")
    6. def is_rank0():
    7. return not dist.is_initialized() or dist.get_rank() == 0
    8. def check_step(step, loss, grad_norm, max_loss=1e4):
    9. loss_value = loss.item() if torch.is_tensor(loss) else float(loss)
    10. grad_value = grad_norm.item() if torch.is_tensor(grad_norm) else float(grad_norm)
    11. if not math.isfinite(loss_value) or loss_value > max_loss:
    12. raise RuntimeError(f"step {step}: loss abnormal ({loss_value})")
    13. if is_rank0():
    14. logger.info("step=%d loss=%.4f grad_norm=%.4f", step, loss_value, grad_value)

    In the training loop, call torch.nn.utils.clip_grad_norm_ to obtain the gradient norm first, then call check_step. The loss passed in should be the global value averaged across all ranks. If each rank evaluates its own local loss, an exception raised on one rank will leave the other ranks waiting indefinitely at the next collective operation, causing the job to hang. Additionally, note that loss.item() triggers a device synchronization; calling it every step reduces throughput. Consider running the check every 10 steps instead.

    7. Common Troubleshooting

    • Collective communication timeouts: Check network connectivity and the communication library’s timeout settings. Ensure all ranks invoke the collective operations in the same order.
    • Out-of-memory: Reduce the micro-batch size, enable activation recomputation, or increase the ZeRO sharding level.
    • NaN in loss: Lower the learning rate, review overflow handling in mixed precision, and confirm there are no corrupted samples in the data.
    • RDMA fallback to TCP: Check the NIC driver, switch configuration, and RDMA-related parameters.
    • Intra-node bandwidth below expectation: Verify the topology matches the design and investigate unintended paths crossing the PCIe switch.

    8. Scheduling and Storage

    Training tasks typically run inside containers or Kubernetes clusters. Device plugins can expose accelerators to containers. On task failure, the scheduler can reallocate nodes and retry the job.

    Training data needs to be read at high throughput. Shared file systems, parallel file systems, and local NVMe caches are all viable options; the choice depends on the data volume and read pattern. The original practice mentioned a service from a cloud provider as one of the options, but other solutions are equally applicable.

    Summary

    Completing 400 iterations on a dual-node, 16-card cluster demonstrates that a training pipeline can be brought up and sustained on domestic GPUs — a result with reference value. However, to determine whether it is ready for production, additional details are required: model size, training data, convergence curves, and failure statistics. Validation should also be repeated with a longer training horizon and at a larger cluster scale.

    Teams evaluating domestic accelerators as an alternative can start by verifying the topology, version compatibility, memory budget, and stability checks outlined in this article before deciding on the scale of investment.