Training a 2.8-Trillion-Parameter Model on Domestic AI Accelerators: FSDP2 Adaptation and Key Techniques
How a 2.8-trillion-parameter large language model was adapted for training on domestic AI training-inference accelerator cards. This article breaks down the technical essentials: how FSDP2 fully sharded data parallelism reduces memory usage, how the full training pipeline—from model loading and shard scheduling to gradient synchronization—was made to work on a non-CUDA software stack, and how a natively built multimodal training path avoids bolt-on retrofits. It closes with a reusable methodology for adapting heterogeneous accelerators to large-scale distributed training.
Training Trillion-Parameter Models on Domestic AI Accelerators: FSDP2 Adaptation and Key Techniques
1. Background: Infrastructure Challenges of Ultra-Large-Scale Training
A flagship open-source large language model with 2.8 trillion total parameters was recently released. Training models at this scale places unprecedented demands on infrastructure:
- Memory bottleneck: Even flagship accelerators with 80GB of onboard memory cannot hold the weights, gradients, and optimizer states of a trillion-parameter model in training state. A rough estimate: with mixed-precision training, each parameter consumes about 16 bytes during training (weights, gradients, two types of optimizer momentum, plus a master weight copy). For 2.8 trillion parameters, static memory alone reaches tens of TB.
- Communication bottleneck: Once the model is sharded, parameter aggregation and gradient synchronization during forward and backward passes generate massive All-Gather and Reduce-Scatter traffic across nodes, placing strict requirements on interconnect bandwidth and communication topology.
- Software stack maturity: For domestic accelerators outside the mainstream CUDA ecosystem, operator coverage in training frameworks, distributed primitive implementations, and multimodal data pipeline adaptation all need to be resolved one by one.
Recently, a domestic AI chip vendor announced that it had completed training adaptation for this trillion-parameter model using its flagship training-inference accelerator card and self-developed general-purpose compute software stack, building a native FSDP2-based multimodal training path. This effort provides a valuable reference for “training ultra-large models on domestic compute.” This article dissects the key technical components.
2. Core Component One: FSDP2 Fully Sharded Data Parallelism
2.1 What Is FSDP2
The core idea of FSDP (Fully Sharded Data Parallelism) is to shard model parameters, gradients, and optimizer states across all data-parallel replicas, so each device holds only one shard of the overall state. When computation requires the full parameters, they are temporarily aggregated via All-Gather; after the forward/backward pass completes, non-local parameter shards are immediately released, reducing memory usage by an order of magnitude.
Compared with the first-generation implementation based on FlatParameter flattening, FSDP2 shards each parameter tensor directly along the device dimension (the DTensor approach), which brings three engineering advantages:
- Finer sharding granularity: Parameters no longer need to be merged into a single flat tensor, avoiding padding waste and reorganization overhead caused by differing parameter shapes.
- More natural composition with tensor parallelism and pipeline parallelism: Memory layouts are more predictable in nested parallelism, enabling static memory planning.
- Better friendliness to heterogeneous and domestic backends: Sharding logic is decoupled from physical devices; adapting to new hardware only requires implementing the corresponding distributed communication primitives.
2.2 Adaptation Points on Domestic Accelerators
Deploying FSDP2 on a non-CUDA backend typically involves the following:
# Example: typical FSDP2 wrapping approach (pseudocode)from torch.distributed.fsdp import fully_shardfor block in model.layers:fully_shard(block) # wrap layer by layer to control reassembly granularityfully_shard(model) # wrap the remaining parts as a whole
Key adaptation points include:
- Communication backend replacement: Replace NCCL dependencies with the collective communication library provided by the vendor’s software stack, ensuring semantic consistency and bandwidth efficiency for All-Gather, Reduce-Scatter, All-Reduce, and other primitives.
- Operator completeness: All operators on the paths FSDP2 depends on—parameter reassembly, hook registration, gradient accumulation—must be fully available on the target backend.
- Precision strategy validation: The numerical behavior of mixed precision (bf16 compute, fp32 master weights) on domestic cards must be verified through convergence experiments to ensure consistency with the reference implementation.
3. Core Component Two: Completing the Full Training Pipeline
“Completing training adaptation” means far more than getting the model to run—it requires a fully working pipeline from data to checkpoint saving. The pipeline elements described in this practice are worth examining one by one.
3.1 Model Loading
Loading a trillion-parameter model is itself a distributed problem. The sound approach is metadata first, lazy shard initialization: first build the model skeleton on CPU with low-precision or empty tensors, then initialize each shard directly on the target device according to the parallelism strategy, avoiding any point in time where the full model is materialized in one place.
3.2 Shard Scheduling
Shard scheduling determines peak memory usage and throughput. Problems to solve include:
- Sharding strategy selection: Apply per-layer sharding to the large matrix weights inside Transformer layers, while keeping replicas of small parameters (such as LayerNorm) to reduce communication frequency.
- Recomputation configuration: Use selective activation recomputation to drastically compress activation memory while keeping the added compute manageable.
- Heterogeneous tiering optimization: Offloading optimizer states to CPU memory is an optional option, but it introduces PCIe transfer overhead and requires a trade-off between throughput and memory.
3.3 Gradient Synchronization
After backpropagation, each replica performs Reduce-Scatter on sharded gradients so that each device receives only the aggregated gradients for the shard it owns; the optimizer then independently updates each shard. To improve efficiency, the following are typically layered on top:
- Gradient bucketing and communication-compute overlap: Bucket gradients in the order backward computation completes, and pipeline bucket-level communication to overlap with backward computation of subsequent layers.
- Communication quantization/compression (optional): In bandwidth-constrained scenarios, communicate gradients in bf16 or lower precision.
4. Core Component Three: A Natively Built Multimodal Training Path
This model is multimodal, so the training pipeline must handle text, vision, and other multi-source data. A “native” multimodal training path means it is not a bolt-on retrofit to a language-only training framework; instead, support is built in at the data pipeline level:
- Unified representation of heterogeneous data: Images, video frames, and text sequences are organized in a unified sample structure within the dataset, with distributed samplers ensuring load balance across replicas.
- Joint sharding of modality encoders and the language backbone: The vision encoder and language model are scheduled together under the same FSDP2 framework, avoiding “memory islands” that cannot be sharded.
- Parallelized preprocessing pipeline: CPU-intensive operations such as image decoding and augmentation are hidden behind GPU compute via multiprocessing and asynchronous prefetching, preventing data supply from becoming the bottleneck.
5. Methodology Takeaways: A General Path for Heterogeneous Compute Adaptation
This practice yields a general methodology for adapting domestic or heterogeneous compute to ultra-large models:
- Anchor on mature distributed paradigms: Align first with mainstream paradigms such as FSDP, tensor parallelism, and pipeline parallelism rather than inventing custom schemes, maximizing ecosystem reuse.
- Layer-by-layer validation: Validate progressively from single-card operator correctness, to single-node multi-card communication efficiency, to multi-node convergence—this minimizes debugging cost.
- Numerical consistency testing: Establish a loss-curve comparison baseline against the reference implementation; any precision strategy adjustment must pass convergence validation.
- Software-hardware co-design: Training adaptation is not purely a software problem. Topology-aware scheduling of collective communication and full utilization of network bandwidth often determine the ceiling of multi-node scaling efficiency.
6. Conclusion
Completing training adaptation for a 2.8-trillion-parameter model on domestic training-inference accelerators marks a substantive step forward for domestic software stacks in ultra-large-scale distributed training. For engineers, the value lies not only in the deployment of a single model, but in validating a reproducible path: build on native sharding schemes like FSDP2, complete the full pipeline of model loading, shard scheduling, and gradient synchronization, and integrate the multimodal data pipeline natively into the training framework. As the open-source ecosystem and domestic compute continue to mature together, training ultra-large models on heterogeneous accelerators is likely to evolve from “feasible” to “efficient and broadly accessible.”
