Training Trillion-Parameter Multimodal Models on Domestic AI Accelerator Cards: FSDP2 Adaptation Practices
Training trillion-parameter multimodal models on domestic AI accelerator cards requires addressing memory capacity, MoE scheduling, and multimodal pipeline coupling at the same time. This article outlines an adaptation practice for a 2.8-trillion-parameter open-source MoE multimodal model using a native FSDP2 training path. It covers meta-device initialization and sharded checkpoint loading, combinations of FSDP, expert parallelism, tensor parallelism, and sequence parallelism, as well as gradient synchronization with communication-computation overlap. It also discusses software-stack support across operators, collective communication, and framework integration, and validation through numerical consistency, scaling efficiency, and long-run stability. The goal is to share engineering methods for building end-to-end training pipelines for ultra-large models on domestic compute foundations.
Training Trillion-Parameter Multimodal Models on Domestic AI Accelerator Cards: FSDP2 Adaptation Practices
I. Background: New Challenges in Ultra-Large-Scale Model Training
In recent years, the parameter scale of large language models has continued to rise, moving from tens of billions and hundreds of billions of parameters toward sparse mixture-of-experts (MoE) architectures with trillions of parameters. Recently, the industry open-sourced a flagship model with 2.8 trillion total parameters. It adopts an MoE architecture and multimodal capabilities, representing the current technical frontier of open-source models. At the same time, a domestic GPU vendor completed training adaptation for this model based on its flagship AI training-and-inference accelerator card and self-developed software stack. The vendor built a native FSDP2 multimodal training path and connected the complete training chain from model loading and shard scheduling to gradient synchronization.
The significance of this progress is not only that a single model can run, but also that it validates the feasibility of carrying trillion-parameter model training on a domestic compute foundation. For developers, understanding the technical methodology behind this kind of adaptation is more valuable than focusing on specific model numbers. Below, we break down the core steps of this adaptation work from an engineering perspective.
II. Why Trillion-Parameter Model Training Is So Difficult
1. Hard Memory Capacity Constraints
For a 2.8-trillion-parameter model, even when stored in BF16 precision, the parameters alone require about 5.6 TB of memory. Adding optimizer states (with a common Adam-style optimizer, typically 8–12 times the parameter size), gradients, and activations, the overall memory demand can easily exceed tens of terabytes. A single card usually has tens of GB to more than one hundred GB of memory, which means the model must be split across hundreds or even thousands of cards for collaborative training.
2. Scheduling Complexity of MoE Architecture
In an MoE architecture, each token activates only part of the expert networks. Although the number of activated parameters may be only tens of billions, all expert parameters still need to reside in memory. This adds extra dimensions to parallel strategy design: beyond traditional data parallelism, tensor parallelism, and pipeline parallelism, teams also need to consider routing balance in expert parallelism, cross-node communication overhead, and the “bucket effect” caused by uneven load.
3. Pipeline Coupling of Multimodal Data
Multimodal models usually include a vision encoder, a projection layer, and a language model backbone. The computational characteristics of these parts differ significantly: the vision part is compute-intensive but has relatively concentrated parameters, while the language backbone has huge parameters and uses sparse activation. The training pipeline must handle preprocessing, feature alignment, and gradient backpropagation timing for different modalities. Any blockage in one stage will slow down overall throughput.
III. Design Highlights of the Native FSDP2 Training Path
Fully Sharded Data Parallel (FSDP) is one of the mainstream approaches for ultra-large-scale model training. The new generation, FSDP2, refactors both interface design and internal implementation, replacing the previous flat parameter management with a tensor-level sharding abstraction. Building a native training path centers on the following steps.
1. Model Loading and Sharded Initialization
A trillion-parameter model cannot be fully loaded on a single card and then split. It must use a strategy of “meta-device initialization + on-demand materialization”:
# Illustrative code: lazy initialization and sharded materializationwith torch.device("meta"):model = MultimodalMoEModel(config) # Does not occupy real device memory# Apply sharding strategy by layer or modulefor layer in model.language_layers:fully_shard(layer, mesh=device_mesh)fully_shard(model) # Top-level fallback shardingmodel.to_empty(device="accelerator") # Allocate empty device memoryload_sharded_checkpoint(model, ckpt_dir) # Each rank loads only its local shard
The key to this flow is that each compute unit reads and materializes only the parameter shard that belongs to it. Both the checkpoint format and the loader need to support sharded read and write, avoiding any full-parameter gathering at a single point.
2. Sharding Scheduling and Multi-Dimensional Parallelism
For the composite structure of MoE and multimodal models, practice usually adopts a hybrid parallel strategy:
- Data parallelism (FSDP sharding): covers the language backbone and shards parameters, gradients, and optimizer states.
- Expert parallelism (EP): distributes different experts across different devices and works with the routing layer for token dispatch.
- Tensor parallelism (TP): performs fine-grained splitting within a single node for compute-intensive modules such as the vision encoder.
- Sequence parallelism (SP): addresses activation growth caused by long contexts.
The combination of multi-dimensional parallelism requires precisely defining the splitting method for each dimension on the device mesh and ensuring that communication groups do not conflict. The scheduler needs to arrange the execution order of forward pass, backward pass, and communication primitives according to the compute graph topology, overlapping communication with computation as much as possible.
3. Gradient Synchronization and Communication Optimization
Gradient synchronization is the part of the training chain most likely to become a bottleneck. FSDP2’s sharded gradient reduction (reduce-scatter) replaces traditional all-reduce. The theoretical communication volume remains unchanged, but it places higher demands on the implementation quality and topology awareness of the communication library. Common engineering optimizations include:
- Communication-computation overlap: during backpropagation, trigger gradient reduction early at parameter-shard granularity instead of waiting for all gradients to be ready before unified synchronization.
- Gradient bucketing: merge gradients of small tensors into buckets before communication, reducing communication count and improving bandwidth utilization.
- Precision strategy: when numerical stability allows, use lower-precision formats for gradient communication together with error compensation mechanisms.
- Topology awareness: recognize bandwidth differences between intra-node high-speed interconnects and inter-node networks, and prioritize hierarchical aggregation within a node.
IV. Software Stack Adaptation: Connecting Hardware to Frameworks
The parallel strategies of a training framework ultimately need to map to specific hardware instructions and communication primitives. For domestic AI accelerator cards to complete this kind of adaptation, the software stack needs to provide support at three layers:
- Operator layer: cover the core operators required by the model (matrix multiplication, attention, routing dispatch, normalization, etc.), and optimize MoE-specific operations such as grouped matrix multiplication and token permutation.
- Communication layer: provide implementations semantically compatible with mainstream collective communication interfaces, supporting primitives such as reduce-scatter, all-gather, and all-to-all. Among them, all-to-all is especially critical for MoE expert parallelism performance.
- Framework layer: integrate with mainstream training frameworks through device plugins or compiler backends, so that upper-layer abstractions such as FSDP2 can transparently schedule down to the underlying hardware.
The difficulty of adaptation work often lies not in individual features but in end-to-end stability: during weeks of continuous training at the scale of thousands of cards, any numerical deviation in an operator or occasional communication timeout will be amplified. Therefore, complete fault-tolerance mechanisms, such as asynchronous checkpointing and automatic removal and recovery of faulty nodes, are also indispensable parts of the training chain.
V. Validation Methods and Engineering Experience
After completing training adaptation, correctness and efficiency need to be validated from three dimensions:
- Numerical consistency: align loss curves with a reference implementation under small-scale configurations, compare intermediate activations layer by layer, and rule out operator precision issues.
- Scaling efficiency: measure throughput changes under strong scaling (fixed model, more cards) and weak scaling (same ratio of more cards and more data), and locate communication bottlenecks.
- Stability: conduct long-duration stress tests, monitor memory fragmentation, memory leaks, and communication exceptions, and ensure that MFU (model FLOPs utilization) remains at a reasonable level.
For teams that want to start large-model training experiments quickly, general-purpose cloud container platforms, object storage, monitoring and alerting, and logging services can significantly reduce the operational burden of compute clusters, allowing developers to focus on models and training strategies. For example, general-purpose cloud products such as containers and storage on Baidu AI Cloud can be used to build elastic training environments, enabling task scheduling, checkpoint persistence, and observability of the training process in a unified way.
VI. Conclusion
The completion of a trillion-parameter multimodal model training loop on domestic AI accelerator cards marks a substantive step for the domestic compute ecosystem in ultra-large-scale training scenarios. Its technical core—native FSDP2 sharding paths, multi-dimensional parallelism combinations, communication-computation overlap, and full-link fault tolerance—has universal reference value for any team interested in large-scale training. As open-source models continue to grow in scale and domestic software stacks mature, a diversified compute foundation will provide stronger support for the AI industry.
