Adapting Trillion-Parameter Multimodal LLMs on Emerging Compute Platforms: An FSDP2 Practice
This article explores the technical challenges and implementation logic of adapting a 2.8-trillion-parameter multimodal large model on a specific GPU vendor's platform. It covers memory wall limitations, communication bottlenecks, and multimodal data heterogeneity, detailing how a native FSDP2 training path resolves these issues through sharding-aware loading, dynamic scheduling, and optimized gradient synchronization. The insights provide a reusable methodology for full-stack LLM training engineering.
1. Background: Compute Adaptation Challenges Posed by Open-Source Trillion-Parameter Models
Recently, a leading AI research institution open-sourced its flagship multimodal model, featuring a 2.8-trillion-parameter scale and utilizing a typical Mixture of Experts (MoE) architecture. The open-sourcing of such models provides the industry with the first opportunity to fully reproduce the training process of a trillion-scale model in a proprietary compute environment. However, the prerequisite is that the compute platform must possess distributed training capabilities that match this scale.
Almost simultaneously, a specific GPU vendor completed the training adaptation of this model on its hardware platform, based on its flagship unified training and inference compute cards and a self-developed software stack. They constructed a native FSDP2 multimodal training path, enabling a complete training pipeline from model loading, parameter sharding, and scheduling execution to gradient synchronization. The technical significance of this progress lies not merely in “running a model,” but in verifying the engineering feasibility of emerging compute stacks to support ultra-large-scale model training. This article dissects the core challenges and implementation logic behind this adaptation from a technical perspective.
2. Three Technical Challenges in Trillion-Parameter Model Training
2.1 Memory Wall: The Combined Pressure of Parameters, Gradients, and Optimizer States
Taking a 2.8-trillion-parameter model as an example, even with BF16 precision storage, the parameters alone require about 5.6TB of GPU memory. If using an Adam-class optimizer, additional storage is needed for FP32 master weights, first-order momentum, and second-order momentum. The total memory requirement for a single replica can easily exceed tens of terabytes. No single card or even a single machine can accommodate this; therefore, memory sharding strategies must be used to distribute the states across hundreds or thousands of accelerator cards. This is the fundamental reason for the existence of technologies like Fully Sharded Data Parallel (FSDP).
2.2 Communication Bottleneck: Finer Sharding Leads to Heavier Communication
The core idea of FSDP is “aggregate on demand, release after use”: before forward computation, AllGather is used to collect the full parameters, and after backpropagation, ReduceScatter is used to distribute gradients. For a trillion-parameter model, this means moving terabytes of data across the cluster network at each iteration step. If computation and communication cannot effectively overlap, the cluster’s Model FLOPs Utilization (MFU) will drop sharply. The MoE architecture additionally introduces All-to-All communication caused by expert routing, making the communication pattern more complex.
2.3 Heterogeneity of Multimodal Data
Multimodal models need to process both text tokens and the output of visual encoders for images and videos. These two types of data differ significantly in sequence length, computation density, and memory footprint. Traditional uniform sharding strategies can easily cause uneven loads among devices in multimodal scenarios, leaving some devices idle and waiting. Therefore, the multimodal training path must design sharding and scheduling strategies for heterogeneous inputs, which is the technical connotation behind the term “native FSDP2 multimodal training path.”
3. Key Mechanisms of the FSDP2 Training Path
3.1 Sharding Design from Model Loading
The first step of the adaptation work is to solve “how to load 2.8 trillion parameters into the cluster.” The sensible approach is to use lazy loading and distributed initialization: each process initializes only its own parameter shard locally, combined with technologies like the meta device to avoid materializing the complete model in CPU memory. The example code is as follows:
# Example: Sharding-aware model initialization logicdef init_sharded_model(model_fn, mesh):with torch.device("meta"):model = model_fn() # Build computational graph on meta device, no GPU memory consumedmodel = fsdp2_shard(model, mesh) # Shard parameters and optimizer states according to the device meshmodel.to_empty(device="cuda") # Allocate actual GPU memory for local shardsload_checkpoint_sharded(model) # Each process only reads its own weight slicesreturn model
This approach makes the model loading time and memory footprint dependent on the “local shard size” rather than the “total model size,” providing horizontal scalability.
3.2 Shard Scheduling: Load Balancing Strategy for Multimodal Workloads
To address the heterogeneity of multimodal data, the adaptation scheme needs to introduce scheduling logic that is aware of sample length beyond the data parallel dimension. Common practices include: constructing batches based on total token count rather than the number of samples, incorporating the visual encoder and the language model backbone into different shard groups (block-wise sharding), and applying sequence parallelism on the visual side to reduce activation memory. Before each step, the scheduler estimates the computation volume of each device and dynamically adjusts the micro-batch partitioning to minimize tail bubbles.
3.3 Gradient Synchronization: Compute-Communication Overlap and Bucketing Optimization
Gradient synchronization is the last mile of the training pipeline. Mature practices typically involve three layers of optimization: first, bucketing gradients by layer and triggering ReduceScatter during backpropagation to achieve fine-grained overlap of communication and computation; second, leveraging the characteristic that communication in MoE expert parallelism can naturally overlap with the computation of other experts to orchestrate execution order and hide All-to-All latency; third, using low-precision communication for gradients (e.g., BF16 ReduceScatter) to halve the communication volume within an acceptable range of precision loss. The combination of these three determines whether trillion-parameter training can achieve an acceptable throughput level.
3.4 The Synergy Value of the Software Stack
It is worth noting that the implementation of the above mechanisms highly depends on the underlying software stack: the operator library needs to provide high-performance matrix multiplication and MoE routing operators; the communication library needs to adapt to the interconnect topology of the self-developed hardware and support bucketing communication primitives; and the compiler layer needs to reduce memory fragmentation in multimodal branches through operator fusion. Training adaptation is essentially a full-stack collaborative engineering effort involving “framework—operator—communication—hardware,” where any missing link becomes a bottleneck.
4. Industry Insights and Reusable Methodologies
This adaptation practice provides several reusable experiences for teams hoping to train ultra-large models on their own compute:
- Connect the pipeline first, optimize performance later: Start with FSDP2 sharded loading, prioritize ensuring the correctness of the end-to-end process, and then progressively introduce optimizations like communication overlap, bucketing, and low precision.
- Multimodal scenarios must address load balancing: Data construction and sharding strategies need to be designed jointly to avoid coarse sharding based on sample count.
- Software stack maturity is as important as hardware compute power: Operator coverage, communication library performance, checkpoint resumption, and fault recovery capabilities directly determine the practical usability of large-scale training.
- Build the training foundation relying on general cloud product capabilities: In engineering practice, object storage can be used to host massive training corpora and checkpoints, container platforms can manage large-scale training task scheduling, and log services with monitoring and alerting systems can ensure the stability of long-period training. For instance, general cloud computing and storage capabilities provided by Baidu AI Cloud can serve as integral components of such a training infrastructure.
5. Conclusion
The training adaptation of a 2.8-trillion-parameter model is a stress test of the full-stack capabilities of a compute platform. From memory sharding, heterogeneous scheduling to gradient synchronization, each stage corresponds to a classic challenge in the field of distributed training. As open-source ultra-large models and diverse compute ecosystems continue to evolve, this type of adaptation experience will settle into an industry-standard engineering paradigm, driving large model training infrastructure towards a more open and diverse landscape.
