Adapting Chinese-Developed GPUs for Large Model Training: Key Engineering Steps in Distributed Systems

    This article outlines the main engineering steps for adapting a compute platform to large model training, which goes well beyond inference. It covers memory accounting, sharded parallelism, mixed precision, cross-node communication, and stability validation. It ends with a checklist that teams can use for internal acceptance. The article does not focus on any specific product.

    The bar for large model training is shifting from being able to run inference to being able to finish training reliably. For models approaching 3 trillion parameters, the demands on a compute platform’s memory, communication, and numerical stability are far higher than for inference. This article does not focus on any specific product. Instead, it reviews the key engineering steps of training adaptation from a general perspective: memory accounting, sharded parallelism, mixed precision, cross-node communication, and stability validation. It also provides checklist items that teams can use for internal acceptance.

    1. Inference Adaptation vs. Training Adaptation

    In the industry, “Day 0 adaptation” usually refers to the work hardware vendors do right after a new open-source model is released. They quickly validate forward inference operators on their own chips and confirm that the model produces correct outputs. This kind of adaptation generally does not change model weights and does not require backpropagation or optimizer updates.

    Training adaptation requires a complete working loop on the target hardware. The table below compares the two.

    Dimension Inference Adaptation Training Adaptation
    Computation scope Forward operators Forward pass, backward pass, gradient computation, optimizer updates
    Memory usage Weights and KV cache Weights, gradients, optimizer states, activations
    Numerical precision Low precision is common, with higher error tolerance Must handle underflow and overflow and maintain convergence over the long term
    Communication pattern Tensor or expert parallel communication during inference Gradient synchronization, parameter aggregation, cross-node collective communication
    Acceptance metrics Output consistency, latency, throughput Loss curves, gradient norms, per-step time, uninterrupted long-running operation

    2. Memory Accounting: Why Distributed Training Is Required

    A single accelerator cannot hold the full training state of a model with nearly 3 trillion parameters. Take BF16 mixed precision with the Adam optimizer as an example. Each parameter typically needs about 16 to 20 bytes. These bytes cover the low-precision weights, the low-precision gradients, the FP32 master weights, and the first and second moments of Adam. At 16 bytes per parameter, the model states of a 3-trillion-parameter model require about 48 TB of memory. Activations, communication buffers, and memory fragmentation add to this total.

    Training must therefore rely on distributed techniques that spread parameters, gradients, and optimizer states across many devices. Memory requirements should be calculated item by item, based on the precision format, the optimizer type, and the parallel strategy. A single empirical multiplier is not enough.

    3. FSDP2 Sharding: Forward Pass, Backward Pass, and Resharding

    Fully Sharded Data Parallel (FSDP) splits parameters, gradients, and optimizer states into shards and places them on different devices. When the forward pass runs a given module, the system uses All-Gather to temporarily collect that module’s full parameters. After the computation finishes, the system releases the parts that do not belong to the local device. This keeps the peak memory footprint limited to a small set of full parameters.

    During the backward pass, the gradients computed on each device must be combined. FSDP uses Reduce-Scatter to sum the gradients of each parameter and write the results back to each device as shards. Compared with first using All-Reduce to get full gradients and then slicing them, this approach avoids the storage and transfer overhead of full gradients.

    Two points matter in practice. First, the scheduling unit is usually an FSDP sharding unit, such as a Transformer block, rather than an individual layer. Units that are too fine-grained increase the number of communication operations. Second, the specific interfaces change across framework versions. FSDP2 in PyTorch is built on DTensor, and a common usage is calling fully_shard on a module. Refer to the official documentation for the version you use for details.

    Multimodal models also include a vision encoder, a text encoder, a data pipeline, and alignment losses. FSDP2 only solves the parameter sharding problem. The memory use and data throughput of the other components need separate planning.

    4. Mixed Precision and Dynamic Loss Scaling

    Half-precision training saves memory and speeds up computation, but its representable range is limited. FP16 has fewer exponent bits, so small gradients can underflow to zero. Dynamic loss scaling addresses this. Before backpropagation, the loss is multiplied by a scaling factor. After the gradients are computed, they are divided by the same factor, which preserves small gradient values.

    If NaN or Inf values appear in the gradients, the update for that step is skipped and the scaling factor is halved. After several consecutive normal steps, the scaling factor is gradually increased again.

    BF16 has the same exponent width as FP32, so its range is wider. It usually does not need loss scaling. This does not mean BF16 is free of numerical risk. Accumulation precision, normalization layers, and certain operators still need attention. Whether to enable loss scaling should be decided by the framework configuration and measured results.

    5. Cross-Node Communication and Computation Overlap

    The communication path in cross-node training is more complex than in single-node training. Devices within a node communicate over PCIe or high-speed interconnects. Nodes usually depend on RDMA or RoCE networks to communicate with each other. The bandwidth and latency of these two types of links differ significantly. If the topology is poorly designed, communication becomes the bottleneck.

    A common optimization is overlapping computation with communication. While the backward pass computes one layer, the Reduce-Scatter for the gradients of the previous layer can start asynchronously. Network transfers then run in parallel with computation. In practice, monitor the share of total time spent on communication. If that share stays high over time, check the network topology, communication grouping, and sharding granularity.

    Timeout, retry, and checkpoint recovery policies for collective communication also need to be configured in advance. A network glitch on a single node should not cause the entire job to fail.

    6. Gradient Norm Monitoring and Anomaly Circuit Breaking

    The gradient norm is a common indicator of training health. If the norm suddenly rises or drops close to zero, the usual causes are a learning rate that is too high, anomalous samples in the data, or numerical overflow.

    The training system should record the gradient norm at every step and set thresholds for it. When the norm exceeds a threshold, gradient clipping can be applied first. If the anomaly keeps occurring, stop the job, roll back to the most recent usable checkpoint, and save the logs to help locate the problem. Circuit-breaker thresholds should be set based on model size and historical curves. Do not copy values directly from other tasks.

    7. Judging Whether a Training Validation Is Reliable

    A common mistake is to treat the results of a short run as proof of long-term stability. For example, a validation run that completes several hundred optimizer steps only shows that the configuration did not crash during that period. It does not show that the configuration will stay stable over tens of thousands of steps or several weeks of training.

    When reporting training validation results, include at least the following: model architecture and parameter count, sequence length, global batch size, precision format, parallel configuration (how data, tensor, pipeline, and sharding parallelism are partitioned), network environment, and framework and operator library versions. For metrics, report the loss curve, the gradient norm distribution, tokens processed per second, the share of time spent on communication, and the number of OOM, NaN, and Inf occurrences. Results can only be reproduced and compared when these conditions are complete.

    8. From Trainable to Production-Ready: An Engineering Checklist

    To make training capability reusable, teams need to turn their experience into a standard process. The following items can be used for internal acceptance:

    1. Operator validation: The numerical error between backward and forward operators falls within an acceptable range, and key operators have dedicated test cases.
    2. Parallel strategy: Scan different node counts and sequence lengths, record peak memory and throughput, and select a stable configuration.
    3. Numerical stability: Dynamic loss scaling thresholds, gradient clipping values, and NaN circuit-breaker rules are explicitly configured and logged.
    4. Fault recovery: Checkpoint intervals, recovery time, and data replay strategies have been tested through drills.
    5. Monitoring and alerting: Memory, communication, temperature, and job status are shown on a unified dashboard, and anomalies notify the responsible person promptly.
    6. Automation tools: Results from automatic parallel search and operator generation need manual spot checks before they are used in long-running training.

    Automation tools can reduce configuration effort, but they cannot replace validation. Engineers should keep the ability to judge key parameters themselves and prove that a configuration is reliable through reproducible tests.

    Moving Chinese-developed compute from inference to training requires building engineering experience in four areas at the same time: operators, communication, numerical handling, and operations. Each capability should have a clear measurement method and acceptance criteria.