Training Trillion-Parameter MoE Models on Domestic AI Accelerators: A Practical Guide to FSDP2-Based Adaptation
As open-source large language models scale toward trillions of parameters and Mixture-of-Experts (MoE) architectures become the mainstream choice for flagship models, training infrastructure faces unprecedented challenges. This article examines how a 2.8-trillion-parameter open-source model was adapted for training on domestically developed AI accelerator cards with an integrated training-inference hardware and software stack, using a native distributed training framework. It covers the core challenges of trillion-parameter training, building a multimodal training path based on native FSDP2, hardware-software co-optimization, a representative training workflow, and practical lessons for teams undertaking similar efforts.
Training Trillion-Parameter MoE Models on Domestic AI Accelerators: A Practical Guide to FSDP2-Based Adaptation
As open-source large language models scale toward trillions of parameters, Mixture-of-Experts (MoE) architectures have become the mainstream choice for flagship models. The jump in model size places unprecedented demands on training infrastructure: no single accelerator can hold the full model in memory, cross-device communication overhead rises sharply, and every stage of the training pipeline requires careful engineering. Recently, an open-source flagship model at the 2.8-trillion-parameter scale emerged, and a domestic chip vendor completed training adaptation for it using its own AI accelerator cards with an integrated training-inference software stack, building a multimodal training path on a native distributed training framework. Against this backdrop, this article lays out a general methodology for adapting ultra-large models on domestic AI computing platforms.
Core Challenges of Trillion-Parameter Model Training
Before discussing adaptation strategies, it helps to understand the problem itself. A 2.8-trillion-parameter model occupies roughly 5.6TB of memory for parameters alone at FP16 precision; adding optimizer states, gradients, and activations, the total memory requirement during training often reaches several times—or even more than ten times—the parameter storage footprint. This far exceeds the physical capacity of any single accelerator, making distributed training the only viable path.
The challenges concentrate on three fronts:
- The memory wall: Parameters, gradients, and optimizer states together must be sharded across hundreds or even thousands of devices.
- The communication wall: All-to-All communication from expert routing and AllReduce communication from gradient synchronization can quickly dominate training time as cluster size grows.
- Engineering pipeline complexity: From model weight loading and tensor sharding to scheduling, execution, and gradient aggregation, any incomplete or missing component can prevent the training from converging—or from starting at all.
In essence, training adaptation means making the model definition, the parallelism strategy, and the underlying hardware and software stack work together efficiently.
Building a Multimodal Training Path on Native FSDP2
Fully Sharded Data Parallel (FSDP) is one of the dominant parallelism paradigms for large model training today. Its core idea is to shard model parameters, gradients, and optimizer states along the data-parallel dimension: each device holds only one shard of the full model, gathers the parameters it needs temporarily via AllGather before computation, and releases them immediately afterward, compressing memory usage to a nearly linearly scalable level.
The second generation of FSDP further strengthens fine-grained sharding along tensor dimensions and composable parallelism primitives, allowing it to combine flexibly with expert parallelism, tensor parallelism, and other strategies—a capability that is especially critical for MoE models. Building the training path on native FSDP2 means avoiding heavy customization patches and completing the adaptation along the framework’s standard extension points, which is essential for long-term maintainability.
A complete multimodal training path typically includes the following steps:
- Model loading and weight conversion: Weights of very large open-source models are usually distributed as sharded files. Adaptation starts by mapping the weight format and shard layout—writing a loader that correctly maps on-disk weight shards to the logical shards after FSDP partitioning, while handling the heterogeneous structure between multimodal modules (such as the vision encoder and the language backbone).
- Sharding and scheduling strategy: For MoE architectures, you must decide how to shard expert parameters versus non-expert parameters. A common approach is to apply standard FSDP sharding to dense layers, while placing expert layers in groups combined with expert parallelism (EP), so that All-to-All communication stays largely within a single node or a small network domain.
- Gradient synchronization pipeline: After backpropagation, the gradient shards held by each device are aggregated and re-sharded via ReduceScatter. During adaptation, you need to ensure these communication operators have efficient implementations on the domestic software stack and overlap well with computation, so that communication does not become the bottleneck.
Co-Optimizing Integrated Training-Inference Hardware and the Software Stack
Training adaptation is not just a framework-level task—it depends on the underlying hardware and software stack. An integrated training-inference accelerator design means the same hardware must serve both the high-bandwidth interconnect demands of training and the flexibility demands of inference, placing dual requirements on operator coverage and performance in the software stack.
At the software stack level, adaptation typically involves:
- Operator library completeness and tuning: Large model training relies heavily on matrix multiplications, normalization, attention, and routing-related operators. These must be implemented correctly and efficiently on the domestic instruction set architecture—especially the Grouped GEMM operator unique to MoE models, whose efficiency directly determines expert computation overhead.
- Communication library adaptation: Collective communication primitives such as AllGather, ReduceScatter, and All-to-All need to be optimized for the specific interconnect topology, exploiting the bandwidth difference between intra-node high-speed interconnect and inter-node networks through hierarchical communication strategies to reduce cross-node traffic.
- Memory management: Techniques such as activation checkpointing, pooled memory allocation, and pipelined overlap of communication and computation squeeze out larger batch sizes within limited memory.
Structure of a Typical Training Workflow
From an engineering perspective, the training entry code after adaptation typically takes the following logical shape (illustrative pseudocode, with interface details removed):
# 1. Initialize the distributed environment and parallel groupsinit_distributed(backend="native_comm")dp_group, ep_group = build_parallel_groups()# 2. Load and convert weights to the sharded layoutmodel = build_multimodal_moe_model(config)shard_weights(model, layout="fsdp2", ep_group=ep_group)# 3. Apply FSDP2 sharding wrappermodel = apply_fsdp2(model,reshard_after_forward=True,mixed_precision=bf16_policy)# 4. Build the optimizer (states sharded with parameters)optimizer = build_sharded_optimizer(model.parameters())# 5. Main training loopfor batch in dataloader:loss = model(batch)loss.backward() # Backpropagation + gradient ReduceScatteroptimizer.step()optimizer.zero_grad()
It is worth emphasizing that real-world engineering is far more complex than this sketch: mixed-precision policies, correct gradient clipping under sharded states, fault tolerance and resuming from checkpoints, and throughput monitoring and alerting are all indispensable parts of a complete training pipeline.
Value and Lessons from the Adaptation Work
Practices like this validate the feasibility of running frontier ultra-large model training on domestic hardware and software stacks, and they contribute a reusable methodology for the industry:
- Prefer the native framework path: Adapting along standard extension points rather than heavily modifying internals significantly reduces the cost of keeping up with upstream framework upgrades.
- Evaluate communication first: Before formal adaptation, run microbenchmarks to verify the actual collective communication bandwidth on the target cluster topology, and derive the parallelism strategy from those results.
- Validate convergence end to end: Getting the training to run is only the first step. You must verify the numerical correctness of sharding, routing, and gradient synchronization by aligning the loss curve against a reference implementation.
For enterprise users, when choosing training infrastructure, it is also worth checking whether the cloud platform provides supporting capabilities such as general-purpose container platforms, object storage, and monitoring and alerting to support deployment, data management, and stability for large-scale training jobs.
Conclusion
Training adaptation for trillion-parameter models is a systems engineering effort spanning parallelism strategy design, weight layout conversion, communication optimization, and hardware-software co-design. Experience from building complete training pipelines on native distributed training frameworks shows that domestic AI computing platforms already have the engineering foundation to take on frontier large model training. As the open-source model ecosystem and domestic hardware and software stacks evolve together, the engineering methodology in this area will continue to mature, offering actionable implementation paths for more teams.
