Training a 10B-Parameter LLM on 16 Domestic AI Accelerators Across Two Nodes: Practical Guidelines

    This article documents a training adaptation exercise for an approximately 10-billion-parameter decoder-only Transformer on two nodes with eight domestic AI accelerators each. It covers the parallel configuration (TP=8, DP=2, PP=1), cross-node gradient synchronization over RoCE v2 or InfiniBand, bucket sizing and communication overlap, per-accelerator memory estimation with ZeRO-1, precision acceptance for core operators such as LayerNorm, Softmax, and FlashAttention, checkpointing and resume consistency checks, and a 400-step validation run. The results are presented as practical checklists and troubleshooting orders rather than universal performance claims; readers should re-measure key parameters on their own hardware.

    Introduction

    Large model parameter counts and training data scale are growing quickly, and a single compute cluster or hardware ecosystem is often insufficient. Making domestic heterogeneous compute run the full LLM training pipeline has become an infrastructure priority for many teams. This article records one adaptation exercise for two-node, 16-accelerator training, covering parallel configuration, communication links, operator precision, memory, and checkpoint resume. The numbers and checklist items come from this single experiment. Readers should re-measure on their own hardware before deciding whether to reuse them.

    1. Experimental Conditions and Parallel Configuration

    Fix the experimental conditions first so that later numbers have a reference point.

    Item Configuration
    Model scale ~10B parameters, decoder-only Transformer
    Hardware 2 compute nodes, 8 domestic AI accelerators per node, 16 total
    Inter-node network RoCE v2 or InfiniBand, choose one, see Section 2
    Training precision BF16 compute, FP32 master weights and optimizer states
    Sequence length 2048
    Global batch size 64 sequences
    Training steps 400

    Software versions are the most error-prone area. Framework, driver, vendor adaptation library, and communication library versions must match one another and align with the vendor’s adaptation documentation. This article does not list specific version numbers because a version set from elsewhere may not apply to the reader’s machines. Record your own environment with the following version matrix:

    Field Meaning How to obtain
    Training framework and version e.g., PyTorch or a vendor-adapted version pip show or image build record
    Accelerator driver version Device driver and firmware Vendor tool query
    Vendor adaptation library version Adaptation package for operator and communication libraries Vendor release notes
    OS and kernel Distribution and kernel version uname -r and system information
    Python version Interpreter version python --version

    The parallel strategy consists of tensor parallelism (TP), data parallelism (DP), and pipeline parallelism (PP); their product must equal the total number of accelerators. This article uses:

    Parallel mode Value Scope
    Tensor parallelism TP 8 Across 8 accelerators within a single node, over intra-node high-speed interconnect
    Data parallelism DP 2 Across the two nodes, over the cross-node network
    Pipeline parallelism PP 1 Disabled

    TP × DP × PP = 8 × 2 × 1 = 16. Tensor splitting has the most frequent communication, so it is kept inside a single node. Cross-node communication is only data parallelism, with one gradient synchronization per training step, which places less pressure on the network.

    Another option is TP=8, PP=2, DP=1, where each node hosts one front or back segment of the model. It passes activations across nodes, and its communication pattern is completely different from gradient synchronization. This article did not validate that option, so the conclusions here do not apply to it. A single training job can use only one parallel configuration; after switching configurations, communication, memory, and troubleshooting methods must all be revalidated.

    The main bottleneck in two-node training is data-parallel gradient synchronization. The following sections describe network configuration and how communication overlaps with computation.

    1. Network Configuration

    The inter-node network should use a non-blocking fat-tree or leaf-spine topology. The NICs on both nodes should connect to the same switching fabric, and there must be no convergence point in the path that limits bandwidth.

    Network type PFC/ECN required Key validation metrics
    RoCE v2 Yes. Enable PFC on the priority used by RDMA traffic and configure ECN with congestion control Switch PFC pause frame counters; NIC drop and retransmit counters
    InfiniBand No. The link layer uses credit-based flow control Port error counters, including symbol errors and link-down count

    Before go-live, confirm the following checklist item by item and record each baseline value so changes can be identified during troubleshooting.

    • PFC priority is consistent on the NIC and switch.
    • ECN thresholds match the design values.
    • Cables and optical modules pass bit error rate testing.
    • Run the vendor-provided all-reduce benchmark to saturate two-node bandwidth, and record the bandwidth value.
    • Record idle baselines for drop, retransmit, and error counters.

    During training, if drop counters continue to grow, the lossless network configuration has a problem. Gradient synchronization will trigger timeout retransmission, and per-step time will show obvious jitter.

    Troubleshoot in this order. First, confirm that PFC priority is consistent on both ends. Second, confirm that ECN thresholds are reasonable. Third, check cables and optical modules. If the issue cannot be fixed in the short term, reduce the gradient communication bucket size and lower communication concurrency to reduce congestion. Training can continue, but throughput will decrease. This is only a temporary measure to protect progress and should not be used as a formal configuration.

    2. Communication and Computation Overlap

    Backpropagation computes from the last layer backward, and All-Reduce can be launched after each layer’s gradients are computed. The framework merges gradients from several layers into a bucket and then communicates them together. A larger bucket reduces startup overhead per communication but leaves less computation time available to overlap. A smaller bucket does the opposite.

    If using PyTorch DDP or a compatible implementation, the default bucket is 25 MB. This article starts from that default and adjusts gradually, using “exposed communication time” in the profiler as the selection criterion. Exposed communication time is the part of communication not covered by computation; the configuration with the smallest value is preferred.

    Overlap cannot completely hide communication latency. The last bucket’s communication must wait until backpropagation ends and cannot overlap with computation. Therefore, rely on profiler measurements and do not assume communication is fully hidden.

    3. Memory Estimation and Operator Precision Acceptance

    1. ZeRO Sharding Scope

    ZeRO sharding occurs within the data-parallel group. In this article DP=2, so optimizer states and gradients can be split at most two ways, not 16 ways. To split 16 ways, DP=16 and TP=1 would be required, which differs from this configuration; memory usage and communication patterns would change accordingly.

    This article uses ZeRO-1, which shards only optimizer states. A rough per-accelerator memory calculation, excluding activations, is as follows:

    • Model parameters: about 10 billion.
    • BF16 weights: about 20 GB; after TP=8, about 2.5 GB per accelerator.
    • BF16 gradients: about 20 GB; after TP=8, about 2.5 GB per accelerator. ZeRO-1 does not shard gradients, so this part remains unchanged.
    • FP32 master weights plus Adam first and second moments: 12 bytes per parameter, about 120 GB total. After TP=8, about 15 GB per accelerator; ZeRO-1 splits this again within DP=2, to about 7.5 GB.
    • Total: about 12.5 GB per accelerator, plus activations.

    Activation size depends on the following variables: number of layers, hidden dimension, sequence length, micro-batch size, and whether recomputation is enabled. Record these variables together during estimation. Final peak memory should be measured with a profiler or device monitoring, and early-stage peaks should be distinguished from steady-state peaks. The rough calculation above is only a starting point.

    2. Operator Precision Acceptance

    Core operators such as LayerNorm, Softmax, and FlashAttention need precision acceptance before being connected to training. Operators that fail precision requirements often cause loss anomalies early in training, and troubleshooting costs far more than upfront acceptance.

    Operator Precision Metric Starting threshold
    LayerNorm FP32 Maximum absolute error ≤ 1e-5
    Softmax FP32 Maximum absolute error ≤ 1e-5
    LayerNorm BF16 Maximum relative error ≤ 1e-2
    Softmax BF16 Maximum relative error ≤ 1e-2
    FlashAttention forward BF16 Maximum relative error ≤ 1e-2
    FlashAttention backward gradient BF16 Maximum relative error ≤ 1e-2

    Measurement method: the baseline is the result of the same input on a FP32 CPU reference implementation. Inputs should come from the activation distribution produced by real training data, not all-zero or uniform random values; otherwise, the real numerical range cannot be reflected. Test at least 1000 samples per operator, and record both the maximum value and the 99th percentile. Relative error is calculated as |a − b| / max(|b|, ε), where b is the baseline value and ε is a very small positive number used to avoid division by zero.

    The BF16 threshold of 1e-2 in the table is only a starting threshold. BF16 has about 2 to 3 significant digits, and error distributions differ greatly by operator. Therefore, thresholds should be determined from measured data as follows:

    1. Collect the error distribution of each operator on real activations.
    2. If the 99th percentile error is well below 1e-2, tighten the threshold to a reasonable margin near that distribution so regressions can be detected earlier.
    3. If the 99th percentile error exceeds 1e-2, first compare against the same BF16 simulated implementation on CPU. If the simulation is close to the FP32 baseline, the error comes from the precision limit of BF16 itself; adjust the threshold and record the reason. If the simulation is normal but the vendor operator is clearly worse, it is an implementation issue.
    4. For operators judged to have implementation issues, there are three handling methods: switch to the FP32 reference implementation, replace with another vendor operator, or roll the adaptation library back to the previous version that passed acceptance. Re-run the full precision acceptance after each handling method.

    Keep a record for every acceptance run. Recommended fields include: operator name, precision, framework and adaptation library version, input source and sample count, maximum error, 99th percentile error, threshold, conclusion, and handling method.

    4. Checkpoint Resume and 400-Step Validation

    1. Checkpoint Strategy

    The prerequisite for checkpoint resume is that the checkpoint can fully restore training state. A complete save should include:

    • Model weights, saved separately according to the parallel split.
    • Optimizer states, including FP32 master weights and Adam momentum.
    • RNG states, including Python, framework, and device RNGs.
    • Data reading progress, i.e., consumed sample indices and data iterator state.
    • Learning rate scheduler state and current step.
    • Parallel configuration and version information, used for validation on restore.

    Save frequency requires a tradeoff between two goals. More frequent saves reduce training time lost after an interruption, but saving itself consumes more I/O and time. This article recommends measuring single-save time first, then choosing an interval at which save time is a very low proportion of total training time.

    The save process should use atomic writes: write to a temporary directory first, and rename it to the final directory only after everything is complete. This prevents a corrupted checkpoint if the write is interrupted. Keep only the most recent several versions, plus one confirmed-good version as a rollback point.

    2. Resume Consistency Validation

    After restore, do not continue training directly. Run consistency checks first.

    • Check whether world size, TP, DP, and PP match the configuration at save time. If the configuration does not match, loading should be rejected rather than forcing a resume.
    • After restore, run several steps and compare loss with the log before saving. Within the error allowed by floating-point nondeterminism, the two should be basically consistent. If the gap is obvious, check whether data progress, RNG state, and learning rate scheduler have all been restored correctly.
    • Confirm that data is neither duplicated nor omitted, especially in the first few epochs or batches after restore.

    If loss appears abnormal after restore, roll back to the previous confirmed-good checkpoint and troubleshoot again, rather than continuing training from an abnormal state.

    3. Scope of 400-Step Validation

    The 400-step validation in this article can only show three things: whether the communication link is stable during this period, whether the training process can complete, and whether loss shows a downward trend.

    It cannot show the following: whether the model can converge to the target loss, whether long training will produce late-stage numerical issues, how it behaves after learning rate warmup and decay finish, or whether steady-state throughput can be maintained over the long term. These conclusions require a complete long run.

    Therefore, the 400-step result should be treated as link acceptance, not as a performance or convergence conclusion.

    4. Troubleshooting Order for Common Issues

    Three types of issues are common during training. Troubleshoot them in the following order.

    1. Communication timeout. First check network counters for drops or retransmits, then check PFC and ECN configuration, and finally confirm whether one node has an obviously longer per-step time. If timeout occurs on only one machine, it is likely a NIC or cable issue on that node.
    2. Loss spikes. First check whether the data batch is abnormal, for example, whether there are overly long or completely empty samples. Then check whether the learning rate is too high during warmup. Finally, check low-precision operators against the operator precision acceptance records to see whether any operator has a clearly increased error under specific inputs.
    3. Continuous memory growth. First distinguish a true leak from allocator caching and fragmentation. Observe the memory curve over multiple steps; if it continues to rise after stabilizing, check whether tensors are accidentally retained in the computation graph or log lists. Then check whether activations exceed estimates because of sequence length changes, and enable recomputation if necessary.

    5. Notes for Reuse

    The parallel table, threshold table, and troubleshooting order in this article can serve as configuration templates. Before applying them to other environments, re-measure the following on your own hardware: the effects of TP, DP, and PP combinations; bucket size; PFC and ECN parameters; error distributions of each operator; and training peak memory. Only after these values are validated in your own environment do the conclusions in this article hold.