Adapting Large Model Training to Domestic GPUs: From Running to Stable Training

    This article explains why inference adaptation differs from training adaptation on domestic AI chips. It covers the technical requirements of large model training, including FSDP-based distributed training, numerical stability validation, and the engineering practices needed to move from basic runnability to stable, repeatable training.

    Adapting Large Model Training to Domestic GPUs: From Running to Stable Training

    Introduction: Training Adaptation Is Not Inference Adaptation

    In recent years, domestic AI chips have developed quickly, and news reports about “Day 0 adaptation of an open-source large model to a chip” have become common. However, one common misconception needs clarifying: a successful adaptation or integration does not mean the model was pretrained on that chip.

    Most so-called adaptations in the industry stop at the inference level. That means verifying that a model can run forward computation on the hardware and produce correct outputs. Inference adaptation usually requires only operator completeness and numerical alignment, so the workload is relatively manageable. Training adaptation is fundamentally different. The hardware and software stack must support a complete loop of forward computation, backpropagation, gradient synchronization, and parameter updates, and it must stay numerically stable over long runs. Moving from “can run inference” to “can train” is a major step in capability. It is also the core measure of how mature a domestic computing platform is.

    This article covers the key technical steps and engineering practices for completing training adaptation of frontier large models on domestic GPUs.

    1. What Training Adaptation Involves

    Training adaptation means that a large model can complete the full training workflow on the target hardware platform. This includes:

    • Model loading and weight initialization: Support for loading weights in mainstream model formats, reading shards, and distributing them on demand.
    • Forward and backward computation: All operators in the model, including attention, normalization, and mixed-precision computation, are correctly implemented on the target platform, and backward gradient computation meets accuracy requirements.
    • Distributed parallel scheduling: Data parallelism, tensor parallelism, pipeline parallelism, and expert parallelism work correctly together across multiple cards and multiple machines.
    • Gradient synchronization and optimizer updates: Cross-device gradient aggregation communicates correctly, and optimizer state management and parameter updates remain numerically stable.
    • Fault tolerance and stability: Long training runs do not produce memory leaks, numerical overflow (loss values of NaN or Inf), or unexpected interruptions.

    Consider mixture-of-experts (MoE) models at very large scale. Their parameter counts reach trillions, and training involves fine-grained expert parallelism (EP). Different experts are placed on different devices, and tokens must be routed between devices through All-to-All communication. This places high demands on operator capability, collective communication performance, and the scheduling ability of the software stack. Completing training adaptation for such a model means the platform has a working training path, from model loading and shard scheduling to gradient synchronization.

    2. Core Path for Distributed Training: Native FSDP

    For models whose parameter counts far exceed the memory of a single card, fully sharded data parallelism (FSDP) is the mainstream training approach in the industry. Its core idea is to shard parameters, gradients, and optimizer states across devices. Each device holds only a portion of the full state and gathers the parameters it needs through communication during computation.

    Building a native FSDP training path on domestic GPUs requires attention to several engineering areas.

    Sharding Strategy and Memory Planning

    Shard granularity directly affects the balance between memory usage and communication overhead. In practice, engineers need to use the model structure (number of layers, hidden dimension, number of experts) and the device memory capacity to calculate the sharded memory footprint of parameters, gradients, and optimizer states for each layer. They must also reserve space for activations and communication buffers. An illustrative memory estimate looks like this:

    1. # Memory footprint estimate (mixed-precision training, Adam-style optimizer as an example)
    2. # Parameters: 2 bytes (bf16), gradients: 2 bytes, optimizer states: 8 bytes (fp32 first and second moments)
    3. bytes_per_param = 2 + 2 + 8 # about 12 bytes per parameter without sharding
    4. sharded_bytes = bytes_per_param * total_params / world_size
    5. activation_bytes = estimate_activation(batch_size, seq_len, hidden_size)
    6. total = sharded_bytes + activation_bytes + comm_buffer
    7. assert total < device_memory_capacity * 0.9 # keep a safety margin

    Overlapping Communication and Computation

    The performance of FSDP depends on overlapping parameter gathering (AllGather) and gradient reduction (ReduceScatter) with computation, so communication does not become the bottleneck. This requires the underlying communication library to support the interconnects of domestic GPUs, both high-speed links within a machine and networks between machines. The framework layer also needs a sensible prefetch schedule.

    Multimodal and Long-Sequence Support

    In multimodal models, the vision encoder and the language model have very different computational characteristics. Sharding and parallelism strategies must be designed separately for these heterogeneous submodules. Long-sequence training also needs sequence parallelism and activation recomputation to keep memory usage under control.

    3. Numerical Stability Validation: 400 Steps Is Only a Starting Point

    Whether a training adaptation succeeds depends on whether the numerical behavior is correct, not only on whether the program runs. The industry commonly uses the following validation methods:

    1. Loss alignment: With the same data and random seed, the loss curve on the target platform should follow a downward trend consistent with a reference platform, such as a mainstream GPU, over the first several hundred steps. Any deviation should stay within a reasonable tolerance.
    2. Gradient norm monitoring: Track gradient norms throughout training to confirm they stay finite and steady, without abnormal spikes.
    3. Overflow checks: In mixed-precision training, monitor changes in the loss scale to confirm there is no persistent gradient overflow that keeps forcing fallbacks.
    4. Continuous stability testing: For example, run a joint training job across two machines with 16 cards in total, and let all training processes complete several hundred optimizer updates in a row. Verify that loss and gradient norms stay finite throughout, with no numerical overflow or unexpected interruptions.

    A few hundred steps of continuous stable operation verify the correctness and short-term stability of the pipeline. Real pretraining requires long-running jobs of tens of thousands to hundreds of thousands of steps. Those runs place greater demands on hardware failure rates, checkpointing mechanisms, and automatic recovery. In practice, teams usually also need:

    • Frequent, low-overhead checkpoint saving and fast recovery.
    • Full-stack monitoring and alerting for training metrics, including loss, gradient norm, throughput, memory, temperature, and power consumption.
    • Automatic isolation of faulty nodes and elastic restart of training jobs.

    4. From “Can Train” to “Train Out of the Box”: Building an Engineering System

    A single successful model adaptation is only the first step. The platform’s real value lies in reusable engineering systems. A mature large model training platform should provide the following:

    Operator layer: Coverage of all operators required by mainstream model architectures, with automatic operator fusion and automated precision alignment tests. When a new model appears, only a small number of operators should need to be added.

    Parallelism layer: A unified abstraction for data, tensor, pipeline, expert, and sequence parallelism. It should recommend parallel configurations automatically based on model size, which lowers the tuning burden for users.

    Toolchain layer: Automated tools for training job orchestration, distributed debugging, performance profiling, and communication bottleneck analysis. These tools make training efficiency problems observable, traceable, and optimizable.

    Ecosystem compatibility layer: Compatibility with mainstream deep learning frameworks and distributed training interfaces. This allows existing training scripts to move to domestic platforms with minimal changes, which is essential for reducing migration costs for developers.

    Based on practical results, domestic computing platforms have started to support pretraining from scratch for scientific foundation models with tens of billions of parameters. They also support full training workflows for newer model paradigms, such as world models and embodied AI models, and they are moving toward training trillion-parameter models. This progression shows that the large model training capability of domestic GPUs is advancing in three stages: from single-point validation to large-scale production use, from “can train” to “stable training,” and from there to “train out of the box.”

    5. Recommendations for Developers

    For developers and teams that plan to train large models on domestic computing platforms, the following path is recommended:

    1. Run inference before training. First verify operator completeness and numerical accuracy through inference deployment, then move to training adaptation.
    2. Scale up step by step. Progress from a single card, to multiple cards on one machine, to multiple machines. Perform numerical alignment validation at each stage.
    3. Invest in monitoring early. Build a complete metrics monitoring system at the start of training. The earlier numerical anomalies are found, the lower the cost of troubleshooting.
    4. Validate checkpoints first. Before any long-running training job, verify that checkpoint saving and restoring are reliable. This is the foundation of fault tolerance.

    Conclusion

    Training adaptation for large models is a necessary test for domestic AI chips as they mature. Compared with inference adaptation, it covers a longer technical chain, involves greater engineering complexity, and sets stricter stability requirements. As operator ecosystems, distributed parallel frameworks, and automated toolchains continue to improve, the barrier to training frontier large models on domestic full-featured GPUs will keep falling. Training domestic models on domestic chips will move from technical validation toward large-scale industrial practice, giving the domestic large model industry a diverse and controllable compute foundation.