Adapting Trillion-Parameter Multimodal Training on Domestic AI Accelerators
This article explains the engineering work required to adapt trillion-parameter multimodal training on domestic AI accelerators, using a 2.8-trillion-parameter open-source multimodal model as the reference case. It covers the four core bottlenecks—memory, communication, uneven multimodal workloads, and software stack maturity—and presents a three-stage approach: get correctness working first, then optimize performance, and finally ensure long-term stability. Key implementation details include native FSDP2 sharding, memory budgeting with combined parallelism, multimodal data pipelines, gradient synchronization and numerical stability, and sharded checkpoints with fault tolerance. A troubleshooting checklist and practical takeaways for large-scale training are also included.
1. Background: Why Trillion-Parameter Multimodal Training Is Hard
A flagship open-source multimodal model with 2.8 trillion parameters has recently drawn attention in the industry. Unlike a text-only model, this class of models unifies text, image, audio, and other modalities into a single parameter space, and training difficulty grows exponentially. A domestic AI accelerator vendor completed training adaptation for this type of model on its flagship training-and-inference integrated AI card and self-developed software stack, building a native Fully Sharded Data Parallel (FSDP2) multimodal training path that connects the full pipeline from model loading and shard scheduling to gradient synchronization. Setting aside specific product attributes, this article frames the problem as a general engineering question: what hurdles must be cleared to adapt trillion-parameter multimodal training on domestic accelerators.
The difficulties concentrate in four areas:
- Memory wall: Trillion-scale parameters occupy several TB of memory for parameters alone, even at half precision, which cannot fit on a single card or a single machine.
- Communication wall: After sharding, each card holds part of the parameters, and forward and backward passes repeatedly aggregate them, so communication volume amplifies as the card count grows.
- Uneven multimodal workloads: Long text sequences, high-resolution images, and audio of varying duration cause sharp fluctuations in per-batch compute.
- Software stack maturity: Operator coverage, communication libraries, and framework adaptation on a new hardware platform often lag behind the pace of model iteration.
2. Overall Adaptation Strategy: Get It Running, Then Fast, Then Stable
Large-scale adaptation should not aim for peak performance in one step; it should proceed in three stages.
Stage 1: Establish correctness. The goal is to complete one full forward pass, backward pass, and parameter update under a minimal configuration, with a loss curve that broadly matches the reference implementation. This stage focuses on verifying operator semantics, mixed-precision policy, and consistency of random numbers and initialization.
Stage 2: Optimize performance. Use combinations of parallelism, computation-communication overlap, operator fusion, and memory reuse to approach the hardware limit.
Stage 3: Ensure long-term stability. Introduce fault tolerance, automatic resume, slow-node detection, and health checks to keep training running for weeks without interruption at the scale of thousands or tens of thousands of cards.
3. Key Technologies and Implementation Details
3.1 Native FSDP2 Path
The core idea of full sharding is to partition parameters, gradients, and optimizer states along the data-parallel dimension and aggregate them temporarily when needed. Compared with traditional approaches, it uses less memory and scales better. Key implementation points of the native path include:
# Example: wrap the model with sharding and configure mixed precision and communication policymodel = fully_shard(model,mesh=dp_mesh, # data-parallel communication meshmp_policy=MixedPrecisionPolicy(param_dtype=torch.bfloat16, # low precision for computationreduce_dtype=torch.float32, # high precision for reduction to ensure numerical stability),)
The key is that parameter shard granularity should match the network structure to avoid excessive communication from shards that are too fine, and reduction precision should be separated from computation precision to balance speed and convergence.
3.2 Memory Budget and Parallelism Combinations
Trillion-parameter models typically require a combination of data parallelism, tensor parallelism, pipeline parallelism, and sequence parallelism. The recommended planning order is: first use sharding to fit the parameters, then use tensor parallelism to split single-layer computation, and finally use pipeline parallelism to split layers across nodes. The memory budget can be roughly validated with the following inequality:
parameter shards + gradient shards + optimizer state shards + activations + temporary buffers <= per-card memory
Activations are the main variable in long-sequence multimodal training. Selective recomputation is recommended, recomputing only modules that are compute-intensive but memory-heavy.
3.3 Multimodal Data Pipeline
The bottleneck in multimodal training is often on the data side. Engineering practice should: encapsulate modality encoders as pluggable modules; use independent sampling ratios and temperature parameters per modality to adjust the distribution; bucket images by resolution and text by length to reduce padding waste; and use multi-process prefetching and local caching in data loading to avoid GPU idle time.
3.4 Gradient Synchronization and Numerical Stability
Gradient synchronization after sharding is critical to correctness. Recommended practices: use high-precision accumulation for reduction; bucket and fuse gradients to reduce small messages; enable gradient clipping and loss scaling to prevent overflow; and add circuit breaking and automatic rollback to the most recent checkpoint for abnormal loss.
3.5 Checkpoints and Fault Tolerance
Saving a checkpoint for a trillion-parameter model takes considerable time. Sharded checkpoints are recommended: each card writes to local storage in parallel, then aggregates asynchronously to object storage; retain multiple historical checkpoints; and integrate the training framework with monitoring, alerting, and logging services to automatically isolate and resume from slow nodes, dropped cards, and communication timeouts.
4. Common Issues and Troubleshooting Checklist
- Abnormal loss: First check whether mixed-precision reduction settings and initialization match the reference implementation.
- Communication bottleneck: Adjust shard granularity and bucket size, and confirm that computation-communication overlap is effective.
- Out-of-memory: First reduce activations (recomputation), then adjust parallelism, and finally consider sequence parallelism.
- Throughput jitter: Usually caused by the data pipeline or individual slow nodes; locate the cause with monitoring.
- Resume inconsistency: Verify that optimizer state, random number state, and data cursor are fully saved.
5. Conclusion
Adapting trillion-parameter multimodal models on compute platforms is essentially about getting four things right at the same time: memory, communication, numerical stability, and engineering fault tolerance. With full sharding as the backbone, combined with a sensible parallelism combination, a bucketed data pipeline, and sharded checkpoints, domestic compute platforms are now capable of taking on this class of training tasks. For developers, mastering these general methods makes it possible to smoothly reproduce and optimize large-scale training workflows in environments that provide a general container platform, object storage, and monitoring and alerting capabilities, such as Baidu AI Cloud.
