Training Trillion-Parameter Models on Domestic AI Accelerators: A Deep Dive into the FSDP2 Distributed Training Pipeline
A 2.8-trillion-parameter open-source model has raised a practical question for the AI community: how to train, fine-tune, or continue pretraining such a model on your own hardware. This article examines how a domestic AI chip vendor completed training adaptation for this massive model using its flagship training-and-inference accelerator and in-house software stack, built around a native FSDP2 multimodal training path. It covers why sharding is essential at this scale, the end-to-end training pipeline from model loading to gradient synchronization, and the key engineering challenges of adapting custom accelerator software stacks.
1. Background: The Training Challenge of Trillion-Parameter Open-Source Models
A major LLM research team recently open-sourced a flagship model with a total of 2.8 trillion parameters. Once a model at this scale is released, the first question facing the community and industry is: how do you train, fine-tune, or continue pretraining it on your own compute infrastructure?
For the general-purpose GPU ecosystem, mainstream deep learning frameworks already offer mature distributed training solutions. For domestic AI chips, however, supporting trillion-parameter training requires systematic adaptation across multiple layers: operator coverage, communication optimization, memory management, and software stack compatibility. Recently, a domestic AI chip vendor announced that, based on its flagship training-and-inference accelerator and proprietary software stack, it had completed training adaptation for this ultra-large model and built a native FSDP2 multimodal training path. This practice provides a valuable reference for “running ultra-large model training on domestic compute.”
2. Why Ultra-Large Model Training Requires Sharding
2.1 The Conflict Between Parameter Scale and Memory
A simple estimate illustrates the problem: with 2.8 trillion parameters trained in mixed precision (FP16/BF16 weights plus FP32 master weights), the memory required for model states alone reaches tens of terabytes—far beyond the capacity of a single card or even a single machine. On top of that, training also requires storing optimizer states, gradients, and activations.
Traditional data parallelism (DDP) requires every card to hold a complete model replica, which is entirely infeasible at the trillion-parameter scale. The industry has therefore widely shifted to Fully Sharded Data Parallelism (FSDP).
2.2 The Core Idea of FSDP
FSDP works as follows:
- Model parameters, gradients, and optimizer states are sharded across multiple devices;
- During forward and backward passes, when computation reaches a module, the shards needed by that module are temporarily aggregated via all-gather;
- Non-local shards are released immediately after computation to reduce resident memory usage;
- After the backward pass completes, gradient shards are synchronized via reduce-scatter.
Taking the PyTorch ecosystem as an example, FSDP2, the newer implementation, performs per-parameter sharding based on DTensor. Compared with earlier versions, it offers clear improvements in sharding granularity, ease of use, and composability with other parallelism techniques. This is why the adaptation chose “native FSDP2” as the key pillar of the training path.
3. From Model Loading to Gradient Synchronization: Breaking Down the Full Training Pipeline
The notable aspect of this adaptation work is not a single-point optimization, but an end-to-end pipeline covering model loading, shard scheduling, and gradient synchronization. We can break this pipeline down into four key stages.
3.1 Model Loading and Weight Sharding
Loading an ultra-large model is a challenge in itself. If you instantiate the full model in CPU memory before sharding it, peak memory remains enormous. The common industry approach is meta-device initialization: first build the model skeleton on a meta device without actually allocating memory, then load weight shards using a sharded state dict. Here is illustrative code:
import torchfrom torch.distributed.fsdp import fully_shardwith torch.device("meta"):model = build_model(model_config)# Apply sharding to each transformer layerfor layer in model.layers:fully_shard(layer)# Shard the embedding and output layers separately to avoid overly large aggregation unitsfully_shard(model.embed_tokens)fully_shard(model.lm_head)fully_shard(model) # catch-all for the root module
This layer-by-layer sharding approach significantly reduces transient memory peaks during all-gather aggregation and is a common best practice for ultra-large model training.
3.2 Shard Scheduling and Compute-Communication Overlap
The core problem shard scheduling must solve is: when to communicate, when to compute, and whether the two can overlap. Ideally, while the all-gather fetches parameters for the current layer, the GPU can simultaneously compute operators from the previous batch that are already ready. The adaptation work must ensure tight coordination between the underlying communication library and the computation graph scheduler, so that communication does not become idle waiting in the pipeline.
3.3 Gradient Synchronization
During backward propagation, each device performs reduce-scatter on locally computed gradient shards, producing globally consistent sharded gradients. This step also needs to overlap with computation, and small parameters should be bucketed for aggregation to improve bandwidth utilization.
3.4 Multimodal Path Adaptation
The original work mentions building a “native FSDP2 multimodal training path.” Multimodal large models typically consist of a vision encoder, projection layers, and a language model backbone, with vastly different parameter scales across modules. Using a uniform sharding granularity would make the communication overhead of small modules disproportionately large. Different modules therefore require different sharding strategies and aggregation granularities—this is precisely what makes multimodal training adaptation more complex than pure language model training.
4. Engineering Essentials for Training-and-Inference Accelerator Adaptation
For a proprietary chip software stack, completing a trillion-parameter training adaptation typically requires tackling the following categories of problems:
- Operator completion and precision validation: New and fused operators in the model must be implemented on the custom architecture and validated through numerical alignment.
- Framework backend integration: Making the distribution strategies of mainstream training frameworks (such as FSDP2, tensor parallelism, and pipeline parallelism) execute correctly on custom devices often involves deep modifications to the device abstraction layer and collective communication library.
- Stability validation: Large-scale, thousands-of-cards cluster training requires long-running loss alignment tests and fault-tolerance mechanisms to ensure correct gradient synchronization and uninterrupted training.
- Performance tuning: This includes operator fusion, communication compression, and memory optimization to bring throughput to a usable level.
5. Conclusion and Takeaways
This case shows that the maturity of the domestic compute ecosystem is advancing from “capable of inference” to “capable of training ultra-large models.” For developers, understanding the principles and engineering details of sharding techniques like FSDP2 is a foundational skill for participating in large model training, regardless of which compute platform you use. As open-source ultra-large models continue to emerge, cross-hardware training adaptation capability will become one of the core competencies in enterprise AI infrastructure. A practical recommendation: start with sharding experiments on small- to mid-sized models, and gradually build expertise in shard strategy tuning, communication analysis, and precision alignment.
