Trillion-Parameter Multimodal Model Training on Domestic Compute: An FSDP2 Adaptation Practice
This article examines the engineering practice of adapting a 2.8-trillion-parameter open-source multimodal model for full training on a domestic AI training-and-inference compute platform. It explains why trillion-parameter training requires distributed sharding, introduces the native FSDP2 training path built on a flagship accelerator card and in-house software stack, and details the complete chain from meta-device initialization and sharded checkpoint loading to shard scheduling, gradient synchronization, mixed precision, and fault-tolerant checkpointing. The article also analyzes multimodal-specific challenges such as uneven sharding granularity, dynamic workload imbalance, and communication-compute overlap, and summarizes practical guidance for teams building large-model training systems on domestic compute, including collective-communication benchmarking, parallel-strategy selection, observability, and use of managed cloud platforms.
Training Adaptation Practice for Trillion-Parameter Multimodal Models on Domestic Training-and-Inference Compute
1. Background: Large-Model Training Places New Demands on the Compute Foundation
Recently, a large-model research organization open-sourced a flagship multimodal model with 2.8 trillion parameters, once again raising the open-source community’s awareness of model scale. At the same time, a domestic GPU vendor completed training adaptation for this model using 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 full training chain from model loading and shard scheduling to gradient synchronization. This progress shows that domestic compute platforms now have the engineering capability to carry full training workloads for trillion-parameter models.
Training a trillion-parameter model is essentially extreme scheduling across three resources: compute, GPU memory, and communication. Taking 2.8 trillion parameters as an example, even with BF16 storage, model weights alone require about 5.6 TB of GPU memory. With mixed-precision training and saved optimizer states, such as the first- and second-order moments in AdamW, total memory demand expands to tens of terabytes, far beyond the capability of any single card or even a single machine. Distributed parallel training is therefore no longer optional; it is the only path.
2. FSDP2: Engineering Implementation of Fully Sharded Parameter Training
Among parallel strategies, Fully Sharded Data Parallel (FSDP) has become a mainstream approach for very large models due to its low memory footprint and low implementation intrusion. Its newer implementation, commonly referred to as FSDP2, offers significant improvements over earlier versions in communication-compute overlap, memory fragmentation management, and shard-granularity control.
The core idea of FSDP can be summarized in three points:
- Parameter sharding: Model parameters, gradients, and optimizer states are partitioned across all training devices. Each card stores only 1/N of the global parameters, where N is the number of devices, fundamentally eliminating redundant storage under data parallelism.
- On-demand aggregation (All-Gather): When forward or backward computation reaches a given layer, the full parameters of that layer are temporarily collected through All-Gather communication and released immediately after computation. This implements a “gather when needed, discard when done” pattern.
- Sharded gradient reduction (Reduce-Scatter): Gradients produced by backpropagation are no longer subject to full All-Reduce. Instead, they are directly Reduce-Scattered to the corresponding shard on each card, halving both communication and storage volume.
An illustrative training loop is shown below:
# Illustrative code: FSDP2-style sharded training loopfor batch in dataloader:# Forward: layer-wise all-gather parameters -> compute -> releaseloss = sharded_model(batch)# Backward: gradients are reduce-scattered directly to local shardsloss.backward()# Update only locally held parameter shardsoptimizer.step()optimizer.zero_grad()
Compared with pipeline parallelism and tensor parallelism, FSDP requires the smallest changes to model code and is naturally compatible with heterogeneous subnetworks across modalities. This is also an important reason it has become a preferred approach for multimodal large-model training.
3. Special Challenges of Multimodal Training Paths
Multimodal models typically consist of several submodules with very different structures, such as a vision encoder, a language backbone, and a cross-modal projection layer. This brings three challenges to sharded training:
First, uneven sharding granularity. The language backbone may account for more than 90% of parameters, while the vision encoder has fewer parameters but is compute-intensive. Uniform sharding can cause some devices to run out of memory while others sit idle. In engineering practice, sharding strategies need to be customized by module: large-parameter subnetworks should use fine-grained sharding, while small compute-intensive modules can be replicated rather than sharded.
Second, dynamic load imbalance. Samples vary significantly in image count, resolution, and text length, causing compute load to fluctuate across micro-batches. This requires data-scheduling techniques such as dynamic padding and sequence-length bucketing, together with a sharding scheduler, to keep load balanced across cards.
Third, communication-compute overlap is highly complex to schedule. Multimodal models have irregular inter-layer dependencies, making it harder to time the prefetch of the next layer’s parameters. The native FSDP2 path uses an explicit sharding scheduler to manage parameter lifecycles, hiding All-Gather communication under computation as much as possible. This is the most demanding part of completing the full training chain for the software stack.
4. From Model Loading to Gradient Synchronization: Breaking Down the Full Training Chain
The core outcome of this adaptation is a native, non-intrusive end-to-end training chain. Its key stages include:
4.1 Model Loading and Initialization
A trillion-parameter model cannot be fully instantiated on a single card and then distributed. It must use a “meta-device initialization + direct sharded loading” mode: first build the model skeleton on a meta device that occupies no GPU memory, determine the shape and ownership of each shard, and then have each card directly read its own checkpoint shard from distributed storage such as object storage or a parallel file system. This reduces loading time from hours to minutes and avoids GPU-memory peak risk during loading.
4.2 Shard Scheduling
The sharding scheduler manages the lifecycle of parameter shards throughout training: when to prefetch, when to gather, when to release, and how to reuse the memory pool. A good scheduler implementation can keep the impact of communication overhead on training throughput low while avoiding OOM caused by memory fragmentation.
4.3 Gradient Synchronization and Mixed Precision
Gradient synchronization uses the Reduce-Scatter primitive and gradient bucketing to merge multiple small tensors into communication, improving collective-communication efficiency. For mixed precision, master weights and optimizer states remain in FP32 for numerical stability, forward and backward computation use BF16, and gradient communication can use lower precision to save bandwidth, with loss scaling and overflow detection.
4.4 Fault Tolerance and Checkpointing
In long-running training at the 10,000-card scale, hardware failures are the norm rather than the exception. A complete training chain must support periodic asynchronous checkpointing with minimal blocking during writes, fast recovery from the latest checkpoint after a failure, and flexible conversion between sharded and global formats for downstream inference deployment.
5. Significance and Engineering Lessons of Domestic Software Stack Adaptation
Completing this adaptation on a domestic training-and-inference accelerator card is valuable not only because “it runs,” but because it validates the domestic software stack’s complete support for mainstream training paradigms: FSDP2, mixed precision, collective communication, and memory management. For teams that want to train large models on domestic compute, several practical recommendations follow:
- Prioritize validation of collective-primitive performance: The bandwidth and latency of All-Gather and Reduce-Scatter directly determine scaling efficiency, so benchmark them before large-scale deployment.
- Choose the parallel combination wisely: Consider tensor parallelism within a node, FSDP across nodes, and decide whether to add pipeline parallelism based on model structure to form a multi-dimensional parallel strategy.
- Emphasize observability: Use logging services and monitoring/alerting systems to continuously track per-card memory watermark, share of communication time, MFU (model FLOPs utilization), and other metrics to quickly locate performance bottlenecks.
- Use managed platforms: Enterprises can also use container platforms, object storage, and distributed training scheduling capabilities from mainstream cloud platforms to quickly build elastic large-model training environments and reduce infrastructure O&M costs.
6. Conclusion
Completing the full chain from model loading and shard scheduling to gradient synchronization marks a key step for domestic AI compute in the high-difficulty scenario of trillion-parameter multimodal model training. As advanced training paradigms such as FSDP2 continue to be optimized on heterogeneous hardware, compute choices for large-model training will become more diverse, and training costs are expected to decline further. For developers, understanding the underlying principles and engineering details of sharded training will be an important foundation for maintaining technical competitiveness in the large-model era.
