Trillion-Parameter Multimodal Model Training on AI Accelerator Cards: Native FSDP Adaptation Practice

    This article examines the engineering work required to adapt a flagship AI accelerator and software stack to a 2.8-trillion-parameter open multimodal model that unifies text, image, and video. It explains the main challenges—memory pressure, heterogeneous multimodal compute, and long-running stability—and describes how native Full-Sharded Data Parallel (FSDP) distributes parameters, gradients, and optimizer states across devices. It also covers model loading, sharding, operator and precision adaptation, gradient synchronization, checkpointing, performance tuning, and cloud-based infrastructure for large-scale training.

    1. From Single-Node Multi-GPU to 10,000-GPU Clusters: Three Challenges in Trillion-Parameter Multimodal Training

    Recently, a leading large-model vendor open-sourced a flagship multimodal model with about 2.8 trillion parameters. The model unifies text, image, and video modeling, raising the scale ceiling for open-source models again. After that, a flagship China-based AI accelerator card for training and inference, together with its software stack, completed training adaptation for the model. Through a native full-sharded data parallel path, the full chain from model loading and shard scheduling to gradient synchronization was connected.

    The significance is not just “one more supported model.” It shows a trend: trillion-parameter and multimodal workloads are moving from the exclusive domain of a few vendors to a common configuration in the open-source ecosystem. At the same time, China-based accelerator cards and computing platforms are increasingly becoming first-class citizens: training frameworks are designed to provide complete parallelism, precision, and communication capabilities for them by default.

    For developers and enterprises, this is an opportunity to understand what makes ultra-large-scale training difficult and how to solve it. The challenges can be summarized as three types:

    1. Memory wall caused by parameter scale

      • In BF16/FP16 mixed-precision training, one parameter copy is about 2 bytes, and one gradient copy is about 2 bytes.
      • Adam-like optimizers also need to store first- and second-order moments for each parameter. With common fp32 master weights and fp32 moments, the total is about 12 bytes.
      • The model state alone is about 16 bytes per parameter. For 2.8 trillion parameters, this is close to 45 TB, far beyond the memory capacity of a single GPU, which is typically only tens of GB.
    2. Heterogeneous compute and communication pressure from multimodality

      • Vision encoders are compute-intensive and rely on convolution or attention-like operators.
      • Modality projection layers map visual features into the language space.
      • The language backbone is mainly based on attention and expert layers. Different layers have very different requirements for compute intensity, memory bandwidth, and communication patterns.
      • Image resolution, frame rate, video duration, and image-text ratios vary greatly, making it difficult to keep per-GPU workloads balanced.
    3. Engineering complexity caused by long stable operation

      • Trillion-scale training can run for weeks, and single-node or single-GPU failures are almost inevitable.
      • Whether checkpoints can be stored, saved quickly, and recovered accurately directly determines effective training time.

    In terms of the software ecosystem, there is a third threshold to cross. Parallelism, precision, and communication implementations in mainstream training frameworks are often designed first for mainstream international accelerators. For China-based accelerators, operator coverage, communication backends, graph capture and operator fusion, and numerical precision all need to be validated one by one. A one-off “model port” is far from enough. A native training path is required: the framework should natively recognize the device type on China-based hardware/software combinations, select the correct collective communication backend, automatically match sharding and mixed-precision strategies, while the training code itself remains independent of the framework version.

    2. Native Full-Sharded Data Parallel: Spreading Parameters, Gradients, and Optimizer States

    To understand the value of native full-sharded data parallel, it helps to first understand the main parallelism dimensions used in ultra-large-scale training:

    Parallelism What is split Main benefits Main costs and suitable scenarios
    Data parallelism (DDP) Data batches Simple implementation and regular communication Each GPU keeps a full model state, so memory is a constraint; suitable for small and medium models
    Full-sharded data parallel (FSDP) Parameters, gradients, and optimizer states Model-state memory decreases nearly linearly with the number of GPUs Forward and backward passes repeatedly gather and release parameters, increasing communication frequency; suitable for large-parameter models
    Tensor parallelism (TP) Inside a single-layer operator, such as attention heads or matrix multiplication dimensions Reduces memory and compute for a single layer Frequent intra-layer communication requires high inter-GPU bandwidth; suitable for high-interconnect scenarios within a node
    Pipeline parallelism (PP) Splits layers into several stages Memory decreases as the number of stages increases, with less cross-node communication Pipeline bubbles require scheduling techniques; suitable for scaling across nodes
    Sequence/context parallelism (SP/CP) Sequence dimension, such as tokens Supports very long contexts and high-resolution visual inputs Attention computation requires cooperation across ranks; suitable for long sequences and high-resolution video
    Expert parallelism (EP) Experts in a MoE model Distributes expert parameter memory Relies on all-to-all communication and load balancing; suitable for large-scale MoE

    The core idea of full-sharded data parallel can be summarized in one sentence: at any given moment, each GPU holds only a small part of the model, and when a layer is needed, the full parameters of that layer are temporarily gathered. The workflow is as follows:

    1. Initialization: Every rank holds one shard of the full model.
    2. Forward computation: Before entering an FSDP unit, all-gather the full parameters of that unit. Release them immediately after computation.
    3. Backward computation: All-gather parameters again, and use activation checkpointing to reuse activations. Gradient reduction uses reduce-scatter, and each GPU keeps only the gradients it owns.
    4. Optimizer update: Each rank updates only its own parameter shard, then all-gather the updated parameters.

    This mechanism provides three direct benefits:

    • Memory decreases nearly linearly: Model-state overhead drops from about 16 bytes per parameter to about 16/N bytes per parameter, where N is the number of data-parallel GPUs. For a 2.8-trillion-parameter model, model-state memory drops from about 45 TB to about 45/N TB.
    • It is naturally compatible with data parallelism: There is no need to manually split model code. Computation and data partitioning remain clear, making native framework support easier.
    • Gradient reduction is completed in one pass: reduce-scatter combines gradient reduction with sharding, avoiding the dual waste of full all-reduce plus redundant storage.

    The key to “native” support is to make the above workflow run on China-based accelerators without special-case handling. This involves four points:

    • Device and communication backend recognition: The framework needs to natively recognize China-based device types and correctly select the collective communication backend. This ensures that primitives such as all-gather, reduce-scatter, and all-to-all can be executed efficiently.
    • Automatic sharding strategy: The framework should automatically wrap modules based on model structure, rather than relying on developers to manually split the model.
    • Peak memory control: Limiting the number of units gathered at the same time can mitigate peak memory usage during the backward pass.
    • Checkpoint format: Checkpoints should be saved and loaded according to the sharded layout, avoiding memory amplification caused by merging weights before writing them out.

    Tuning note: Full-sharded data parallel does not exclude tensor parallelism, pipeline parallelism, or other schemes. In practice, they are often combined. Also, the data-parallel batch size should be designed based on the global shard count so that the number of local samples per rank is as evenly divisible as possible.

    3. Six Key Areas of Multimodal Training Adaptation

    3.1 Model Loading: From Single-Node Checkpoints to a Shard-Friendly Layout

    Loading a trillion-parameter model is itself an engineering challenge:

    • Avoid full materialization: If all ranks first load the complete weights into memory and then shard them, peak memory usage will be close to the size of the full model. A better approach is to split the weights into several chunks along tensor dimensions, have different ranks read them in parallel, and map them to their respective shards.
    • Support multiple sharding conventions: Open-source weights are often saved using tensor-parallel conventions such as column-wise or row-wise splitting, while the training side may use a different parallel configuration. The loader needs to support conversion between sharding conventions.
    • Maintain a unified structure definition: Multimodal models are composed of different modules, including the vision encoder, modality projection layer, and language backbone. Weight key names, shapes, and dtypes must be consistent across GPUs to avoid sharding misalignment.

    3.2 Shard Scheduling: Keeping the Cost of Gathering Parameters Low

    • Wrapping granularity: If the granularity is too small, there will be too many gather operations and communication will become fragmented. If it is too large, peak memory will increase. A common practice is to use a Transformer decoder layer or a large operator block as the basic unit, while using automatic wrapping policies for smaller modules.
    • Forward/backward overlap: Overlap parameter gathering with computation and gradient reduction with backward computation so that communication is hidden behind computation.
    • Recomputation and sharding: Enable recomputation for memory-intensive modules such as vision encoders, trading a small amount of repeated computation for reduced activation memory.
    1. from your_framework import FullyShardedDataParallel, MixedPrecision
    2. # 1. Build a multimodal model: vision encoder + modality projection layer + language backbone
    3. model = build_multimodal_model(config)
    4. # 2. Set the mixed-precision policy: low precision for parameters and computation, high precision for gradient reduction
    5. model = MixedPrecision(model, param_dtype="bf16", reduce_dtype="fp32")
    6. # 3. Wrap with full sharding at decoder-layer granularity and let the framework handle the remaining modules automatically
    7. model = FullyShardedDataParallel(
    8. model,
    9. shard_unit="decoder_layer", # Use decoder layers as the basic sharding units
    10. limit_all_gathers=True, # Limit the number of simultaneously gathered units to control peak memory
    11. overlap_comm=True, # Overlap aggregation/reduction with computation
    12. )

    3.3 Operator and Precision Adaptation: The Last Mile for China-Based Accelerators

    • Operator coverage and fusion: The China-based software stack needs efficient implementations for attention variants, normalization, activation functions, convolution, and other operators used by the model. Operator fusion can further reduce memory-access overhead.
    • Long-sequence attention optimization: Techniques such as block-wise computation and online softmax can reduce attention memory from quadratic in sequence length to linear.
    • Mixed-precision strategy: Use BF16 as the main compute precision, while keeping FP32 accumulation on critical paths such as softmax, normalization, and loss computation. For models being onboarded for the first time, compare precision layer by layer to locate sources of numerical anomalies.
    • Operator behavior verification: Comparing convergence curves, loss, gradient norms, and reference implementations is the core standard for judging whether adaptation is truly complete.

    3.4 Gradient Synchronization: From All-Reduce to Reduce-Scatter

    • Synchronization path: In the backward phase of full-sharded data parallel, gradients are reduced through reduce-scatter to the owners of each shard and then accumulated with local gradients.
    • Gradient accumulation: During accumulation, gradients can be accumulated locally within each shard. Synchronization occurs once per optimizer step, reducing communication frequency.
    • Communication and computation overlap: Start reduction at bucket granularity to avoid waiting for communication before computing the next layer.
    • Gradient clipping: The global norm needs to aggregate statistics across all ranks. Otherwise, clipping coefficients may differ across GPUs, making training more likely to diverge.
    • MoE scenarios: Expert parallelism introduces all-to-all communication. This should be overlapped as much as possible with expert computation and routing computation, while paying attention to the bucket effect caused by uneven expert loads.

    3.5 Optimizer State: Updating Shards Alongside Parameters

    • Parameter grouping: Different learning rates and weight decay settings can be assigned to the vision encoder, projection layer, and language backbone.
    • Weight decay isolation: By convention, parameters are grouped by dimensionality. One-dimensional parameters, such as biases and normalization parameters, usually do not use weight decay.
    • High-precision master weights: The optimizer updates using fp32 master weights and then casts them back to low precision, reducing long-term accumulated error.

    3.6 Checkpointing and Fault Tolerance: Making Effective Training Time Measurable

    • Sharded saving: Each rank writes the shard it holds, avoiding the memory peak caused by merging weights.
    • Complete saved state: In addition to model and optimizer states, random number states, learning-rate scheduler states, and data-loading progress should also be saved. Otherwise, training may not resume correctly.
    • Regular recovery verification: Periodically perform a save → recover → continue-training drill in a clean environment and check whether the loss remains continuous.
    • Topology-aware scheduling: Where possible, place nodes related to the same training job in the same network domain to reduce cross-domain communication overhead.

    4. Example End-to-End Training Loop

    1. for step, batch in enumerate(train_dataloader, start=1):
    2. # Forward: gather parameters layer by layer and release them after computation
    3. loss = model(**batch).loss / accum_steps
    4. # Backward: reduce gradients layer by layer, overlapping with forward gathering/computation
    5. loss.backward()
    6. # Gradient accumulation: do not update until the last step
    7. if step % accum_steps != 0:
    8. continue
    9. # Gradient clipping: global norm must be aggregated across ranks
    10. clip_grad_norm_(model.parameters(), max_norm=1.0)
    11. # The optimizer updates only the parameter shards held by each rank
    12. optimizer.step()
    13. scheduler.step()
    14. optimizer.zero_grad(set_to_none=True)
    15. # Periodically save a sharded checkpoint and log throughput, memory usage, and loss curves
    16. if step % save_every == 0:
    17. save_sharded_checkpoint(model, optimizer, scheduler, step)

    Note: The code above is a framework-agnostic example. Actual APIs depend on the selected framework. The core idea is to chain the five stages—gather, compute, reduce, update, and save—into a non-blocking pipeline.

    5. Performance Tuning Checklist: From “Running” to “Running Efficiently”

    Dimension Typical problem Tuning direction
    Memory Peak memory overflow during backward Adjust wrapping granularity, enable recomputation, and limit the number of units gathered simultaneously
    Communication Low bandwidth utilization and high tail latency Overlap communication with computation, set bucket sizes reasonably, use topology-aware scheduling, and avoid frequent cross-domain synchronization
    Compute Low operator efficiency or memory-bandwidth bottlenecks Prefer fused operators and efficient attention implementations, and avoid frequent device-to-device data movement in the training hot path
    Load balancing Per-GPU waiting caused by image-text ratio fluctuations Group batches by resolution, cap visual tokens, and sample video frames
    Stability Loss spikes or abnormal gradient norms Learning-rate warmup, gradient clipping, step-skip protection, and timely rollback to the latest stable checkpoint

    At the stability level, a tiered strategy of “anomaly detection → skip step → rollback” can be used:

    1. When loss or gradient norm exceeds the statistical threshold of a sliding window, first skip the optimizer update for that step.
    2. If anomalies occur repeatedly, roll back to the latest healthy checkpoint and lower the learning rate.
    3. Keep metric logs throughout the process to support later diagnosis.

    In addition, it is useful to track Model FLOPs Utilization (MFU), a common metric that measures actual training throughput relative to theoretical hardware peak performance. It is an important reference for judging whether there is still room for optimization.

    6. Cloud Deployment: Supporting Trillion-Scale Training with General Cloud Capabilities

    Trillion-scale training is often not solved by simply buying a few machines. It requires a complete cloud engineering system:

    • Storage layer: Training data and sharded checkpoints are large and frequently read and written. Object storage can support tiered storage and lifecycle management, allowing hot and cold data to be separated to reduce long-term costs.
    • Scheduling layer: Container platforms can host training images and job orchestration, support elastic resource requests per task, and enable automatic isolation and rescheduling of faulty nodes.
    • Data layer: Large-scale sample preprocessing can be decoupled using message queues and batch tasks to improve data-supply throughput.
    • Observability layer: Logging and monitoring services can collect device utilization, memory watermarks, communication bandwidth, and loss curves in a unified way, and alert on-call personnel immediately when anomalies occur.

    By combining general cloud capabilities such as object storage, container platforms, message queues, logging services, and monitoring alerts, organizations can build a complete chain from data ingestion and training scheduling to observability and alerting. This reduces the operational burden of self-managed clusters and allows compute resources to scale elastically with different training phases.

    7. Conclusion

    Training adaptation for trillion-parameter multimodal models is fundamentally a comprehensive test of system capabilities: it must be compatible with continuously evolving model architectures, fully utilize the compute potential of AI accelerators, and rely on native full-sharded data parallel in the middle to connect memory, communication, and fault tolerance into a smooth pipeline.

    For developers, mastering the core logic of “shard → gather → reduce → update” is more important than memorizing a specific framework’s APIs. For enterprises, standardizing data, scheduling, storage, and observability as cloud capabilities can turn ultra-large-scale training from a one-time challenge into repeatable production capacity.