FSDP2 Adaptation for Trillion-Parameter Model Training on Domestic Chips

    This article explains how to adapt FSDP2 for training a 2.8-trillion-parameter model on domestic accelerators. It covers memory and communication estimates, FSDP2 sharding, chunked model loading, multimodal branch scheduling, training pipeline stages, pre-launch checks, and public-cloud versus self-built cluster choices. It is intended to help teams with thousand-GPU clusters plan capacity, overlap loading, computation, and communication, and validate the training stack before launch.

    Takeaway first: for a 2.8-trillion-parameter model, the core adaptation work is to shard parameters, gradients, and optimizer states across thousands of accelerators while overlapping loading, computation, and communication as much as possible. FSDP2 handles memory sharding; chunked loading shortens startup time; the way gradient communication is combined determines throughput. This article provides estimation methods and checkpoints for these stages. It is intended for teams that already operate thousand-GPU clusters and are preparing trillion-parameter training. Small clusters cannot directly reuse the card counts and bandwidth figures below.

    1. Estimate Memory and Communication First

    Capacity must be estimated before training. When weights are stored in FP16 or BF16, each parameter takes 2 bytes, so 2.8 trillion parameters require about 5.6 TB (decimal, roughly 5.1 TiB). If weights are stored in FP32, they require about 11.2 TB. Mixed-precision training also stores FP32 master weights, gradients, and the momentum and variance of the Adam optimizer. The full state per parameter is usually between 12 and 16 bytes, or about 34 TB to 45 TB overall. At 80 GB per GPU, the theoretical lower bound for static state alone is about 425 to 560 GPUs. Activations, communication buffers, and memory fragmentation will consume more space, so the actual GPU count must be higher than this lower bound.

    Communication volume is also significant. Gradients are synchronized at every training step, and BF16 gradients are on the order of 5.6 TB. If inter-GPU bandwidth is insufficient, compute units will wait for long periods. Therefore, intra-node interconnect and cross-node network bandwidth should be confirmed during planning, along with whether communication can overlap with computation.

    2. How FSDP2 Shards State

    FSDP (Fully Sharded Data Parallel) distributes parameters, gradients, and optimizer states across data-parallel processes. Each GPU holds only one shard for the long term. FSDP2 is based on a per-parameter sharded representation, usually sharding along dimension 0, and supports layer-by-layer wrapping and on-demand reloading.

    During forward computation, GPUs use AllGather to temporarily assemble the full parameters of the current layer. After computation, each GPU releases the shards it does not own, lowering peak memory. During backward computation, each GPU obtains full gradients, uses ReduceScatter to sum them, and shards the result back. Each GPU keeps only the update values it is responsible for. Optimizer updates apply only to local shards and do not require synchronizing all parameters again.

    FSDP is a memory optimization technique for data parallelism and does not change how each layer is computed. Tensor parallelism splits a single matrix multiplication across multiple GPUs, often by rows or columns. The two can be combined: tensor parallelism within a layer and FSDP sharding across layers. Whether to combine them, and to what degree, depends on layer width and interconnect bandwidth.

    Before enabling FSDP2, confirm the following: the framework and version number; the granularity of the sharding unit, usually a Transformer layer; whether full parameters are released after forward computation, which trades memory for communication; and the data types used for parameters and gradients in mixed precision.

    3. Model Loading: Overlap Chunked Reads with Broadcast

    Reading all weights into host memory and then distributing them may take hours at the 2.8-trillion-parameter scale, and it can easily exceed the memory limit of a single host. A safer approach is to split the model file into multiple shards by layer. Designated nodes read one shard, broadcast it over a high-speed network to the corresponding compute GPUs, and simultaneously begin reading the next shard. Once reading and broadcasting overlap, loading time is determined by the slower of storage throughput and network bandwidth.

    Memory mapping (mmap) can be used during loading to avoid a full copy. Shard metadata must be bound to the parallel configuration. If the GPU count or sharding method changes, the model must be re-sharded; otherwise, the loaded result will be misaligned.

    4. Scheduling and Communication for Multimodal Branches

    The model processes text, images, and audio, and the structures of its modality encoders differ considerably. It is recommended to wrap the visual encoder, audio encoder, and backbone Transformer as independent FSDP units. This prevents parameters and gradients from different modalities from interfering with each other and makes it easier to debug a specific branch.

    The alignment data between modalities is far smaller than the backbone parameters and can be transferred using point-to-point communication. The backbone network uses global gradient aggregation. When image sizes are variable, tensor shapes change with each sample, so the framework must support dynamic shapes. Activation recomputation can reduce the memory footprint of intermediate feature maps at the cost of an additional forward computation. Whether to enable it depends on the actual gap between memory headroom and throughput. Record peak memory for each shape range, and enable recomputation only for shapes above a threshold, avoiding global enablement that reduces throughput.

    5. Key Stages in the Training Pipeline

    The full pipeline includes data preprocessing, model loading, forward propagation, backward propagation, gradient synchronization, optimizer updates, and checkpoint saving.

    Data preprocessing uses multithreaded decoding and prefetching to avoid leaving accelerators idle while waiting for data. Forward computation uses BF16 while retaining FP32 master weights to ensure numerical stability in optimizer updates. Gradient synchronization uses gradient accumulation and ReduceScatter. By accumulating gradients across multiple microbatches, cross-node communication frequency can be reduced and communication can overlap with backward computation.

    Checkpoint saving is the most error-prone stage. Asynchronous writes reduce training pauses, but if a node fails during writing, an incomplete file may be left behind. In practice, three measures should be taken. First, write to a temporary directory, verify the hash or size of all shards, and then rename the files to make them effective. Second, keep at least two historical versions for rollback. Third, before restoring, verify that the metadata matches the current parallel configuration. Incremental saving writes only changed shards and can shorten save time, but restoration must be able to reconstruct the full state; otherwise, the resulting copy is unusable.

    6. Pre-Launch Checklist

    1. Memory: Record peak memory at each stage, use measured rather than theoretical values to determine batch size, and keep headroom.
    2. Communication: Use profiling tools to measure the communication share and identify the most time-consuming collective operation. NVIDIA Nsight Systems can show timelines for compute and communication streams. Gaps between communication segments indicate scheduling waits.
    3. Batch size: Dynamically adjust the per-GPU batch size according to memory headroom, and log the actual values.
    4. Topology: Group GPUs within the same rack or high-speed interconnect domain into communication groups to reduce cross-rack traffic.
    5. Checkpoints: Run a restore drill after each save to confirm that training can load and continue.

    7. Public Cloud vs. Self-Built Clusters

    Teams without their own clusters can rent public cloud accelerator instances and request resources on demand. When choosing a cloud service, verify the accelerator model and interconnect bandwidth, whether it provides distributed training components compatible with the target framework, and object storage read throughput. Monitoring, alerting, and logging services help detect node anomalies early. Platform-provided optimization components still need to be tuned for the model structure; default configurations are not necessarily optimal. Self-built clusters offer more control over data management and long-term costs, but they require a dedicated operations team to handle failure recovery.

    8. Conclusion

    For adapting a 2.8-trillion-parameter model, the key is to first estimate memory and communication volume, then choose an appropriate sharding method, and finally validate each item with a checklist. FSDP2 solves the memory problem, chunked loading solves the startup-time problem, and overlapping communication with computation determines training throughput. For platform builders, turning these steps into a reusable toolchain offers more long-term value than one-off manual tuning.