Training Ultra-Large-Scale Open-Source Models on Domestic AI Accelerators: A Distributed Training Adaptation Practice

    This article examines the engineering practice of adapting a trillion-parameter open-source multimodal model for training on domestic AI accelerators. It covers the three core challenges of ultra-large-scale model training—the memory wall, heterogeneous multimodal workloads, and communication-computation coordination—and explains how to build a native training pipeline based on FSDP2 (Fully Sharded Data Parallel v2), from model loading and sharded initialization to gradient synchronization and optimizer updates. Readers will gain a clear understanding of the key techniques for distributed training of large-scale sparse models, including tensor sharding, expert parallelism, gradient checkpointing, and communication overlap.

    1. Background: Open-Source Flagship Models Enter the Trillion-Parameter Era

    Recently, an AI research organization open-sourced a flagship multimodal large model with 2.8 trillion total parameters, setting a new scale record for the open-source community. Ultra-large sparse models like this one—typically built on a Mixture-of-Experts (MoE) architecture—demonstrate strong reasoning and multimodal understanding capabilities, but their sheer parameter scale places unprecedented demands on training infrastructure: a single accelerator card cannot possibly hold the full model in memory, so training or fine-tuning requires distributed parallelism strategies spanning multiple cards and nodes.

    At the same time, the domestic AI computing ecosystem is maturing rapidly. Completing training adaptation for such top-tier open-source models on domestic training-and-inference accelerators with their accompanying software stacks has become an important litmus test for the engineering capabilities of domestic computing platforms. Using this adaptation practice as a starting point, this article strips away product-specific details and analyzes the critical path of distributed training for ultra-large multimodal models from a general technical perspective.

    2. Three Core Challenges of Ultra-Large-Scale Model Training

    1. The memory wall and parameter sharding

    Even stored in FP16, 2.8 trillion parameters require several terabytes of memory for weights alone—not to mention optimizer states and gradients. Under a Mixture-of-Experts architecture, although each token only activates a subset of parameters, all expert weights must remain resident during training. This makes Fully Sharded Data Parallel (FSDP)-style techniques essential: parameters, gradients, and optimizer states are sharded across all devices, breaking the model into manageable pieces.

    2. Heterogeneous multimodal workloads

    Multimodal models process text, images, audio, and other inputs simultaneously. Different modalities vary greatly in sequence length and computational cost, which can easily cause load imbalance across devices. The training framework needs careful design in data loading, sequence packing, and micro-batch scheduling to avoid the “weakest link” effect dragging down overall throughput.

    3. Communication-computation coordination

    Parameter sharding means frequent all-gather and reduce-scatter communications during forward and backward passes. In clusters with tens of thousands of cards, communication overhead can exceed computation itself. Hiding communication latency through compute-communication overlap, gradient bucketing, and topology-aware scheduling directly determines effective compute utilization.

    3. Building a Native FSDP2 Multimodal Training Path

    The core of the adaptation work is building a native multimodal training path based on the new-generation Fully Sharded Data Parallel interface (commonly known as FSDP2). Compared with earlier versions, the new interface uses per-tensor sharding (rather than per-module wrapping), which brings three benefits:

    • Finer-grained memory control: Parameters exist as distributed tensors and are sharded at initialization, avoiding the memory spikes caused by loading the full model before splitting it, as in traditional approaches.
    • More flexible hybrid parallelism: It can be freely combined with tensor parallelism, expert parallelism, and pipeline parallelism. For MoE models, additional sharding can be applied along the expert dimension.
    • More composable API semantics: Training code is decoupled from parallelism strategy, so the same model definition can be reused under different parallel configurations, reducing migration costs.

    On this foundation, targeted modifications are needed for multimodal architectures: the vision encoder and language backbone use different sharding strategies; dynamic shape support is enabled for variable-length sequences to avoid frequent recompilation; and load-balancing constraints are introduced for expert routing to prevent hot experts from becoming communication bottlenecks.

    4. Completing the Full Training Pipeline: From Loading to Gradient Synchronization

    A production-ready native training pipeline typically includes the following stages:

    1. Model loading and sharded initialization. Through lazy initialization and distributed tensor interfaces, each device only instantiates the parameter shards it is responsible for. During weight loading, shards are placed directly according to the shard mapping, reducing both startup time and peak memory usage.

    2. Data pipeline and shard scheduling. The data loading layer splits samples by global batch, with dynamic bucketing and packing based on sequence length, so each device receives micro-batches of similar computational cost. Multimodal samples are aligned and encoded during preprocessing to reduce CPU blocking in the main training loop.

    3. Forward and backward computation. During the forward pass, parameter shards are all-gathered on demand and released immediately after use. Combined with gradient checkpointing, recomputation trades extra compute for reduced activation memory, making room for larger batch sizes.

    4. Gradient synchronization and optimizer updates. During the backward pass, gradients are aggregated on the fly via reduce-scatter, with communication and computation fully overlapped. The optimizer maintains states only for local parameter shards; after updating, new parameter shards are broadcast to devices that need them. Throughout this process, communication primitives must work with awareness of the underlying interconnect topology, prioritizing high-bandwidth intra-node links.

    1. # Example: core skeleton of native sharded training (pseudocode)
    2. model = apply_fully_shard(model, mesh=device_mesh) # shard parameters across the device mesh
    3. optimizer = build_sharded_optimizer(model.parameters())
    4. for batch in sharded_dataloader:
    5. loss = model(batch) # forward: gather parameters on demand
    6. loss.backward() # backward: bucketed gradient reduction
    7. optimizer.step() # update only local shards
    8. optimizer.zero_grad()

    5. Engineering Validation and Ecosystem Significance

    After adaptation is complete, validation in multi-node, multi-card environments must cover convergence correctness (aligning loss curves with a reference implementation), throughput scalability (whether efficiency degradation remains acceptable as node counts grow), and long-run stability (checkpoint resumption and fault recovery). Together, these metrics determine whether a domestic AI computing platform can support training top-tier models.

    From an ecosystem perspective, the value of such adaptation practices goes beyond a single model: they verify the compatibility of domestic software stacks with mainstream distributed training paradigms, paving the way for migrating more open-source models. For enterprise users—whether building their own clusters or using general-purpose AI computing services on platforms such as Baidu AI Cloud—understanding FSDP sharding principles and the design considerations of multimodal training pipelines is essential knowledge for large model fine-tuning and continued pre-training.

    6. Conclusion

    The emergence of trillion-parameter open-source models is pushing distributed training engineering to a new level of complexity. A native FSDP2-based skeleton, a fully connected end-to-end pipeline, and communication-computation coordination as the optimization mainline currently represent the most broadly applicable technical path. As domestic computing power and software stacks continue to evolve, developers will have more options for running such top-tier models on their own infrastructure.