Validating LLM Training Adaptation on Chinese GPUs: Paths and Checklist

    This article outlines validation paths and a checklist for adapting large language model training to Chinese GPUs. It distinguishes inference adaptation from training adaptation, explains how to read vendor case data, and details checks for FSDP2 sharding, cross-node gradient synchronization, numerical stability, checkpoint recovery, and acceptance criteria.

    1. Boundary Between Training Adaptation and Pretraining

    Inference adaptation addresses whether a model can be loaded on new hardware, run forward computation, and produce reasonable outputs. Training adaptation has higher requirements: it must verify whether the hardware and software stack can continuously complete multi-step backpropagation and optimizer updates while keeping numerical behavior stable. The differences can be summarized as follows.

    Dimension Inference adaptation Training adaptation Implication for adaptation work
    Numerical requirements Reasonable outputs are sufficient Small deviations accumulate over iterations Operator precision must be compared item by item against a reference implementation
    Parallel strategy Often single-card or few-card execution Combinations of data, tensor, pipeline, and expert parallelism Communication correctness between parallel groups must be validated
    End-to-end path Mainly loading and forward pass Loading, sharding, communication, gradient synchronization, and checkpointing are all required Each stage needs an independent pass criterion
    Validation duration A single inference can determine the result Requires continuous runs of hundreds of steps or more A short-term pass does not mean training can proceed over the long term

    The conclusion boundary for training adaptation validation is clear. It can prove that the training path runs under a given configuration and that numerical values do not diverge. It cannot prove that the model converges to the expected quality during pretraining, nor can it prove that the data mix, learning rate design, or downstream task performance meets requirements. Mixing these two types of conclusions is the most common misreading when reviewing vendor materials.

    2. How to Read Vendor Cases

    Recently, a Chinese full-function GPU vendor publicly stated that it had completed training adaptation for an open-source model with nearly 3 trillion parameters. The available public data is: a two-machine, 16-GPU environment, 400 consecutive optimizer updates, and loss and gradient norm remaining finite throughout the process.

    This data shows that under the disclosed configuration, training steps can be executed and that the two monitored metrics do not show NaN or infinity. It does not show model convergence, nor does it show throughput or efficiency level.

    To treat this case as a valid reference sample, at least the following details need to be provided.

    • Parameter scale: total parameter count and the number of parameters actually activated per forward pass. If the model uses a mixture-of-experts structure, the gap between the two is large, and direct number comparison leads to incorrect conclusions.
    • Compute precision: the specific combination of BF16, FP16, FP8, or mixed precision, and which operators use low precision.
    • Parallel and offload configuration: the scale of data parallelism, tensor parallelism, pipeline parallelism, and expert parallelism, and whether CPU offload is enabled for parameters or optimizer states.
    • Training data: dataset name, token count, global batch size, and gradient accumulation steps.
    • Software stack versions: deep learning framework, communication library, driver, firmware, and operator library versions.
    • Metric definitions: how many micro-batches correspond to one “optimizer update,” whether gradient norm is measured before or after clipping, and whether loss is averaged across GPUs.

    The vendor states that its training path reimplements sharding scheduling, communication primitives, and memory management for its own hardware. Whether this claim can be trusted depends on whether a whitepaper, reproducible scripts, version list, and log samples are available. If none of these four types of materials can be obtained, the case can only serve as a clue, not as a capability conclusion.

    3. FSDP2 Sharding Path

    3.1 Differences Between FSDP and FSDP2

    FSDP (Fully Sharded Data Parallel) is a data-parallel implementation provided by PyTorch. It shards parameters, gradients, and optimizer states across GPUs, gathers full parameters on demand during forward and backward computation, and releases them after computation. This approach can significantly reduce per-GPU memory usage.

    FSDP2 is a new generation implementation in PyTorch, commonly accessed through fully_shard. The differences between the two generations are mainly shown in the following table.

    Dimension FSDP1 FSDP2 Impact on adaptation
    Sharding granularity Concatenates parameters in a wrapping unit into a FlatParameter before sharding Shards parameter by parameter When troubleshooting memory and communication issues, locate individual parameters rather than the whole flat buffer
    Parameter representation Flattened one-dimensional tensor DTensor-based sharded representation Shard state can be queried directly, which facilitates debugging
    Combination with tensor parallelism Must handle wrapping nesting relationships Uses DeviceMesh to describe multi-dimensional parallel topology Device mesh definition must match hardware topology
    Checkpointing Often saved as a whole or in flat form Can work with distributed checkpointing to save by shard On restore, verify that shard mapping is consistent
    Version dependency Has substantial existing experience and examples Interfaces change significantly with PyTorch versions Framework version must be pinned and recorded in the version list

    During reproduction, pin the PyTorch version, communication library version, driver version, and firmware version. If versions are not pinned, two runs cannot be compared, and troubleshooting loses its basis.

    The vendor’s reimplementation of sharding scheduling, communication primitives, and memory management needs to be validated at the operator coverage level. Specifically, confirm that all-gather and reduce-scatter work correctly for the data types, tensor shapes, and non-uniform sharding cases in use.

    3.2 Sharding Scheduling Check Steps

    Sharding checks are performed in three steps.

    1. Check parameter shapes and counts after loading. The shard shape on each GPU should match the theoretical value. When a dimension length is not divisible by the world size, sharding includes padding; confirm that the padding does not participate in loss calculation.
    2. Check memory usage. Record allocated memory and peak memory after model construction, after the first forward pass, after the first backward pass, and after the first optimizer step. If the peak exceeds the budget, first check whether any parameters are not being released correctly.
    3. Check state dict round-trip consistency. Save the sharded state and reload it, then compare the tensor hash or norm for each parameter. The results should be exactly identical.

    4. Cross-Node Gradient Synchronization

    4.1 Communication Primitives and Topology

    FSDP2 uses all-gather to aggregate parameters during forward and backward computation, and reduce-scatter to distribute gradients back to shards after backward computation. With hybrid sharding (HSDP), reduce-scatter is used within the shard group, and all-reduce is also required between replica groups.

    The bottleneck in cross-node communication is usually inter-node network bandwidth rather than compute. In practice, two points should be addressed. First, keep frequent collective communication on intra-node high-speed interconnects where possible, and let cross-node communication carry only necessary synchronization. Second, validate communication time with measured bandwidth. The theoretical time for a single communication can be estimated as message size divided by effective bandwidth. If the measured value is significantly lower, check topology mapping and process binding first.

    4.2 Gradient Buckets and Communication Overlap

    To reduce the startup overhead of small messages, gradients are usually aggregated into buckets before communication. Bucket size needs to be selected through testing. Too small a bucket increases scheduling overhead; too large a bucket delays the start of communication. The prefetch setting determines whether parameter aggregation can overlap with computation of the previous layer. After enabling overlap, compare per-step time with overlap disabled to confirm that overlap actually brings benefits and does not introduce additional memory peaks.

    4.3 Synchronization Correctness Checks

    After synchronization, for tensors that should be identical between replicas, the gradient norms of each replica should be consistent, with the allowed error determined by numerical precision. At fixed step intervals, sample a parameter shard and compute its hash, then compare across GPUs to see whether they are identical. If inconsistency is found, first check whether the communication group partitioning is incorrect, then check whether communication was skipped at some step.

    4.4 Timeouts and Failure Handling

    The most common failure in cross-node training is collective communication timeout. During troubleshooting, enable debug logs for the communication library, such as NCCL_DEBUG=INFO for NCCL, and the corresponding HCCL log switch on the Ascend platform. Also enable asynchronous error handling so that timed-out processes exit as soon as possible instead of waiting indefinitely. Logs should record the timed-out process group ID, GPU ID, node name, and corresponding training step.

    The recovery strategy after failure must be defined in advance. It is recommended to restart the entire job from the most recent checkpoint that passed validation, rather than retrying a collective communication in place. Set an upper limit on retry attempts, and raise an alert directly after the limit is exceeded, avoiding jobs occupying resources in an error state for a long time.

    5. Numerical Stability Validation

    5.1 Metrics and Definitions

    At least the following metrics are recommended for monitoring.

    • loss: whether it is finite, and its trend over steps.
    • gradient norm: record the value before clipping and state the clipping threshold.
    • NaN and Inf counts: count the number of non-finite values in gradients and optimizer states.
    • Dynamic loss scaling metrics: changes in the scaling factor and steps skipped due to overflow. This item is usually not applicable when using BF16, but confirm that there are no hidden skipped steps.
    • parameter norm: used to observe whether parameters drift within a reasonable range.

    5.2 Prerequisites for Metrics

    The same set of metrics has different meanings under different configurations. Before interpreting any value, fix the following prerequisites.

    • Compute precision, and the coverage of low-precision operators.
    • Global batch size, micro-batch size, and gradient accumulation steps.
    • Parallel configuration, including the scale of each parallel dimension.
    • Data order, random seed, and data preprocessing method.
    • Learning rate schedule, optimizer hyperparameters, and gradient clipping threshold.

    Without any one of these, it is impossible to determine whether metric changes come from hardware, software, or configuration differences.

    5.3 Judgment Method

    It is recommended to establish a baseline first. On a reference platform or reference implementation, run the first several steps, for example 100 steps, with the same data, seed, and configuration, and record the loss curve and gradient norm. Due to different reduction orders, numerical values on two platforms naturally have small differences. Therefore, repeat runs on the reference platform several times first to measure its own fluctuation range, then use that range as the tolerance.

    The following thresholds can serve as a starting point and need to be calibrated against model scale and data characteristics.

    • No NaN or Inf appears in gradients throughout the observation window.
    • Gradient norm does not exceed several times the rolling median; the multiplier is derived from baseline fluctuation.
    • The skipped-step ratio is below the agreed upper limit.
    • The loss difference from the baseline is within the baseline’s own fluctuation range.

    Judgment is made over the entire window, not just the last step. A curve that looks normal at the end may have already diverged in the middle.

    6. Checkpoint Recovery

    Checkpointing is the final gate for whether training adaptation can be put into practice. The recommended validation method is: save a sharded checkpoint at step N, restore from that checkpoint, and continue running for several steps. Compare the loss after recovery with the loss from an uninterrupted run step by step; the two should be consistent within tolerance. If the checkpoint can only be saved but not restored, or if loss jumps after recovery, it means the shard mapping, optimizer state, or random number state was not fully saved.

    7. Evaluation Checklist for Direct Reference

    The following table can be used as an acceptance sheet. Each item should have a corresponding record before a formal conclusion is formed.

    Check item Pass criterion Common mistake
    Version record Framework, communication library, driver, firmware, and operator library versions are all written into the list Versions are not recorded, so results cannot be reproduced
    Loading Parameter count and shapes match the model definition, with no missing or extra keys Shape mismatch warnings are ignored
    Sharding Shard sizes are balanced across GPUs, and peak memory is within budget Padding for non-divisible dimensions is counted in loss
    Communication Collective communication matches reference results on test tensors, and measured bandwidth is close to expected Only small messages are tested, and bandwidth degradation on large messages is not discovered
    Gradient synchronization Gradient norms are consistent across replicas, and sampled shard hashes are identical across GPUs Communication group partitioning is incorrect, or communication is skipped at some step
    Stability All judgment items in Section 5 are met, and the full observation window is covered Only the last step is checked, or prerequisites are not recorded
    Checkpoint recovery Loss after recovery is consistent with an uninterrupted run within tolerance Only saving is performed without restoring, or optimizer state is not saved
    Failure handling Timeout reports the process and step within a bounded time, and retry count has an upper limit Waiting indefinitely, or continuing to run in an error state