Training Trillion-Parameter Multimodal Models on Domestic AI Accelerators: A Full Pipeline Analysis
This article examines the engineering challenges of training trillion-parameter multimodal models on domestic AI accelerators and outlines the complete training path. It focuses on FSDP2-based sharding, multimodal module handling, shard-aware model loading, data pipeline design, gradient synchronization and communication optimization, and fault tolerance with checkpoint recovery. It also summarizes general practices for hardware adaptation, including operator coverage, precision alignment, layered framework integration, and observability.
1. Background: Why Trillion-Parameter Multimodal Training Is a Hard Problem
As large models move from pure text to multimodal fusion, parameter scale has reached the trillion level. Training such models is no longer a task that a single node with multiple cards can handle. It is a systems engineering effort that requires hundreds or even thousands of accelerators to work together. For training platforms built on domestic AI accelerators, the challenges mainly appear at three levels:
- Compute level: Trillion-parameter models involve massive matrix operations in forward and backward computation. Accelerators must provide sufficient peak compute and memory bandwidth, while memory capacity must be able to hold the sharded model states.
- Software stack level: Mainstream training frameworks are usually optimized for specific hardware ecosystems. Domestic hardware needs a self-developed software stack to cover operators, adapt communication libraries, and integrate with frameworks, ensuring that training scripts can be migrated with minimal changes.
- Engineering pipeline level: From model loading, parameter sharding, and data scheduling to gradient synchronization and checkpoint resume, a bottleneck in any stage can drag down overall training efficiency.
Recently, a domestic GPU vendor announced that it had completed training adaptation for an open-source 2.8-trillion-parameter multimodal flagship model. It built a native FSDP2 multimodal training path and connected the full pipeline from model loading and shard scheduling to gradient synchronization. This case has strong industry reference value. This article extracts general technical methods and engineering points from it.
2. FSDP2: The Core Sharding Mechanism for Trillion-Parameter Training
2.1 Why Full Sharding Is Needed
Even when stored in FP16/BF16, a trillion-parameter model requires several terabytes of memory for weights alone. Adding optimizer states, which are usually several times the size of the weights, and activations, a single card’s memory is far from enough. The core idea of FSDP (Fully Sharded Data Parallel) is to evenly shard model parameters, gradients, and optimizer states across compute cards, and then temporarily gather them when a module is needed in forward or backward computation.
Compared with the first-generation implementation, FSDP2 introduces DTensor-based tensor sharding representation and offers several engineering advantages:
- Finer sharding granularity: A single parameter tensor is used as the sharding unit, avoiding the need to fully materialize an entire layer module, resulting in more balanced memory utilization.
- Better compatibility with quantization and low-rank adaptation: Sharding metadata is managed uniformly by the framework, making it easier to stack low-precision training strategies.
- Easier combination of recomputation and CPU offload: Policies can be configured flexibly at module granularity.
2.2 Special Handling in Multimodal Scenarios
Multimodal models usually contain a vision encoder, a text model backbone, and cross-modal alignment modules. The parameter scale and computation characteristics of these parts differ significantly. Common practices include:
- Using coarser sharding granularity for the vision encoder to reduce communication overhead.
- Applying layer-by-layer sharding to the language model backbone and enabling activation recomputation.
- Using wrapping policies to bring modules of different modalities into the same sharding scheduling system.
An illustrative configuration approach is shown below (pseudocode):
from torch.distributed.fsdp import fully_shard# Apply sharding strategies to different modulesfor block in model.vision_encoder.blocks:fully_shard(block, mesh=shard_mesh)for block in model.text_backbone.blocks:fully_shard(block, mesh=shard_mesh, reshard_after_forward=True)fully_shard(model) # Root module fallback
3. Four Key Stages of the Complete Training Pipeline
3.1 Model Loading and Shard Initialization
A trillion-parameter model cannot first be loaded in full and then sharded. It must use “shard-aware initialization”: build the model structure as metadata in CPU memory, and then write each parameter shard directly to the corresponding device according to the sharding plan. A common approach is to use a meta device with deferred initialization to avoid a full model copy on the CPU side. At the same time, it is necessary to verify consistency between weight files and the sharding strategy and handle dimension splitting for tensor parallelism.
3.2 Data Pipeline and Multimodal Scheduling
Multimodal training data usually includes image-text pairs, video, pure text, and other forms. From an engineering perspective, the following are needed:
- Unified packing format: Serialize samples of different modalities into a unified shard format that supports streaming reads and random access.
- Dynamic sequence packing: Concatenate multiple samples according to a token budget to reduce padding waste and increase the share of effective compute.
- Prefetch and overlap: Perform data decoding, augmentation, and tokenization asynchronously on the CPU side and overlap them with GPU computation to avoid starvation.
3.3 Gradient Synchronization and Communication Optimization
Under sharded data parallelism, parameter shards of each module need timely All-Reduce/Reduce-Scatter and resharding during backpropagation. Key optimizations include:
- Communication and computation overlap: Schedule gradient all-gather in parallel with the next layer’s computation to hide communication latency.
- Topology-aware communication: Use high-bandwidth interconnect within a node and the network across nodes. The communication library needs to identify hardware topology and select the optimal algorithm.
- Gradient accumulation and bucketing: Aggregate small gradients by bucket before unified communication to reduce the number of communication rounds.
3.4 Fault Tolerance and Checkpoint Resume
Large-scale training cycles are measured in weeks, and hardware failures are inevitable. A robust approach includes:
- Saving checkpoints asynchronously at high frequency, with checkpoints themselves stored in sharded form.
- Supporting fast recovery from checkpoints and skipping already consumed data.
- Establishing automatic health checks and node eviction mechanisms so that training can automatically scale down and resume after a failure.
4. General Engineering Practices for Domestic Accelerator Adaptation
Based on public experience from such adaptation work, several recommendations of general value can be summarized:
- Prioritize operator coverage: First use model profiling to identify missing or inefficient operators, and prioritize filling critical paths rather than pursuing 100% operator completeness.
- Validate precision alignment: Build a small-scale reference implementation and compare loss curves and gradient norms stage by stage to ensure numerical behavior matches reference hardware.
- Layer framework adaptation: Converge hardware-specific logic into low-level plugins, keep training scripts natively compatible with the upper-level framework, and reduce migration cost.
- Build observability: Integrate general monitoring, alerting, and logging services, track core metrics such as MFU, memory watermark, and communication time in real time, and quickly locate bottlenecks.
5. Conclusion
The adaptation practice for trillion-parameter multimodal models shows that the success of large-scale training depends not only on single-point compute, but also on the complete software-hardware co-designed pipeline: the sharding strategy determines memory feasibility, communication optimization determines the efficiency ceiling, the data pipeline determines compute utilization, and fault tolerance determines whether the job can finish. For teams planning to train large models on domestic compute, understanding and reusing this methodology has more long-term value than focusing on the specifications of a single product. As domestic software stacks continue to mature, the barrier to end-to-end training adaptation will be further lowered, and more teams will be able to explore frontier model training on independent compute.
