Adapting Ultra-Large Multimodal Model Training: Distributed Optimization in Practice
This article covers how a Chinese AI computing platform adapted its software and hardware for training ultra-large multimodal models. It explains the main challenges, including memory capacity, communication overhead, and training stability. It also describes fully sharded data parallelism, distributed model initialization, the training pipeline from forward pass to gradient synchronization, memory and numerical stability practices, checkpoint recovery, and the metrics used to validate the adaptation.
Generative AI models keep growing. Parameter counts, training data volumes, and computational complexity all rise together. Traditional approaches that rely on a single multi-GPU server or simple data parallelism increasingly fall short of the resource demands of very large models. In multimodal training, text, image, and video data each have different sequence lengths, compute density, and memory access patterns. A training system therefore has to solve more than compute capacity. It must also manage memory capacity, communication efficiency, data organization, and task stability.
Recently, a Chinese AI computing platform completed training adaptation for an ultra-large multimodal model. The adaptation builds on an integrated AI accelerator card that supports both training and inference, combined with its supporting software stack. Together, they connect the key stages of model loading, parameter sharding, compute scheduling, gradient synchronization, and training state management. The main value is not only that the model can run. The adaptation also establishes a native distributed training path for large-parameter models, so that hardware, software frameworks, and model architecture work together more efficiently.
1. Core Challenges in Training Ultra-Large Models
For models with parameter scales of tens of trillions, the weights alone can occupy a large amount of memory, even when stored in low precision. Gradients, optimizer states, activations, and communication buffers add more. The resources needed for actual training are often several times the size of the model weights.
Traditional data parallelism usually requires each device to hold a complete copy of the model. This approach is relatively simple to implement. As parameter counts grow, however, every device must store the full weights, gradients, and optimizer states, and memory quickly becomes the main bottleneck. Multimodal models add further complications. The vision encoder, the cross-modal projection layers, and the language model backbone can have different compute characteristics. Copying the whole model onto each device leads to uneven resource use.
Communication overhead is another challenge. During training, devices exchange gradients or parameter updates. If the communication design is poor, compute tasks frequently wait for data synchronization, and accelerator utilization drops. In large clusters, communication efficiency can become the key factor that limits overall training speed.
2. The Basic Idea of Fully Sharded Data Parallelism
The core idea of fully sharded data parallelism is to split model parameters, gradients, and optimizer states across devices. Each device stores only the portion it is responsible for. Before a layer runs, the system temporarily gathers the parameters that layer needs. After the computation finishes, the system releases or reshards those parameters. This reduces the memory that stays resident on each device.
Compared with traditional data parallelism, fully sharded training has the following features:
Parameter sharding
Model weights are no longer fully replicated on every device. They are divided into shards according to defined rules. At startup, each device loads only its own shards. Before a specific operator runs, the system uses collective communication to temporarily obtain the parameters that computation requires, then frees the temporary copies once the computation completes.Gradient sharding
Gradients produced during backpropagation can also be split. Once computed, gradients are reduced and redistributed to the devices that own the corresponding shards. This prevents every device from keeping a full gradient tensor for long periods.Optimizer state sharding
Adaptive optimizers typically maintain extra state, such as first- and second-moment statistics. These states can consume a large amount of memory. Sharding them significantly reduces the memory pressure on each device.On-demand gathering
Parameters are gathered only when the computation needs them, and released after use. This approach requires a training framework with fine-grained lifecycle management. The framework must handle parameter prefetching, communication scheduling, memory reclamation, and coordination of compute streams.
3. Model Loading and Initialization
Adapting training for ultra-large models starts with the question of how to load the model. If the full model is first built in a single process and then sharded, the initialization stage can cause temporary memory spikes. Host memory or device memory may overflow as a result.
A more practical approach is distributed initialization. The model structure is created in sync across multiple training processes, but parameters do not need to be fully materialized in each process. Based on the device topology and sharding strategy, the system maps parameters directly to target devices or host memory regions.
During initialization, pay close attention to the following points:
- Parameter shapes and data types must stay consistent across devices.
- Parameter shard indices must be stable, so that training can resume and match them correctly.
- Weight loading should support chunked reading to avoid occupying too much memory at once.
- Shared weights in the model need clear rules for storage and synchronization.
- Parameter naming and state dictionary structures should stay uniform across modules.
Multimodal models also require separate handling for the text module, the vision module, and the cross-modal connection module. Each module may use a different shard granularity and computation order. The training framework must ensure that parameter dependencies between modules are not broken by sharding.
4. From Forward Pass to Gradient Synchronization
A complete distributed training process usually includes the following steps.
Step 1: Data distribution. Training samples are divided across devices according to the global batch. Each device processes only its local portion. For multimodal inputs, the system must align text tokens, image features, position information, and attention masks.
Step 2: Parameter prefetching. Before a compute module runs, the training system fetches the parameter shards that module needs, using the computation graph. Where possible, communication is hidden behind preceding computation.
Step 3: Forward pass. Each device uses the gathered temporary parameters to compute its local samples. It saves the activations that backpropagation requires. To reduce memory use, activation recomputation can keep only some intermediate results and rerun part of the forward operators during the backward pass.
Step 4: Loss computation. A multimodal task may include a language modeling loss, an image understanding loss, a cross-modal alignment loss, or a combination of these. The loss terms are weighted according to the task configuration. The system must also ensure that every device normalizes the loss in the same way.
Step 5: Backward pass. After gradients are produced, the system writes them to the corresponding shard buffers. For large gradient tensors, use chunked communication and overlap communication with computation to reduce waiting time.
Step 6: Gradient reduction. Each device reduces its local gradients, so that every parameter shard receives globally consistent update information. After reduction, gradients stay on the devices that own the corresponding shards.
Step 7: Optimizer update. Each device updates only the parameters and optimizer states it is responsible for, which avoids duplicate computation. After the update, the new parameter shards enter the next training iteration.
5. Co-Optimizing Communication and Computation
In ultra-large training, communication optimization cannot rely only on hardware bandwidth. Task scheduling must also reduce synchronization waits.
One common method is overlapping communication with computation. While the current layer computes, the framework can prefetch parameters for the next layer. During the backward pass of the current layer, it can synchronize gradients from the previous layer. This makes good use of the time gaps between computation and communication.
Another method is setting shard granularity carefully. Shards that are too small generate many communication tasks and scheduling overhead. Shards that are too large can push peak memory usage higher. The right configuration depends on the layer structure of the model, the memory capacity of each device, and the interconnect topology of the cluster.
Teams should also watch the ordering of communication operations. If devices issue collective operations in different orders, tasks can block or even deadlock. The training framework therefore needs a unified communication sequence, along with clearly defined handling for interruptions, timeouts, and retries.
6. Memory Management and Training Stability
Memory management determines whether ultra-large training can run stably. Besides parameters, gradients, and optimizer states, activations, temporary tensors, communication buffers, and operator workspaces also consume memory.
In practice, the following measures help:
- Use mixed precision to reduce the storage needed for parameters and activations.
- Enable activation recomputation for long-sequence tasks.
- Set clear lifecycles for temporary tensors.
- Avoid unnecessary parameter copies and format conversions.
- Plan memory allocation in a unified way to reduce fragmentation.
- Run peak memory estimation and stress tests before training starts.
Mixed precision training also requires attention to numerical stability. Some computations can run in lower precision, but normalization, loss accumulation, and optimizer updates may need higher precision. The training system should provide loss scaling, overflow detection, and fallback mechanisms for abnormal values. These prevent underflow or overflow from breaking training.
7. Checkpointing and Fault Recovery
Large training jobs often run for long periods. Hardware failures, network problems, or process exits can interrupt them. For this reason, checkpointing should be treated as part of the training pipeline, not as an optional add-on.
Checkpoints for fully sharded training cannot simply save the state of a single device. The system needs to record:
- Parameter shards and their global positions
- Optimizer state shards
- The current training step and data loading position
- Random number generator states
- Learning rate schedule state
- Mixed precision related state
- The version of the model structure and training configuration
During recovery, each device should remap shards according to the current cluster size. The environment does not need to match the one used for saving exactly. This makes jobs easier to migrate and speeds up recovery after failures.
8. Key Metrics for Validating the Adaptation
After training adaptation, verifying that the model starts is not enough. Testing should proceed in layers.
First, run functional correctness tests. These check that forward outputs, loss computation, gradient generation, and parameter updates match expectations. Next, run consistency tests between single-device and multi-device setups. These confirm that results under different parallel scales stay within an acceptable error range.
Then run memory stress tests. Measure peak memory usage across different batch sizes, sequence lengths, and modality combinations. Finally, run long-duration stability tests to verify that communication, checkpointing, fault recovery, and dynamic memory management remain reliable.
For performance, focus on device utilization, communication wait time, effective training throughput, parameter loading overhead, and time per training step. Higher theoretical compute does not automatically produce higher effective throughput. Training efficiency improves only when computation, communication, memory access, and scheduling work together.
9. Future Optimization Directions
For larger models, the training system can keep evolving in several directions. First, combine data parallelism, tensor parallelism, and pipeline parallelism more closely, choosing combinations based on the structure of each model module. Second, improve automatic sharding and automatic scheduling, so the system can generate better configurations based on memory capacity and device topology.
Third, strengthen compilation optimization. Operator fusion, memory reuse, and static graph analysis can reduce runtime overhead. Fourth, improve heterogeneous resource scheduling, so host processors, accelerator devices, and high-speed storage are orchestrated in a unified way. Fifth, improve the efficiency of multimodal data pipelines, so that data decoding, preprocessing, and feature transfer do not become training bottlenecks.
Overall, training adaptation for ultra-large models is a systems engineering effort. It requires enough hardware compute, and it also requires a software stack that works as a complete loop across model loading, parameter sharding, communication scheduling, numerical stability, and fault recovery. A native fully sharded distributed training path can ease memory capacity pressure, improve cluster resource utilization, and provide a technical foundation for training larger models with more complex modality combinations.
