Parallelism Strategy Selection for Trillion-Parameter Model Training Adaptation

    This article explains how to choose a parallelism strategy when training trillion-parameter open multimodal models on training-and-inference integrated compute cards. It covers the memory, communication, and load-imbalance constraints, compares DDP, FSDP/ZeRO-3, tensor parallelism, pipeline parallelism, and expert parallelism, and summarizes key practices for model loading and weight sharding.

    If you want to train a trillion-parameter open multimodal model on domestic training-and-inference integrated compute cards, the first question is usually: how should the parallelism strategy be selected? This article starts from the training pipeline, explains the core issues that must be solved during adaptation, and provides configuration ideas that can be directly checked and executed.

    1. Three Walls in Adaptation

    Memory wall. Taking standard mixed-precision Adam as an example, each parameter requires about 16 bytes, including low-precision weights, low-precision gradients, FP32 master weights, and two groups of FP32 optimizer states. For 2.8 trillion parameters, the total model state is about 44.8 TB, far exceeding the memory capacity of any single card. Therefore, parameters, gradients, and optimizer states must be partitioned across multiple cards. Activations need to be compressed with activation checkpointing.

    Communication wall. After sharding, both forward and backward computation need to temporarily aggregate parameters, and gradients must be reduced back to each shard. If interconnect bandwidth is insufficient, or communication and computation are not overlapped, compute units will idle heavily and training throughput will drop.

    Load imbalance. Multimodal models usually contain a vision encoder, a cross-modal projection layer, and a language backbone. Their compute and memory footprints differ greatly. If they are split evenly by layer count, some devices will be overloaded while others remain idle for long periods.

    2. How to Choose a Parallelism Strategy

    Strategy What is sharded Main benefit Main cost When to use
    Data parallelism (DDP) Data batch Simple implementation, high throughput Each card stores the full model; cannot fit large models When the model fits on a single card
    Fully sharded data parallelism (FSDP / ZeRO-3) Parameters, gradients, optimizer states Memory usage decreases with the number of cards Multiple all-gathers in forward and backward; high communication volume Basic framework for trillion-parameter dense models
    Tensor parallelism (TP) Matrices within a single layer Reduces per-layer memory and compute Communication in every layer; high bandwidth requirements Intra-node high-speed interconnect, usually limited to the number of cards in one machine
    Pipeline parallelism (PP) Layers split into multiple stages Lower communication volume; suitable for cross-node use Pipeline bubbles; requires micro-batch scheduling Many layers and limited inter-node bandwidth
    Expert parallelism (EP) MoE experts Expert parameters are distributed; only some experts are activated each time Token routing introduces all-to-all communication Models using MoE structures

    A common combination is: FSDP handles parameter and state sharding, tensor parallelism is limited to within a node, pipeline parallelism is used across nodes, and expert parallelism is used for the MoE expert dimension. The exact ratio needs to be tested against the cluster topology and model structure; there is no fixed answer for all scenarios.

    3. Key Stages in the Complete Training Pipeline

    3.1 Model Loading and Weight Sharding

    There are three points to note when loading very large weights.

    1. Use sharded checkpoints, and each process reads only the shard it is responsible for. If every process reads the full weights, host memory will show obvious spikes.
    2. Build the model structure on the meta device, where real memory is not allocated, and then materialize weights block by block according to the shard mapping.
    3. Pipeline storage reads and device copies so that data reading overlaps with compute preparation and startup time is shortened.

    The following is an illustrative code snippet (error handling omitted; read_index, load_tensor, and get_device are assumed helper functions, and device names need to be replaced according to the vendor framework conventions):

    1. import torch
    2. import torch.distributed as dist
    3. def load_sharded_model(build_fn, ckpt_dir, rank):
    4. # 1. Build the structure on the meta device without allocating real GPU memory
    5. with torch.device("meta"):
    6. model = build_fn()
    7. # 2. Read the shard index and take only the shard assigned to this process
    8. shard_index = read_index(...)