Training Trillion-Parameter Multimodal Models on a Domestic Full-Stack AI Compute Platform: Adaptation Practices
This article analyzes the engineering practices behind adapting a trillion-parameter open-source multimodal model for training on a domestic full-stack AI compute platform. It covers the memory wall and communication wall, training-inference integrated architecture, unified software stack design, a native FSDP2-based distributed training path with DTensor sharding, multidimensional hybrid parallelism, multimodal-specific handling, and the end-to-end training lifecycle from checkpoint loading to gradient synchronization. It also summarizes practical lessons for developers evaluating heterogeneous compute platforms for large-scale model training.
1. Background: Infrastructure Challenges in the Trillion-Parameter Era
In recent years, the parameter scale of open-source large models has continued to rise, from tens of billions to hundreds of billions and even trillions. When model parameters reach the 2.8 trillion level, training is no longer a problem that can be solved by a single machine with multiple GPUs. It becomes a system-level test of the entire compute infrastructure. The challenges are concentrated in several areas:
1. The memory wall. For a trillion-parameter model, even with mixed-precision training, the memory occupied by model weights, optimizer states, and gradients far exceeds the capacity of a single GPU. A common industry estimate is that mixed-precision training requires about 16–20 bytes of memory per parameter: FP16 weights take 2 bytes, gradients take 2 bytes, and FP32 master weights plus momentum and other optimizer states take more than 12 bytes. Trillion-parameter models therefore require tens of TB of memory just for model states, making multi-level sharding and offloading strategies necessary.
2. The communication wall. As parameter scale grows, the data volume of collective communications such as All-Reduce and All-Gather increases. In a thousand-GPU cluster, if communication and computation are not well overlapped, communication overhead can account for more than half of total training time.
3. Software ecosystem adaptation. Mainstream training frameworks are deeply tied to a specific CUDA ecosystem. A domestic compute platform needs to build its own unified software stack and connect operator libraries, communication libraries, compilers, and runtimes into a complete chain. This is a comprehensive test of engineering capability.
Against this background, a domestic GPU vendor announced that it had completed training adaptation for an open-source trillion-parameter multimodal model. The work was based on its self-developed flagship training-and-inference integrated AI accelerator card and its self-developed unified compute software stack, forming a native distributed multimodal training path. The significance of this event is not product promotion. Rather, it demonstrates a feasible path for a domestic full-stack solution in an extreme training scenario, and its technical approach has broader reference value.
2. Training-Inference Integrated Architecture: Engineering Logic for Covering Both Workloads with One Card
Traditional data centers often purchase and operate training cards and inference cards separately, which leads to fluctuations in resource utilization and increased scheduling complexity. The design idea behind a training-and-inference integrated AI accelerator card is to let the same hardware satisfy both the high-bandwidth memory and FP32 precision guarantees required for training and the low-latency, high-throughput requirements of inference.
From a technical perspective, achieving training-inference integration requires several conditions:
- Memory capacity and bandwidth: Training has much higher memory requirements than inference, so large-capacity HBM and high bandwidth are essential.
- Precision support: Training requires BF16/FP16 mixed precision and high-precision master weights such as FP32, while inference focuses on FP8/INT8 quantization acceleration.
- Interconnect topology: Multi-GPU training depends on high-speed inter-GPU interconnect, typically requiring hundreds of GB/s of intra-node interconnect bandwidth and high-bandwidth inter-node networking.
- Unified software stack: Training frameworks and inference engines share the same operator libraries and runtime, avoiding the cost of maintaining two separate stacks.
This architecture allows enterprises to flexibly allocate training and inference tasks on the same resource pool. Online inference can be guaranteed during the day, while offline training can be switched on at night, significantly improving overall resource utilization.
3. Unified Software Stack: The Technical Foundation for Heterogeneous Compute Migration
To run model training on hardware outside the CUDA ecosystem, the core task is to build a unified compute software stack. A common industry approach is a CUDA-like layered design:
Application layer: training frameworks / inference enginesFramework adaptation layer: distributed strategies, automatic differentiation, mixed precisionGraph compilation layer: operator fusion, memory planning, auto-tuningOperator library layer: GEMM, Attention, communication primitivesDriver and hardware layer: GPU kernels, inter-card interconnect, host interface
Several key areas deserve further discussion:
1. Operator coverage. Large-model training involves many custom operators, such as FlashAttention, RoPE, and various fused LayerNorm variants. The software stack needs to provide a high-performance basic operator library and support fast authoring and compilation of custom operators through a Triton-like DSL, so that it can keep pace with rapid model architecture evolution.
2. Compilation optimization. The graph compiler is responsible for operator fusion and memory reuse. For trillion-parameter models, activation memory planning and activation recomputation/checkpointing strategies directly determine the feasible batch size and sequence length.
3. Communication library. A high-performance collective communication library equivalent to NCCL is required, supporting primitives such as Ring/Tree All-Reduce, All-Gather, and Reduce-Scatter. It also needs topology-aware path optimization to fully utilize the bandwidth of NVLink-like high-speed intra-node interconnect and inter-node RDMA networks.
4. FSDP2: The Core of the Native Distributed Training Path
The most notable technical point in this adaptation is the construction of a native FSDP2 multimodal training path. Understanding this requires reviewing the evolution of large-model parallelism strategies.
4.1 From Data Parallelism to Fully Sharded Data Parallelism
Traditional data parallelism (DDP) requires each GPU to hold a complete model replica, which is completely infeasible for trillion-parameter models. Fully sharded data parallelism (FSDP) shards model parameters, gradients, and optimizer states across GPUs. During forward and backward computation, it temporarily aggregates the required shards through All-Gather on demand, releases them immediately after computation, and retains only the local shard.
The key improvement of FSDP2 over the first-generation implementation is DTensor-based dimension-wise sharding. Parameters are no longer sharded in a flattened one-dimensional form. Instead, they are structurally partitioned along tensor dimensions. This provides several benefits:
- The sharding strategy is closer to tensor semantics and easier to combine with tensor parallelism and pipeline parallelism.
- It avoids the parameter alignment padding overhead caused by flattening.
- It supports finer-grained reshard control, actively releasing aggregated parameters at layer boundaries to reduce peak memory.
An illustrative strategy configuration is shown below:
# Pseudocode: FSDP2 full-sharding strategyfor layer in model.layers:apply_fsdp2(layer,sharding_strategy="FULL_SHARD", # Full sharding of parameters/gradients/optimizer statesreshard_after_forward=True, # Release aggregated parameters immediately after forwardmixed_precision=bf16_params_fp32_opt, # Mixed-precision configuration)
4.2 Multidimensional Hybrid Parallelism
Trillion-parameter models commonly use a multidimensional combination of data parallelism, tensor parallelism, pipeline parallelism, and context parallelism:
- Tensor parallelism (TP): Splits matrix operations in attention and MLP layers within a high-bandwidth intra-node domain.
- Pipeline parallelism (PP): Splits the model by layers and passes activations across nodes to hide communication latency.
- Data parallelism/FSDP: Scales throughput within the remaining memory space after the above partitioning.
- Context parallelism (CP): For ultra-long sequence scenarios, splits attention computation along the sequence dimension.
Under hybrid parallelism, the gradient synchronization path handled by FSDP2—Reduce-Scatter, optimizer update, and parameter All-Gather—must be precisely orchestrated with TP/PP communication patterns to achieve computation-communication overlap.
4.3 Special Handling for Multimodal Training Paths
A multimodal model contains both a vision encoder and a language model. The training path needs to handle the following:
- Different sharding granularity for heterogeneous modules: The vision encoder has fewer parameters but large activations, while the language model has more parameters. Their sharding and recomputation strategies should be tuned separately.
- Data pipeline: Preprocessing, tokenization, and packing of image-text pair data need to be highly parallelized. High-throughput data pipelines are usually built with object storage and distributed data loading services.
- Loss computation and gradient aggregation: Gradients from multi-task losses such as image-text matching and text generation must be correctly aggregated into the corresponding parameter shards.
A “native” training path means that these adaptations are not patches on an external framework. Instead, the multimodal data flow, distributed strategies, and low-level operators are designed as an integrated whole and included in unified scheduling from the very first step of model loading.
5. Breaking Down the Complete Training Pipeline: From Loading to Gradient Synchronization
The original work connected three stages: model loading, sharding scheduling, and gradient synchronization. These three stages form the main lifecycle of distributed training:
Stage 1: Model loading. A trillion-parameter checkpoint itself is tens of TB in size. The system needs to support efficient loading of sharded-format checkpoints and automatic resharding, meaning lossless mapping from the shard layout saved during training to the layout of the current cluster topology. The loading stage also involves details such as metadata validation and random initialization seed management.
Stage 2: Sharding scheduling. Based on the cluster topology—such as the number of GPUs per node, interconnect bandwidth, and number of nodes—the system automatically derives the TP/PP/FSDP partition dimensions and generates an execution plan. The scheduler must handle dependencies between heterogeneous levels and ensure that forward, backward, and optimizer steps proceed in the correct order.
Stage 3: Gradient synchronization. Gradient shards produced by backward computation are aggregated through Reduce-Scatter. Each GPU then independently performs optimizer updates on its local parameter shard. Before the next forward step, the required parameters are aggregated through All-Gather. A key optimization is to overlap communication with computation from the previous layer. A typical approach is prefetching: while computing the forward pass of layer N, the system prefetches the parameter shard for layer N+1.
These three stages are tightly linked. Any bottleneck in one stage can become the ceiling for overall throughput. Connecting the complete pipeline marks the transition of the software stack from “able to run a demo” to “able to support real large-scale training.”
6. Lessons for Developers
Several broadly applicable engineering lessons can be drawn from this adaptation practice:
- Software stack completeness matters more than single-point performance. Large-model training is a systems engineering problem. A 20% operator performance improvement is less valuable than correct decisions about communication overlap and memory planning.
- Embrace sharded training paradigms. FSDP2-style solutions have become a mainstream choice for training large models on medium-scale clusters. Compared with the complex configuration of pure 3D parallelism, they are easier to use.
- Training-inference integrated resource strategies are worth considering. A unified hardware pool can smooth load fluctuations between training and inference, and can work with container platforms and scheduling systems to achieve elastic resource allocation.
- Adaptation validation should start from the end-to-end pipeline. When evaluating a new compute platform, do not look only at single-card peak compute. Use criteria such as whether it can complete long-cycle training stably, whether the convergence curve is healthy, and how strong its fault recovery capability is.
7. Conclusion
The completion of training adaptation for a trillion-parameter multimodal model on a domestic compute platform is a substantive validation of full-stack hardware-software collaboration. It shows that as long as a unified software stack, distributed training frameworks, and low-level hardware form a complete closed loop, heterogeneous compute can also support cutting-edge large-model training requirements. For developers, understanding the principles of distributed paradigms such as FSDP2 and mastering tuning methods for each stage of the training pipeline are core capabilities in the large-model era, regardless of the compute ecosystem.
