Key Engineering Considerations for Adapting Large Model Training to Domestic AI Chips

    This article covers the key engineering considerations for adapting a 2.8-trillion-parameter MoE multimodal model to domestic AI chips. It explains the memory, communication, and scheduling bottlenecks, the FSDP2 sharding mechanism, activation checkpointing and mixed-precision trade-offs, how to combine expert, tensor, and data parallel strategies, and the practical model-loading and multimodal data-loading steps that determine whether training runs efficiently.

    The problem: what 2.8 trillion parameters mean

    Training a 2.8-trillion-parameter MoE multimodal model simultaneously hits three types of bottlenecks: memory, communication, and scheduling. Understanding these bottlenecks is the first step to judging whether an adaptation plan is reliable and to reusing the effective practices in your own projects.

    Start with a rough memory estimate. If weights are stored in BF16, each parameter takes 2 bytes, so 2.8 trillion parameters require about 5.6 TB of memory for weights alone. With 80 GB per card, just storing the weights requires at least 70 cards, before counting gradients, optimizer states, or activations. If Adam is used with FP32 master weights, momentum, and variance, the optimizer state alone needs about 12 bytes per parameter, or roughly 33.6 TB. Adding BF16 weights and gradients brings the static footprint to about 16 bytes per parameter, or roughly 44.8 TB. These are estimates; actual numbers depend on precision configuration, whether CPU offload is used, and the parallel strategy.

    Three bottlenecks

    Memory bottleneck. A single card is far smaller than the total model requirement, so parameters, gradients, and optimizer states must be distributed across multiple cards. Simply using larger cards does not solve the problem.

    Communication bottleneck. After parameters are sharded, each layer needs All-Gather to collect parameters before the forward pass and Reduce-Scatter to aggregate gradients after the backward pass. Communication volume grows with parameter count, while network bandwidth usually does not grow at the same rate. The degree to which communication overlaps computation directly determines training throughput.

    Scheduling bottleneck. Multimodal inputs have very different sequence lengths, and different experts in a MoE model receive uneven numbers of tokens. That imbalance leaves some devices fully loaded while others idle, slowing down every training step.

    Why this adaptation matters

    For practitioners, the value of this type of adaptation case is to verify whether domestic AI chips can support extremely large training workloads. Public articles often just present conclusions and omit version, dependency, and measurement conditions. The sections below follow the engineering workflow so readers can verify the details themselves.

    Technical path: how FSDP2 shards parameters

    FSDP, or Fully Sharded Data Parallel, shards model parameters, gradients, and optimizer states across the processes in a data-parallel group. In PyTorch, FSDP2 is represented by the fully_shard interface. Sharding is organized by module, and parameters are represented as DTensors.

    The basic flow is:

    1. Before a layer’s forward pass, All-Gather that layer’s parameters to obtain the full parameter set.
    2. After the layer computation finishes, release non-local shards and keep only the shard owned by the current card.
    3. After a layer’s backward pass, Reduce-Scatter gradients so each card keeps only the gradient shard it owns.
    4. The optimizer updates only the local shard, so optimizer states also need to be stored only for that local shard.

    For MoE models, sharding granularity is critical. If all experts in a layer are encapsulated as one module, the forward pass will collect parameters for all experts in that layer. If each expert is encapsulated as an independent submodule, it is theoretically possible to collect only the experts that are actually invoked. However, the training code must organize experts as independent modules, and the framework’s actual behavior under sparse invocation must be verified. During migration, start with a small-scale model and observe the memory curve.

    Activation checkpointing

    Activations are often a major source of peak memory usage. Activation checkpointing saves activations for only some layers and re-executes the forward pass for the remaining layers during backward computation. It trades extra computation for lower memory usage, at the cost of longer per-step time. Whether to enable it, and for which layers, should be decided based on memory headroom and throughput targets.

    Mixed precision

    BF16 is a common choice for large model training today. FP8 can reduce the data volume for both computation and communication, but it requires framework and hardware support, and the loss curve must be verified against the baseline. Whether FP8 is adopted should ultimately depend on convergence results.

    Choosing a parallel strategy

    A multi-dimensional combination of parallel strategies is common for this class of models:

    • Expert parallel: place different experts on different devices, used for MoE layers.
    • Tensor parallel: split a layer’s matrix computation across multiple cards, used for attention layers or other large matrix layers. It is sensitive to interconnect bandwidth and is usually used inside a high-speed single node.
    • Data parallel with FSDP: shard parameters, gradients, and optimizer states across the remaining data-parallel dimension.

    When selecting a strategy, first set the tensor-parallel group size so it fits inside a single node. Then arrange expert parallel. Finally, use FSDP to cover the remaining data-parallel dimension. The product of all parallel dimensions should equal the total number of cards; otherwise some devices will be idle.

    Key stages: from loading to gradient synchronization

    Before gradients can be synchronized efficiently, model loading and data loading are the immediate practical constraints.

    Model loading

    Reading the complete set of weights into the CPU memory of one node can easily exceed memory limits at trillion-parameter scale. A feasible approach is for each node to read weight files in parallel and, based on a precomputed shard index, keep only the parameters needed by that node. Those parameters can then be copied asynchronously to the GPU. Loading speed depends on file system bandwidth, the number of nodes, and the model storage format. Measure the loading time in a real environment rather than relying only on theoretical estimates.

    Data loading

    Multimodal data needs a unified preprocessing pipeline. Common practices include padding or truncating each modality so that tensor shapes are consistent within a batch, and using a multi-process DataLoader with prefetching so the next batch is ready while the current step is computing. If data loading takes longer than computation, the GPU will be idle.