Adapting Heterogeneous Compute for Multimodal LLM Training: Engineering Practice and FSDP2 Analysis
This article covers the engineering work needed to run large multimodal model training on heterogeneous accelerators such as NPUs and other emerging compute cards. It explains why inference validation does not cover full training pipelines, what makes fine-grained expert parallelism (EP) difficult on heterogeneous hardware, and how the native FSDP2 training path is designed. It also describes what stable, long-running training on a two-node, 16-card cluster requires.
As the parameter counts of large language models and multimodal models grow exponentially, the gap between compute demand and hardware supply is becoming more pronounced. To break free from a single hardware ecosystem, the industry is actively exploring heterogeneous compute foundations. However, adapting to new hardware is not a simple matter of porting code. It is a systems engineering effort that involves low-level operators, communication topology, and distributed strategies.
Leading AI companies often show operator validation for different hardware in their technical reports, and some compare the performance of different processing units side by side. However, this work usually stops at the inference stage. The real challenge is full-pipeline adaptation for foundation model pretraining. This requires hardware vendors or cloud providers to build a complete training pipeline that covers model loading, shard scheduling, and gradient synchronization. This article examines engineering practice for heterogeneous compute in multimodal large model training, with a focus on the design and use of the native FSDP2 path.
1. Core Challenges of Heterogeneous Compute in Large Model Training
Before discussing specific distributed training strategies, it is necessary to understand the basic challenges that heterogeneous accelerators, such as various NPUs and emerging accelerator cards, face when adapting to complex large models.
1.1 The Gap Between Inference Validation and Full Training Pipelines
Adaptation for inference usually focuses on operator computation efficiency and memory footprint. If the operators in a single forward pass run correctly and meet a throughput requirement, the adaptation is generally considered a preliminary success.
Pretraining has very different requirements. Training involves not only the forward pass, but also backward gradient computation, optimizer state updates, and large volumes of data communication across nodes. A bottleneck at any stage can cause training efficiency to drop sharply. Long training runs also place high demands on hardware stability and error recovery. In a two-node, multi-card environment, even a small fluctuation can interrupt training.
1.2 Implementation Challenges of Fine-Grained Expert Parallelism (EP)
Mainstream frontier large models commonly use mixture-of-experts (MoE) architectures. In this setting, fine-grained expert parallelism is a key strategy for improving training efficiency. The core idea of EP is to distribute different expert networks across different compute nodes, which solves the problem of insufficient memory on a single device. On heterogeneous compute, however, EP faces two main challenges:
- Sharply higher communication overhead: Fine-grained partitioning means tokens need frequent All-to-All communication during routing. If the interconnect bandwidth of the hardware, such as chip-to-chip links or node-to-node networking, is insufficient, or if the communication library is not well optimized, communication latency can far exceed compute time.
- Load balancing: Because experts are spread across different devices, dynamic routing can overload some devices while others stay idle. On heterogeneous hardware, differences in instruction sets and microarchitectures may make traditional load-balancing algorithms ineffective. Routing and scaling strategies need to be redesigned for the characteristics of each hardware platform.
2. Analysis of the Native FSDP2 Path for Multimodal Training
To address these challenges, the industry has increasingly turned to the native FSDP2 (Fully Sharded Data Parallel 2) path when training multimodal large models. Compared with the first-generation FSDP, FSDP2 includes a major redesign of memory management and sharding.
2.1 Core Mechanisms and Advantages of FSDP2
FSDP2 replaces the module-based sharding of earlier versions with fine-grained, per-parameter management. This brings two main benefits:
- Reduced memory fragmentation: Multimodal models usually contain several submodules of different sizes, such as a vision encoder and a language model. Module-based sharding tends to produce many non-contiguous memory fragments. Per-parameter sharding spreads memory usage more evenly, which matters especially for heterogeneous accelerators with limited memory capacity.
- Overlapping computation and communication: FSDP2 is designed from the outset to pipeline underlying operators with communication. On heterogeneous platforms, a customized CUDA Graph (or the graph capture mechanism of the corresponding architecture) combined with overlapped communication streams can hide the latency of All-Gather and Reduce-Scatter operations.
2.2 Building the Full Path: Loading, Scheduling, and Synchronization
Building a native FSDP2 path requires implementing and connecting three core stages on heterogeneous hardware:
- Model loading and initialization: In a multi-node environment, model weights must load from persistent storage, such as object storage, in sharded form and move efficiently into each node’s memory. This prevents host memory overflow on the primary node.
- Shard scheduling: Parameter shards and compute tasks must be mapped based on the characteristics of the heterogeneous hardware. The underlying runtime needs to recognize the hardware topology accurately, assign compute-intensive work to the most capable cores, and hand communication work to dedicated communication engines.
- Gradient synchronization: During backpropagation, FSDP2 performs gradient reduction on each parameter shard. The communication library on heterogeneous hardware must efficiently support the Reduce-Scatter primitive and handle floating-point accumulation precision, so that gradients stay consistent across nodes.
3. Engineering Systems for Stable Long-Running Training
Validating a technical solution requires more than a single successful forward and backward step. It requires continuous, stable operation on a cluster of two nodes with 16 cards or more. For example, running hundreds of consecutive training steps stably on two nodes is an important indicator of how mature an engineering system is.
3.1 Why Stability Testing Matters
In distributed training, a single successful step accounts for only a small share of the total engineering effort. Hundreds of consecutive stable steps verify the system’s reliability in three areas:
- No memory leaks: Long iterations do not trigger out-of-memory (OOM) errors. This indicates that the memory management mechanism and the release logic for temporary tensors are reliable.
- No communication deadlocks: All-to-All and reduction operations across nodes do not block in complex network environments. This indicates that the network protocol stack and the hardware interconnect topology are stable.
- No numerical overflow: The loss keeps a normal downward trend over hundreds of steps, with no gradient explosion or vanishing gradients. This indicates that the loss scaling strategy for mixed-precision training, such as BF16, is effective.
3.2 Monitoring, Fault Tolerance, and Recovery
A mature engineering system depends on cloud-native infrastructure. A complete heterogeneous compute training platform typically combines the following general cloud capabilities:
- Container platform and resource scheduling: Containers package the training environment and hide differences in underlying hardware drivers. A scheduler with topology awareness places the 16 cards across two nodes so that communication stays local where possible.
- Logging and monitoring alerts: The system collects hardware metrics such as temperature, power draw, and memory utilization, along with training metrics such as loss and gradient norm. When a metric becomes abnormal, the system can trigger an alert within seconds.
- Fault recovery (checkpointing): Long training runs must support resuming from checkpoints. The system should periodically and asynchronously upload FSDP2 parameter shards, optimizer states, and random seeds to object storage. If a hardware failure takes a node offline, the scheduler can start a replacement node automatically, load the most recent checkpoint, and minimize downtime.
4. Summary and Outlook
Adapting heterogeneous compute is a long, technically demanding process, from single-card operator validation to stable full-pipeline training of multimodal large models. Building a native FSDP2 path for multimodal training requires deep customization of distributed strategies. It also depends heavily on complete monitoring, fault tolerance, and engineering-grade scheduling.
Developers and enterprise users who choose heterogeneous compute or build their own training platforms should look beyond theoretical peak performance. They should also evaluate how well a platform supports the full path from fast inference deployment to stable full-pipeline training. As general cloud infrastructure such as Baidu AI Cloud continues to mature, and as general distributed techniques such as FSDP and EP are explored further, the heterogeneous compute ecosystem may mature faster and provide a more solid and diverse foundation for iterating large models.
