Training Ultra-Large-Scale MoE Models on Domestic AI Accelerators: A Technical Deep Dive
An analysis of the technical challenges and engineering practices involved in adapting domestic AI compute infrastructure to train a 2.8-trillion-parameter flagship LLM, covering the memory wall, communication wall, and software ecosystem wall, along with the full FSDP2-based training pipeline from model loading to fault-tolerant checkpointing.
Training Ultra-Large-Scale MoE Models on Domestic AI Accelerators: A Technical Deep Dive
Background: Dual Challenges of Compute and Software Stacks
The recent open-source release of a flagship large language model with 2.8 trillion total parameters has drawn significant industry attention. Releasing a model at this scale is not just a demonstration of capability—it places severe demands on training and inference infrastructure. For domestic AI accelerators, successfully completing the full training adaptation of such a model is a key benchmark for software stack maturity and engineering capability.
Training ultra-large-scale models faces three core challenges:
- Memory wall: Single-card memory is far from sufficient to hold model parameters, optimizer states, and gradients, requiring multi-dimensional sharding and partitioning strategies;
- Communication wall: At the scale of thousands of accelerators, communication overhead from gradient synchronization and parameter aggregation easily becomes the bottleneck;
- Software ecosystem wall: Mainstream training frameworks and operator libraries are largely built around a single hardware ecosystem; heterogeneous compute requires a complete software stack for operator, communication library, and scheduling adaptation.
Overall Technical Path on the Training Side
A complete adaptation of ultra-large model training typically involves the following pipeline:
Model weight loading → Parameter/optimizer state sharding → Data pipeline→ Forward computation → Gradient computation and synchronization → Parameter update → Checkpoint resume
Every stage in this pipeline requires coordinated support from hardware and the software stack. Let’s examine each in detail.
2.1 Hardware Foundation: Training-Inference AI Accelerators
Training ultra-large models typically requires flagship-class AI accelerator cards with the following key characteristics:
- High memory capacity and bandwidth: To support parameter residency after sharding and high-throughput reads/writes;
- High-speed interconnect: Intra-node tensor parallelism and gradient aggregation over high-bandwidth interconnects, plus cross-node communication over high-speed NICs;
- Unified training and inference: The same hardware platform supports both training workloads and inference deployment, reducing total infrastructure cost.
2.2 Software Stack: Complete Support from Operators to Parallelism Strategies
Whether domestic accelerators can run training workloads hinges on the software stack. A mature stack needs to provide:
- A CUDA-like programming model and runtime for easy operator porting;
- High-performance communication libraries supporting collective primitives (AllReduce, AllGather, ReduceScatter, etc.);
- An integration layer with mainstream deep learning frameworks so training scripts can be migrated at low cost.
For example, when porting training code, device abstraction and communication backends typically only need unified encapsulation:
# Illustrative code: device and communication backend abstraction on heterogeneous computeimport framework as flfl.set_device("accelerator:0") # Abstract away underlying hardware differencesfl.set_comm_backend("hccl_like") # Specify the collective communication backendmodel = fl.compile(model) # Trigger graph optimization and operator fusion
The value of this abstraction layer is that upper-level training logic requires minimal changes, while hardware differences are absorbed at the lower layers.
FSDP2: The Engineering Value of Fully Sharded Data Parallelism
One of the highlights of this adaptation is the construction of a native FSDP2-based multimodal training path. It’s worth explaining how FSDP works.
3.1 Why Full Sharding Is Necessary
Traditional data parallelism (DP) requires every accelerator to hold a complete model copy—entirely infeasible for trillion-parameter models. FSDP (Fully Sharded Data Parallel) shards parameters, gradients, and optimizer states across all devices:
- During forward pass: Full parameters for the current layer are temporarily gathered via AllGather on demand and released immediately after computation;
- During backward pass: Parameters are gathered again to compute gradients, then gradients are sharded and reduced via ReduceScatter;
- During parameter update: Each device updates only its own shard.
Compared with earlier implementations based on callback hooks, FSDP2 adopts DTensor-based (distributed tensor) per-parameter sharding, offering finer sharding granularity, more precise memory management, and better integration with dynamic mixed-precision training.
3.2 Why a Multimodal Training Path Matters
Modern flagship models are often multimodal, trained on data that includes both text and images. A multimodal training path must address:
- Heterogeneous data processing: Data from different modalities requires unified loading, packing, and sequence concatenation strategies;
- Mixed precision and numerical stability: Vision encoders and language models have different precision sensitivities, requiring carefully tuned loss scaling and gradient clipping;
- Operator coverage: Multimodal models use a wider variety of operators, so the software stack must cover the full set—convolutions, attention variants, residual normalization, and more.
Three Key Stages in the Complete Training Pipeline
4.1 Model Loading
Weight files for a trillion-parameter model can reach several terabytes. The loading stage requires:
- Support for direct sharded loading, where each process reads and retains only its own shard, avoiding peak memory waste from loading the full model before splitting;
- Conversion and validation across multiple weight formats to ensure lossless precision.
4.2 Sharding Scheduling
Sharding strategy scheduling must balance memory efficiency against compute efficiency. Common practices include:
- Applying independent sharding to oversized single layers such as Embedding and LM Head;
- Controlling sharding granularity via wrapping strategies (per layer, per block);
- Combining activation checkpointing to reduce activation memory footprint.
# Illustrative: applying full sharding layer by layerfrom framework.distributed import fully_shardfor block in model.transformer_blocks:fully_shard(block) # Shard layer by layer for finer scheduling granularityfully_shard(model) # Global fallback sharding
4.3 Gradient Synchronization
The efficiency of gradient synchronization directly determines training throughput. Key engineering optimizations include:
- Communication-computation overlap: During backpropagation, layers that finish computing earlier initiate ReduceScatter first, hiding communication latency;
- Gradient accumulation: Accumulate gradients over multiple small batches before synchronizing, reducing communication frequency;
- Topology-aware communication grouping: Prioritize high-bandwidth intra-node interconnects, with hierarchical reduction across nodes.
Industry Significance and Outlook
Domestic compute completing the training adaptation of an ultra-large open-source model carries significance on three levels:
- Validated full software-hardware co-design: From operators and communication libraries to parallel frameworks, a reproducible, end-to-end training pipeline has been established;
- Lowered migration costs for domestic compute: Once the training path is proven, adaptations for smaller models can be replicated quickly;
- Accelerated adoption of unified training-inference architectures: The same AI cluster can flexibly split training and inference workloads, improving resource utilization.
Looking ahead, as automated sharding strategies, heterogeneous communication optimization, and fault-tolerant training mechanisms (such as automatic checkpoint resume and elastic scaling) mature further, the engineering capability of domestic compute in large model training will continue to improve, offering the industry more diverse compute options. For developers, understanding parallelization techniques like FSDP2 and the methodology of software stack adaptation is a key foundation for mastering ultra-large-scale model training.
