Adapting Trillion-Parameter Open-Source Models to Domestic AI Compute: A Training Practice Overview
This article covers the training adaptation of a 2.8-trillion-parameter open-source large language model on domestic Chinese AI accelerators. It explains the main challenges of training models at this scale, including memory, communication, and numerical stability. It also describes the FSDP2 training pipeline, from model loading and sharding to checkpointing, and a four-step method for adapting software to non-mainstream GPU ecosystems.
1. Background and Technical Significance
Recently, a 2.8-trillion-parameter flagship large language model was released as open source. This is another significant step for the open-source community toward very large parameter counts. Afterward, a Chinese AI accelerator vendor announced that it had completed training adaptation for this model. The work used its flagship AI accelerator card, which supports both training and inference, together with its in-house general-purpose computing software stack. The vendor also built a native FSDP2 (Fully Sharded Data Parallelism 2) multimodal training path. This path covers the full training workflow, from model loading and shard scheduling to gradient synchronization.
The technical significance of this work is clear: whether an ultra-large open-source model can train efficiently outside the traditional mainstream GPU ecosystem is an important measure of how well domestic compute hardware and software work together. At the trillion-parameter scale, the training system faces more than a memory capacity problem. It must also coordinate computation, communication, and storage as one system.
2. Core Challenges of Training Ultra-Large Models
1. The Memory Wall
Take a trillion-parameter model trained with mixed precision as an example. Each parameter typically requires 2 bytes for weights and 2 bytes for gradients, plus several bytes for optimizer states. For AdamW, the optimizer keeps first and second moments, usually stored in FP32. A rough estimate:
Memory usage ≈ number of parameters × (2 + 2 + 4 + 4 + 4) bytes≈ 2.8T × 16 bytes ≈ 44.8 TB
This far exceeds the total memory of a single accelerator or a single multi-accelerator node. The state must be split across the whole cluster using multi-level sharding strategies.
2. Communication Bottlenecks
Sharding the model, gradients, and optimizer states across devices requires frequent collective communication operations, such as All-Gather and Reduce-Scatter. When computation and communication cannot overlap effectively, the cluster’s Model FLOPs Utilization (MFU) drops significantly. Bandwidth between nodes is usually lower than bandwidth within a node, so topology-aware scheduling is essential.
3. Numerical Stability
Training very large models is highly sensitive to details such as the mixed-precision policy, loss scaling, and gradient clipping. Small numerical errors can accumulate over tens of thousands of iterations and cause training to diverge.
4. Ecosystem Compatibility
Training code for mainstream open-source models is typically tied closely to specific GPU ecosystems, such as CUDA, NCCL, and their operator libraries. Training on other hardware requires that operator coverage, communication library behavior, and framework semantics match closely.
3. Key Technical Points of the FSDP2 Training Path
FSDP (Fully Sharded Data Parallelism) is one of the most widely used memory optimization techniques in large model training. Compared with the first generation, FSDP2 manages sharding at the per-parameter level, which gives it more flexibility and composability. Building a native FSDP2 training path typically involves the following steps.
1. Model Loading and Shard Initialization
The weight files of very large models can reach tens of terabytes. Loading them onto a single node and then splitting them is not feasible. The standard approach is meta device initialization. The model skeleton is built on a “meta” device without allocating real memory. Then each parameter block is loaded onto its target device according to the sharding plan.
# Illustrative code: meta device initialization and shardingwith torch.device("meta"):model = build_model(config) # Builds the structure only, no device memory allocatedfsdp_model = fully_shard( # Shards per parametermodel,sharding_strategy=ShardingStrategy.FULL_SHARD,mixed_precision=MixedPrecisionPolicy(param_dtype=torch.bfloat16,reduce_dtype=torch.float32,),)load_state_dict_per_shard(fsdp_model, ckpt_paths) # Each shard is loaded independently
This approach reduces loading time from hours to minutes. It also avoids the memory spike that occurs when the full model is loaded at once.
2. Shard Scheduling and Computation-Communication Overlap
During each forward and backward pass, sharded parameters are temporarily gathered (All-Gather) and released right after the computation finishes. Key optimizations include:
- Prefetching: While the current layer is computing, the sharded parameters for the next layer are fetched asynchronously, so communication time is hidden behind computation.
- Layer-level wrapping: Shard units follow the Transformer layer structure. This balances peak memory against communication granularity.
- Gradient reduction bucketing: Gradients produced during backpropagation are grouped into buckets and reduced with Reduce-Scatter. Gradient clipping values are precomputed during this process.
3. Optimizer States and Checkpoint Management
The optimizer states of a trillion-parameter model alone require tens of terabytes of storage. Sharded optimizers ensure that each device holds only the momentum and variance values for its own shard. Checkpoints are saved in sharded form, with each device writing its portion in parallel. Restoring a checkpoint does not require a global reassembly. For long training runs, fault tolerance also typically depends on asynchronous checkpointing and automatic resume from the last checkpoint.
4. A Methodology for Hardware-Software Adaptation
Adapting training to a non-mainstream GPU ecosystem generally follows a four-step process:
- Operator coverage and equivalence verification: Verify the numerical accuracy and performance of every operator the model uses, including attention, LayerNorm, RMSNorm, and various fused operators. Identify long-tail operators, then implement or optimize them as needed.
- Communication library integration: Map the framework’s collective communication abstraction to the underlying communication library. Confirm that operations such as All-Gather and Reduce-Scatter behave consistently, and tune bandwidth usage for the hardware topology, including intra-node interconnects and inter-node networks.
- Small-scale end-to-end validation: Run training end to end at small scale first. Compare the loss curve and gradient norms with a reference implementation to confirm consistent convergence.
- Scale-up validation: Gradually increase the cluster size. Verify scaling efficiency, checkpoint recovery, and stability over long runs.
Loss curve alignment is the most important acceptance criterion. Given the same data and hyperparameters, training curves on different hardware stacks should stay within the range of random seed noise. This is the evidence that the adaptation is correct.
5. Lessons for the Industry
This practice shows that the domestic compute ecosystem is moving from inference support to training capability, and from single-operator support to full end-to-end integration. For technical teams, several points stand out:
- Abstraction layer design: The better the framework’s device and communication abstractions, the lower the cost of hardware adaptation.
- Combining sharding strategies: FSDP, tensor parallelism, pipeline parallelism, and context parallelism are not mutually exclusive. They should be combined flexibly based on model structure and cluster topology.
- Verifiability first: Any ultra-large training effort should have a complete test system, from single-device numerical checks to multi-node convergence validation.
As open-source models at this scale continue to appear, the ability to adapt to heterogeneous compute ecosystems will become a key infrastructure capability that determines how quickly models can be deployed. Standardized and reproducible adaptation methods have broad value for the industry, because they lower the barrier to training large models.
