Adapting Trillion-Parameter Model Training on a Chinese-Built AI Compute Platform: A Practical Guide
This article explores the end-to-end methodology for adapting trillion-parameter-scale open-source model training on a Chinese-developed training-and-inference AI compute platform. It covers why training adaptation is a systems engineering problem spanning operators, parallelism strategies, memory management, and reliability; how a native FSDP2-based multimodal training pipeline works across model loading, sharding scheduling, execution, and gradient synchronization; and the engineering practices required for checkpointing, fault recovery, and numerical validation. The goal is to distill hardware-agnostic lessons useful to any team working on large-scale model training infrastructure.
Adapting Trillion-Parameter Model Training on a Chinese-Built AI Compute Platform: A Practical Guide
1. Background: Training Infrastructure Challenges in the Trillion-Parameter Era
In recent years, the parameter counts of open-source large models have continued to climb. Flagship open-source models with parameters in the multi-trillion range have been released, with Mixture-of-Experts (MoE) architectures becoming the mainstream choice. Although these models control per-forward compute through sparse activation, their enormous total parameter counts pose unprecedented challenges for training infrastructure: a single accelerator’s memory is far from sufficient to hold the full model, cross-node communication overhead is enormous, and any weakness in the training pipeline is amplified at scale.
At the same time, diversification of compute supply has become an industry consensus. More and more enterprises and research institutions are paying attention to building large-model training capability on Chinese-developed training-and-inference AI accelerators and their accompanying software stacks. Recently, a Chinese GPU vendor announced that, based on its flagship training-and-inference accelerator and self-developed software stack, it completed training adaptation for one of these multi-trillion-parameter open-source flagship models. The work built a native FSDP2 multimodal training path and connected the complete training pipeline from model loading and shard scheduling to gradient synchronization. This article uses that work as a starting point, strips away product specifics, and examines the complete methodology for ultra-large-scale model training adaptation from a general technical perspective.
2. Why Training Adaptation Is a Systems Engineering Problem
Many people interpret “adaptation” as “making the code run,” but at trillion-parameter scale that is far from enough. A complete training adaptation must answer questions at four levels.
First, the operator and precision level. Attention variants, normalization methods, positional encodings, expert routing, and other operators used by the model need efficient implementations on the target hardware. For newly architected compute platforms, core operators often require deep optimization, and numerical stability under mixed-precision training (such as BF16) must be carefully verified to ensure loss curves match the reference implementation.
Second, the parallelism strategy level. Trillion-parameter models require combining multiple parallelism techniques: data parallelism (DP), tensor parallelism (TP), pipeline parallelism (PP), expert parallelism (EP), and sequence parallelism (SP). Choosing the optimal combination given the target cluster’s topology (intra-node interconnect bandwidth, inter-node network bandwidth) directly determines the ceiling of training throughput.
Third, the memory level. In MoE models, expert parameters occupy the vast majority of memory, while activations are also significant under long-sequence and multimodal inputs. Memory budgets must be managed carefully through sharding, recomputation, and offloading.
Fourth, the engineering reliability level. Over training cycles lasting weeks or even months, fault recovery, checkpoint resume, and anomaly detection are not optional — they are mandatory.
3. The Core Path: A Multimodal Training Pipeline Based on Native FSDP2
The technical highlight of this adaptation is the use of a native FSDP2 (Fully Sharded Data Parallel, second generation) route to build the multimodal training path. Understanding this choice requires understanding how FSDP2 evolves beyond the previous generation of sharding approaches.
3.1 Key Improvements in FSDP2
The core idea of FSDP is to shard model parameters, gradients, and optimizer states across the data-parallel dimension, so that each device holds only one slice of the full state. During forward and backward computation, complete parameters are temporarily aggregated (all-gathered) on demand via collective communication and released immediately after use. FSDP2 introduces two important changes on top of this:
- Sharded tensors as first-class citizens: parameters change from flat, sliced blocks into tensor objects carrying sharding semantics, allowing sharded state to be freely composed with other parallelism dimensions (such as tensor parallelism and expert parallelism) into a unified multi-dimensional parallelism abstraction.
- More flexible on-demand materialization control: through finer-grained prefetch and release scheduling, the overlap window between communication and computation is larger, thereby amortizing communication overhead.
For MoE architectures, the value of FSDP2 is particularly pronounced: expert parameters can be sharded along the expert dimension combined with expert parallelism, while dense parts (attention layers, shared layers) use standard sharded data parallelism — with both strategies coordinating within the same framework.
3.2 The Four Stages of the Complete Training Pipeline
The adaptation connected the complete pipeline from model loading to gradient synchronization, which can be broken down into the following stages:
1. Model loading and initialization. A trillion-parameter model cannot be fully instantiated on any single device. In practice, a “meta-device initialization + distributed loading” pattern is used: the model structure is first built on a meta device with no actual memory allocation, the sharding layout of each parameter is determined, and then each parallel group reads only the shard data it is responsible for from the checkpoint. This not only compresses loading time from hours to minutes, but also avoids memory spikes during loading.
2. Shard scheduling. For multimodal models, the vision encoder and the language model differ significantly in compute density and memory characteristics. A sound approach is to apply differentiated sharding and recomputation strategies to different submodules: fully shard parts that are parameter-dense with small activations, and layer selective activation recomputation onto parts with large activations, trading a small amount of extra compute for memory headroom.
3. Forward/backward execution and communication overlap. During training steps, parameter-gathering communication should overlap with preceding computation as much as possible, and gradient reduction (reduce-scatter) should overlap with subsequent backward computation. The scheduler needs to generate a prefetch plan based on inter-layer dependencies and use a separate communication stream to avoid blocking the compute stream.
4. Gradient synchronization and optimizer update. After all gradients complete sharded reduction, the sharded optimizer (such as a distributed implementation of an Adam variant) performs updates on its local slice, after which parameters are re-aggregated for the next forward pass. This stage must also handle details such as global norm computation for gradient clipping and loss scaling under mixed precision.
Below is an illustrative sharding configuration skeleton (with framework- and product-specific references removed):
# Illustrative code: multi-dimensional sharded training configuration skeletonfrom dataclasses import dataclass@dataclassclass ShardingPlan:dp_size: int # data parallelism degreetp_size: int # tensor parallelism degreeep_size: int # expert parallelism degreereshard_after_forward: bool = True # release gathered parameters right after forwardoffload_optimizer: bool = False # whether to offload optimizer statesdef apply_sharding(model, plan: ShardingPlan, mesh):for name, module in model.named_modules():if is_moe_expert(module):# Expert parameters: two-dimensional sharding across expert + data dimsshard(module, mesh, dims=("ep", "dp"))elif is_dense_block(module):# Dense layers: standard full shardingfully_shard(module, mesh, dim="dp",reshard_after_forward=plan.reshard_after_forward)return model
4. Special Considerations for Multimodal Training
Compared with pure-text training, multimodal model training presents several additional difficulties. First, the heterogeneity of the data pipeline: decoding and preprocessing image and video samples costs far more than text, and insufficient preprocessing throughput will directly drag down overall training efficiency. The data pipeline must be asynchronously decoupled from the main training loop, paired with sufficient caching and prefetching. Second, strong fluctuation in sequence length: sequences assembled from samples of different modalities vary drastically in length, so fixed-shape bucketing and packing strategies have a major impact on memory utilization and load balancing. Third, desynchronized training rhythms across submodules: the vision encoder and the language backbone often need differentiated learning rates, freezing strategies, and even precision strategies, so the sharding framework must support per-module optimizer parameter groups.
5. Engineering Practices for Stability and Efficiency
After achieving “it can train,” “training well and stably” depends on a series of engineering measures:
- Checkpoint resume: use sharded checkpoints where each device saves only its local slice, so save and restore times scale nearly linearly with cluster size; also support asynchronous writes to disk to avoid blocking the main training loop.
- Fault detection and fast recovery: build automated monitoring and alerting for communication timeouts, memory anomalies, and loss spikes, and combine health checks to locate faulty nodes and automatically remove and reschedule them.
- Performance profiling: use the profiling capabilities provided by the software stack to identify layers with imbalanced communication-to-compute ratios, and adjust parallel partitioning or prefetch depth accordingly.
- Numerical alignment validation: aligning loss curves and gradient norms with the reference implementation on small-scale proxy configurations is the most economical way to verify adaptation correctness.
6. Conclusion and Outlook
Completing training adaptation of a multi-trillion-parameter open-source model on a Chinese-developed training-and-inference compute platform marks a key step forward in the maturity of the domestic AI infrastructure software stack. The core lessons can be summarized as follows: use next-generation sharded parallelism frameworks such as native FSDP2 as the skeleton, use multi-dimensional parallelism combinations to handle the complexity of MoE architectures, and use full-pipeline engineering — loading, scheduling, execution, synchronization — to guarantee training efficiency and stability. For developers at large, this methodology has broad reference value: regardless of how the underlying hardware evolves, “the right parallelism abstraction + rigorous numerical validation + a complete fault-tolerance system” remain the three pillars of landing ultra-large-scale model training. As hardware-software co-optimization continues to deepen, the ability of Chinese-built compute platforms to take on larger-scale and more complex multimodal training tasks is worth watching.
