Key Paths and Engineering Practices for Adapting Ultra-Large Multimodal Model Training

    In ultra-large model training, hardware computing power is not the sole determinant of success. Factors such as stable model loading, reasonable parameter partitioning, efficient synchronization across computing cards, and rapid recovery from anomalies directly impact overall training efficiency. Recently, a team successfully adapted a 2.8-trillion-parameter multimodal model for training on domestic AI accelerators, building a native full-parameter sharding training path that streamlines critical stages from model loading and shard scheduling to forward computation, backpropagation, gradient synchronization, and checkpoint recovery. This practice demonstrates that migrating training for ultra-large models requires an end-to-end system overhaul rather than simple low-level operator replacement.

    In ultra-large model training, hardware computing power is not the sole determinant of success. Whether the model can be loaded stably, whether parameters can be partitioned reasonably, whether different computing cards can synchronize efficiently, and whether training tasks can recover quickly from anomalies will directly affect overall training efficiency.

    Recently, a team announced the completion of training adaptation for a multimodal model with approximately 2.8 trillion parameters on domestic AI accelerators. They built a native full-parameter sharding training path around the accelerator software stack, connecting key stages such as model loading, shard scheduling, forward computation, backpropagation, gradient synchronization, and checkpoint recovery. This practice demonstrates that adapting the migration of ultra-large models is not simply about replacing underlying operators, but requires an end-to-end overhaul of the training system.

    1. Why Adapting Ultra-Large Models is Challenging

    When a model scales to the trillion-parameter level, a single card’s memory can hardly accommodate the complete model. Taking half-precision parameters as an example, saving just the model weights consumes a massive amount of memory; if gradients, optimizer states, and temporary activations are further calculated, the actual memory requirement multiplies.

    Therefore, training systems typically need to adopt multi-dimensional parallel strategies, including:

    • Data Parallelism: Different devices process different data batches;
    • Tensor Parallelism: Splitting a single layer’s computation across multiple devices;
    • Pipeline Parallelism: Distributing different network layers to different devices;
    • Parameter Sharding: Distributing parameters, gradients, and optimizer states across devices;
    • Activation Recomputation: Trading extra computation for memory space.

    For multimodal models, the training process also involves encoding and fusing data from text, images, or other modalities. The varying data lengths, computational volumes, and memory footprints across different modalities further complicate batch organization and load balancing.

    2. Core Value of Native Full-Parameter Sharding Training

    The basic idea of full-parameter sharding is to avoid having each device save a complete model replica. Instead, parameters, gradients, and optimizer states are partitioned according to the number of devices. During training, the system temporarily gathers the corresponding parameters only when a specific layer needs to be computed, and releases or re-shards them after computation.

    This mechanism can significantly reduce the memory pressure on a single card, primarily in three aspects:

    1. Lowering Resident Model Memory

    During the model initialization phase, the device only receives its own parameter shard rather than the complete weights. For ultra-large models, this approach determines whether the model can even start.

    2. Reducing Redundant Data Replication

    Traditional data parallelism often requires keeping a complete model copy on each card. As the number of devices increases, so do the parameter replicas. Sharded training avoids this redundant storage, freeing up more memory for activations, temporary tensors, and larger training batches.

    3. Unifying Training and Scaling Paths

    If the sharding mechanism is directly integrated into the model execution flow, consistent data lifecycle management can be established across model loading, forward computation, backpropagation, and optimizer updates, reducing compatibility issues caused by additional wrappers.

    It is worth noting that sharding does not mean communication costs disappear. Every parameter gathering, gradient synchronization, and state update may introduce cross-device communication, so the actual effect depends on the communication topology, memory management, and compute-communication overlap capabilities.

    3. Complete Technical Chain of the Adaptation Work

    1. Model Loading and Parameter Initialization

    Loading an ultra-large model cannot adopt the approach of “building the complete model in host memory first, then copying it entirely to the device,” as this easily leads to excessive host memory peaks, insufficient device memory, and long loading times.

    A more reasonable process includes:

    1. First establish the model structure and parameter meta-information;
    2. Calculate sharding ownership based on the number of devices;
    3. Read weights according to the shard range;
    4. Place the corresponding data directly onto the target device;
    5. Complete parameter layout and communication group initialization.

    For multimodal models, it is also necessary to handle the text encoder, visual encoder, and cross-modal connection layers separately to ensure consistent parameter sharding rules across different modules.

    2. Shard Scheduling and Parameter Lifecycle

    During training, parameters need to switch between “sharded storage” and “temporary gathering.” The system must explicitly define when each layer’s parameters are loaded, when they participate in computation, and when they are released, avoiding gradual memory increases caused by parameters residing long-term.

    A typical lifecycle can be abstracted as:

    1. Parameter sharding
    2. ↓
    3. Gather before computation
    4. ↓
    5. Execute forward or backward computation
    6. ↓
    7. Release temporary full parameters
    8. ↓
    9. Gradient sharding and synchronization
    10. ↓
    11. Optimizer update

    In engineering implementation, focus should be placed on temporary buffer reuse, memory fragmentation control, and asynchronous communication completion status. If data is released before communication is complete, it may cause illegal access; if released too late, it will cause the memory peak to exceed expectations.

    3. Gradient Synchronization and Optimizer State Management

    After backpropagation, each device only has local gradients. The training system needs to perform reduction operations to merge gradients and re-shard the results to different devices.

    For large-scale models, the optimizer state usually takes up more space than the parameters themselves, so it should also be sharded. The update process can be executed according to the following logic:

    • The current device receives the corresponding parameter shard;
    • Obtains the gradient matching that shard;
    • Updates the local optimizer state;
    • Completes parameter updates;
    • Keeps the new parameters in a sharded state.

    This design avoids regenerating a full model replica during the optimizer update phase.

    4. Additional Challenges in Multimodal Training

    Multimodal training is not simply about concatenating two models. The data preprocessing methods, sequence lengths, and computational densities of different modalities differ significantly and must be managed uniformly at the training orchestration level.

    First, the data loading module must ensure that samples from different modalities are paired correctly, handling missing data, length inconsistencies, and dynamic padding. Second, the batching strategy cannot be divided solely by sample count; it should also consider the total number of tokens, image resolution, or other input scales to prevent some devices from becoming stragglers due to oversized inputs.

    Additionally, the cross-modal connection layers in multimodal models usually affect the gradient propagation path. During adaptation, the following should be verified:

    • Whether the data types and layouts output by various modal encoders are consistent;
    • Whether the cross-modal attention computation supports the target acceleration device;
    • Whether dynamic length inputs will trigger extra memory allocations;
    • Whether backpropagation can cover all trainable modules;
    • Whether the losses from different modalities can be stably aggregated.

    5. Hardware-Software Co-optimization Focus

    After completing basic adaptation, optimization around the accelerator software stack is required. The focus should not be limited to individual operators but on the overall execution graph.

    Operators and Data Types

    Priority should be given to confirming the support status of matrix computation, normalization, attention, activation functions, and communication-related operators. For operators lacking efficient implementations, equivalent combinations or fallback paths can be used, but numerical results and training stability must be verified.

    Compute and Communication Overlap

    When one layer executes computation, the next layer’s parameters can be prepared in parallel, or gradient communication can be initiated early during backpropagation. Reasonable pipelining can reduce device wait times, but data consistency must be ensured through event dependencies and state management.

    Memory Reuse

    Activations, temporary matrices, and communication buffers in training tasks have distinct phases. Through a unified memory pool, buffer reuse, and lifecycle analysis, peak memory usage can be reduced, minimizing the overhead from frequent allocations and releases.

    Topology Awareness

    The connection bandwidth and communication distance between devices are not entirely uniform. Sharding strategies, communication groups, and task mapping should align with the hardware topology as closely as possible to reduce cross-node communication and prevent a few links from becoming overall bottlenecks.

    6. Verifying if Adaptation is Truly Complete

    “The model can start” does not mean “training adaptation is complete.” Comprehensive verification should cover at least the following levels:

    1. Correctness Verification: Check if forward outputs, loss values, gradient directions, and parameter updates meet expectations.
    2. Consistency Verification: Under the same inputs and random seeds, compare numerical errors across different hardware paths.
    3. Stability Verification: Conduct long-term training to observe for memory leaks, gradient anomalies, communication blocks, or loss divergence.
    4. Scalability Verification: Gradually increase the number of devices to check if throughput improvements are reasonable and if communication overhead rises too quickly.
    5. Recovery Capability Verification: Simulate device failures, task interruptions, and checkpoint loading to confirm training can resume from a specified state.
    6. Resource Efficiency Verification: Record peak memory, compute utilization, communication ratios, and data loading wait times to provide a basis for subsequent optimization.

    7. Implementation Suggestions for Production Environments

    For enterprise-level training tasks, it is recommended to split the adaptation work into three phases. The first phase completes single-device operator and numerical verification to ensure the basic model execution path is correct; the second phase introduces multi-device sharding, focusing on communication, memory, and gradient synchronization; the third phase conducts long-run, fault recovery, and scale expansion testing.

    Simultaneously, a unified logging and monitoring system should be established to continuously collect device utilization, memory usage, communication time, data wait times, and checkpoint statuses. For ultra-large-scale training, any sporadic error can incur high costs, so anomaly detection and automatic recovery capabilities should be built concurrently with training functionalities.

    Overall, the adaptation of ultra-large multimodal models to domestic hardware is essentially a system-level engineering reconstruction of the training system. Only by unifying model structure, sharding strategy, memory management, communication mechanisms, operator implementation, and operational monitoring can a stable, scalable, and reusable training infrastructure be formed. These practices also provide a general technical foundation for the migration and training of even larger parameter models in the future.