Training Ultra-Large Multimodal Models on Homegrown AI Compute: Adaptation Practices

    This article examines how to adapt ultra-large multimodal models for training on homegrown AI compute platforms. It outlines the infrastructure challenges at trillion-parameter scale, describes the hardware and software stack foundations, and presents a native FSDP2-style multimodal training path covering sharded model loading, hybrid parallel orchestration, and gradient synchronization. It also summarizes performance-tuning and engineering best practices such as communication-compute overlap, fine-grained memory management, mixed precision, observability, and elastic fault tolerance. The goal is to provide a practical reference for building stable, efficient end-to-end training pipelines on domestic AI accelerators.

    Training Ultra-Large Multimodal Models on Homegrown AI Compute: Adaptation Practices

    1. Background: Training Infrastructure Challenges in the Trillion-Parameter Era

    As open-source large models continue to scale toward trillions of parameters, model training places unprecedented demands on compute infrastructure. Consider a recently open-sourced 2.8-trillion-parameter flagship multimodal model. Its training process not only involves massive memory footprint but also includes heterogeneous processing flows for text, vision, and other multimodal data. Traditional single-GPU or simple data-parallel approaches have long been unable to meet these requirements.

    For developers and enterprises working with homegrown AI compute platforms, a key question is becoming increasingly important: how can complete training adaptation for such ultra-large models be achieved on domestic AI compute platforms? This is not only about diversifying compute supply, but also about building a full set of engineering capabilities across the training software stack, parallel strategies, and communication optimization. This article uses common industry technical approaches as a guide to break down the core stages of this adaptation process.

    The essence of training adaptation is to make the target model’s computation graph, memory layout, and communication patterns run correctly and efficiently on a specific hardware architecture and its accompanying software stack. It involves three layers of work: first, compatibility and optimization at the operator and kernel level; second, integration at the distributed parallel framework level; and third, stability validation of the end-to-end training pipeline. The following sections discuss each layer in turn.

    2. Hardware and Software Stack Foundations: The Role of Training-and-Inference AI Accelerators

    Ultra-large model training typically uses training-and-inference integrated AI accelerator cards as the compute foundation. These flagship AI accelerator cards generally have the following characteristics: high-bandwidth, large-capacity memory for holding sharded parameters, gradients, and optimizer states; high-speed card-to-card interconnect to support dense communication in tensor parallelism and pipeline parallelism; and general-purpose compute capability covering both training and inference scenarios.

    The native software stack that accompanies the hardware is the primary focus of adaptation work. A mature GPU software stack typically includes:

    • Driver and runtime layer: responsible for device management, memory allocation, stream scheduling, and kernel launch;
    • Operator library layer: provides high-performance implementations of core operators such as matrix multiplication, normalization, and attention;
    • Communication library layer: implements collective communication primitives such as AllReduce, AllGather, and ReduceScatter, and is key to distributed training performance;
    • Framework adaptation layer: connects to mainstream deep learning frameworks so that upper-layer training code can migrate to new hardware with minimal changes.

    When adapting trillion-parameter models, the performance of communication libraries and operator libraries often becomes the bottleneck. For example, All-to-All communication in Mixture-of-Experts (MoE) architectures and block-wise computation in long-sequence attention both require deep optimization for specific hardware characteristics.

    3. Building a Native FSDP2-Style Multimodal Training Path

    Fully Sharded Data Parallel (FSDP) is a mainstream parallel paradigm for current ultra-large model training. Its next-generation implementation, commonly referred to in the industry as FSDP2, is characterized by per-parameter sharding and more flexible hybrid parallel combinations. Building a native FSDP2-style multimodal training path on homegrown compute requires integrating the following complete chain.

    3.1 Model Loading and Sharded Initialization

    A trillion-parameter model cannot be fully loaded on any single card, so the loading stage itself must be sharded. A typical approach is to use meta device initialization: first build the model structure on a logical device that consumes no actual memory, and then have each training process materialize only the parameter shard that belongs to it according to the sharding strategy. Illustrative code is shown below:

    1. # Illustration: sharded model loading flow
    2. with torch.device("meta"):
    3. model = build_multimodal_model(config)
    4. for name, param in model.named_parameters():
    5. shard = shard_plan.partition(name, param, world_mesh)
    6. param.data = load_checkpoint_shard(ckpt_dir, name, shard.rank_slice)

    The key point here is that the shard plan must align with the model structure. A multimodal model usually contains multiple substructures such as a vision encoder, a language backbone, and a cross-modal alignment module. Different substructures differ significantly in parameter scale and compute density, so a grouped sharding strategy is preferable to avoid load imbalance within a single group.

    3.2 Sharded Scheduling and Hybrid Parallel Orchestration

    FSDP2-style sharded scheduling emphasizes communication on demand: when forward computation enters a module, the module’s full parameters are temporarily gathered via AllGather; after computation completes, they are released immediately and only the shards are retained. The backward pass works similarly, with gradients reduced and scattered directly to their respective owners via ReduceScatter.

    For multimodal models, scheduling orchestration also needs to consider the coupling of two data pathways. A common practice is to use data parallelism or a smaller degree of tensor parallelism for the vision encoder, use FSDP full sharding for the language backbone, and divide subgroups on the device mesh, thereby balancing communication overhead and memory usage. An illustrative declarative definition of a device mesh is shown below:

    1. # Illustration: a two-dimensional device mesh
    2. mesh = init_device_mesh("gpu", (dp_size, tp_size), mesh_dim_names=("dp", "tp"))
    3. sharded_model = apply_fsdp2(model, mesh=mesh["dp"])

    3.3 Gradient Synchronization and Closing the Training Loop

    The final link in the complete training pipeline is gradient synchronization and optimizer state management. Under the FSDP framework, gradient synchronization is naturally decomposed into ReduceScatter operations for each parameter shard, and communication can overlap with backward computation to hide communication latency. Optimizer states are also held in shards, so memory usage decreases approximately linearly with cluster size. This is the fundamental reason FSDP can support trillion-parameter training.

    After the pipeline is integrated, systematic correctness validation is still required. This includes loss-curve alignment validation on small-scale clusters, gradient numerical consistency checks, and round-trip consistency tests for checkpoint save/load. Only after all these stages pass can training be scaled out to large clusters for formal runs.

    4. Performance Tuning and Engineering Best Practices

    Completing an adaptation that “can run” is only the first step. “Running well” requires continuous performance engineering. Common industry best practices include:

    1. Communication-compute overlap: use bucketing and prefetch strategies to hide parameter gathering and gradient reduction under computation as much as possible;
    2. Fine-grained memory management: combine activation checkpointing with memory-pool allocation to reduce OOM risks caused by fragmentation;
    3. Mixed-precision training: adopt the industry-standard approach of low-precision forward computation with high-precision master weights and gradient reduction to balance throughput and convergence stability;
    4. Observability: integrate general monitoring, alerting, and logging capabilities; instrument per-step latency, communication bandwidth, and memory watermarks to provide data for fault localization and slow-node troubleshooting;
    5. Elastic fault tolerance: hardware failures are normal in large-scale cluster training, so asynchronous checkpointing and fast recovery capabilities are needed to minimize training loss caused by failures.

    It is worth noting that when building such training platforms, enterprises can also use general-purpose public cloud product capabilities to reduce infrastructure burden, for example using object storage to host training corpora and checkpoints, container platforms to orchestrate training jobs, and message queues to decouple data preprocessing from training workflows. Mainstream cloud providers such as Baidu AI Cloud offer these general product categories, which can serve as supplementary options for training infrastructure.

    5. Conclusion and Outlook

    Training adaptation for ultra-large multimodal models on homegrown AI compute platforms is a comprehensive engineering effort spanning hardware architecture, software stacks, parallel algorithms, and systems engineering. The three-stage path described in this article—sharded loading, scheduling orchestration, and gradient synchronization—along with the native FSDP2-style training path, represents a mainstream direction of current industry practice. As homegrown AI compute hardware and software ecosystems continue to mature, the barrier to such adaptation work will steadily decrease, providing a solid foundation for more enterprises and research institutions to conduct independent large-model training. Looking ahead, directions such as integrated resource scheduling for training and inference and cross-cluster elastic training deserve continued attention from developers.