Training Adaptation and Troubleshooting for Domestic AI Accelerator Cards in a 2-Node, 16-GPU Setup

    Learn how to verify large-model training adaptation on a 2-node, 16-GPU cluster built on domestic AI accelerator cards. This guide covers the difference between inference validation and full training adaptation, how to calculate memory budgets for near-3-trillion-parameter models, FSDP2 sharding configuration, cross-node communication checks, and gradient stability monitoring—with practical checklists and pseudocode.

    Introduction

    Recent public reports claim that a domestic Chinese AI training-and-inference accelerator card, paired with its proprietary software stack, completed full-pipeline training adaptation for a near-3-trillion-parameter large model in a 2-node, 16-GPU environment, running 400 consecutive optimizer update steps. The sources and measurement methodology behind these figures have not been verified, and this article does not treat them as performance evidence.

    What readers actually need is a method for evaluating such claims: first determine whether the conclusion concerns training or inference, then check whether memory, sharding, and monitoring data are complete. This article organizes the key points in that order and provides checklists you can compare against.

    1. How Training Adaptation Differs from Inference Validation

    Many “model successfully integrated” announcements actually refer to inference-side validation: the model can perform forward computation and produce output on a given type of hardware. Training adaptation sets a much higher bar—it must also cover backpropagation, cross-GPU gradient synchronization, optimizer state updates, and numerical stability. The comparison is as follows:

    Verification Item Inference Validation Training Adaptation
    Forward computation Required Required
    Backpropagation and gradient computation Usually not involved Required
    Optimizer state updates Not involved Required
    Cross-GPU gradient synchronization Usually not involved Required
    Numerical stability monitoring Rarely involved Must be recorded over many consecutive steps
    Peak memory usage Primarily weights Sum of weights, gradients, optimizer states, and activations

    Results from inference validation alone cannot be extrapolated into conclusions about training adaptation.

    2. How to Calculate the Memory Budget

    Take full-parameter training of a 3-trillion-parameter model as an example. Assume weights and gradients are stored in bf16, while Adam’s master weights and two momentum buffers are stored in fp32. A rough estimate:

    • Weights (bf16, 2 bytes per parameter): ~6 TB
    • Gradients (bf16, 2 bytes per parameter): ~6 TB
    • Adam states (fp32 master weights, first-order momentum, second-order momentum, 12 bytes per parameter total): ~36 TB
    • Total: ~48 TB, excluding activations and communication buffers

    With 2 nodes and 16 GPUs at 64 GB of memory each, total GPU memory is about 1 TB. If state data were fully sharded across the 16 GPUs, each GPU would carry 48 TB ÷ 16 = 3 TB on average. That far exceeds single-GPU memory, so full-parameter training must rely on host memory, storage offloading, or other techniques.

    The boundaries of this estimate:

    • When only a subset of parameters is trained, memory and compute scale down proportionally to the trainable parameter count.
    • For sparsely activated models that only update activated experts, distinguish between total model parameters and the parameters actually updated per step.
    • Activation memory depends on batch size, sequence length, and checkpointing strategy; it is not estimated here.

    When reading a report, confirm three things first: which parameters were trained, where the state data resides, and how long each step takes.

    3. FSDP2 Sharding Configuration Essentials

    FSDP2 (fully_shard) partitions parameters, gradients, and optimizer states across GPUs within a data-parallel group. During the forward pass, parameters are gathered on demand and released after computation. Four items must be determined during configuration:

    1. Sharding granularity: Typically, call fully_shard on each Transformer layer, then once more on the root module. Too coarse a granularity raises peak memory; too fine increases communication frequency.
    2. Mixed precision: Use bf16 for parameter computation and fp32 for gradient reduction to reduce numerical error.
    3. Activation checkpointing: Trade recomputation for memory savings, configured per layer.
    4. Offload policy: CPU offload moves parameters and optimizer states into host memory, at the cost of bandwidth consumption and increased step time.

    The pseudocode below only indicates where each configuration item goes; it cannot be run directly. The assumption of 8 GPUs per node is for illustration and must be adjusted to your actual topology. The device type (device_type) and communication backend are provided by the vendor SDK.

    1. # Pseudocode: shows where FSDP2 configuration items go; not runnable
    2. # Assumption: 2 nodes, 8 GPUs per node, 16 GPUs total; device_type provided by the vendor SDK
    3. import torch
    4. import torch.nn as nn
    5. from torch.distributed.device_mesh import init_device_mesh
    6. from torch.distributed.fsdp import fully_shard, MixedPrecisionPolicy, CPUOffloadPolicy
    7. def build_sharded_model(model: nn.Module, device_type: str, use_offload: bool):
    8. # 1D mesh over 16 GPUs with fully sharded states; with a 2x8 HSDP mesh instead,
    9. # each GPU would hold roughly 1/8 of the states
    10. mesh = init_device_mesh(device_type, (16,))
    11. mp = MixedPrecisionPolicy(param_dtype=torch.bfloat16, reduce_dtype=torch.float32)
    12. offload = CPUOffloadPolicy(pin_memory=True) if use_offload else None
    13. for layer in model.layers: # sharding granularity: per layer
    14. fully_shard(layer, mesh=mesh, mp_policy=mp, offload_policy=offload)
    15. fully_shard(model, mesh=mesh, mp_policy=mp, offload_policy=offload)
    16. return model

    Example launch command; the variable values must be set separately on each of the two machines:

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

    Note that after offloading, total state volume is still 48 TB. Host memory and storage capacity must be budgeted separately—otherwise enabling offload will fail just the same.

    Version dependencies must be verified item by item: PyTorch version (FSDP2 API availability depends on the version), the vendor’s adapted PyTorch branch, driver and firmware versions, the vendor’s collective communication library version, and the Python version. Compatibility must follow the matrix published by the vendor; do not combine versions based on assumptions.

    4. Cross-Node Communication Checks

    Cross-node communication is the primary risk in 2-node training. Check in the following order:

    • Topology: Record the bandwidth and latency between the two nodes, logged separately from intra-node bandwidth. Use the vendor-provided tools for bandwidth testing.
    • Rank mapping: Confirm each rank corresponds one-to-one to a device ID, and that rank ordering matches node numbering across both machines.
    • Smoke test: Run an all-reduce test first, increasing data size from 1 MB to 1 GB, and record latency at each size. Discontinuities in the latency curve usually indicate a link or configuration problem.
    • Timeout settings: The initialization timeout should exceed the duration of the first collective communication. Timeout thresholds should be tuned against measured baselines rather than kept at defaults.

    If cross-node all-gather latency is significantly higher than intra-node latency for the same data volume, investigate the network first instead of modifying the model architecture.

    5. Gradient and Training Stability Monitoring

    Training adaptation requires continuously recorded stability metrics; a single successful run proves nothing. Log the following items every step and retain at least several hundred steps of data:

    • Global gradient norm: Use the return value of clip_grad_norm_. With sharded parameters, this returns the global norm. If the proportion of steps where clipping triggers keeps rising, raise an alert.
    • Loss spikes: Count a spike whenever the current loss exceeds 3× the moving average of the last 100 steps. If spikes occur frequently, inspect learning rate warmup and data batches.
    • Numerical anomalies: If NaN or Inf appears in the loss or gradients, stop immediately.