Adapting Domestic AI Accelerators for Trillion-Scale MoE Multimodal Model Training: A Technical Deep Dive

    This article analyzes an engineering practice in which a domestic flagship AI training-and-inference accelerator, together with its software stack, was adapted to train an open-weight natively multimodal model with roughly 2.8 trillion parameters, a 1M-token context window, hybrid gated attention, and MoE architecture. It covers the core challenges—hybrid attention with dynamic sparse retrieval, MoE expert routing and communication overhead, and cross-modal training consistency—along with the FSDP2-based fully sharded training design, a 16-GPU validation setup with trimmed configuration, loss and memory metrics, gradient-signal verification of the vision branch, and optimizations such as expert-parallel coordination, parameter prefetching, high-performance KDA operators, and Chunk Loss computation.

    I. Background: Extreme Demands of Ultra-Large Model Training on the Compute Stack

    A notable engineering milestone recently emerged in the AI infrastructure space: a domestic flagship training-and-inference AI accelerator and its accompanying software stack completed training adaptation for an open-weight, natively multimodal large model. The model has roughly 2.8 trillion total parameters, supports a context length of up to 1 million tokens, adopts hybrid gated attention together with a Mixture-of-Experts (MoE) architecture, and provides both visual understanding and tool-calling capabilities.

    From a purely technical standpoint, training such a model imposes near-extreme requirements on the underlying compute stack. First, trillion-scale parameters mean a single GPU’s memory cannot hold the full model state. Second, the dynamic sparse retrieval and expert routing mechanisms introduced by MoE make compute loads highly imbalanced across space. Third, joint image-text training requires the vision encoding branch and the language backbone to update together within a unified optimization loop—any numerical anomaly in any stage can crash training. The value of this adaptation therefore lies not merely in “getting it to run,” but in validating a complete, stable, and scalable training pipeline.

    II. Core Technical Challenges of the Adaptation

    1. Hybrid Attention and Dynamic Sparse Retrieval

    Modern large models commonly use hybrid attention designs, alternating between full attention and sparse attention across layers. Sparse attention relies on dynamic retrieval to determine token-to-token associations, which creates two engineering difficulties: first, the irregular memory access patterns during retrieval place extreme demands on memory bandwidth and scheduling efficiency; second, dynamic paths mean the computation graph is no longer static, and the training framework must correctly handle the resulting gradient propagation.

    2. Load and Communication Pressure from MoE Expert Routing

    MoE replaces feed-forward layers with multiple expert sub-networks, activating only a few of them per token (e.g., Top-8 routing). This introduces three problems:

    • Load imbalance: Routing results change dynamically during training; some experts may be over-activated, turning certain GPUs into bottlenecks.
    • Amplified cross-device communication: Tokens must be dispatched to the devices hosting their routed experts, and All-to-All traffic grows significantly with expert parallelism.
    • Numerical stability: The softmax over routing weights can easily overflow under low precision, requiring careful numerical handling.

    3. Consistency in Cross-Modal Joint Training

    A multimodal model consists of three parts: the vision tower, the cross-modal projection module, and the language backbone. Training adaptation must ensure the vision branch genuinely participates in forward computation, backpropagation, and parameter updates—otherwise the so-called “multimodal training” is only nominal.

    III. Training Design: FSDP2 + Full Sharding

    1. A Unified Training Pipeline

    The adaptation centered on four core modules: attention computation, dynamic routing, vision encoding, and cross-modal projection. The engineering team integrated these into a unified forward, backward, and parameter-update pipeline while preserving the training framework’s native model-loading path. This is critical: keeping the native pipeline means model definitions, optimizer configurations, and training loops do not need to be rewritten for specific hardware, which reduces the intrusiveness of the adaptation and makes it easier to stay in sync with the upstream community ecosystem.

    2. FSDP2 Fully Sharded Data Parallelism

    The core idea of FSDP2 (the second-generation implementation of Fully Sharded Data Parallel) is to shard model parameters, gradients, and optimizer states across all GPUs, gathering them on demand only when needed:

    1. Estimated memory footprint of training state (simplified model):
    2. - Parameters P (stored in bf16) → 2P bytes
    3. - Gradients → 2P bytes
    4. - Optimizer states (e.g., two AdamW momentum buffers in fp32) → 8P bytes
    5. - Total ≈ 12P bytes
    6. After FSDP2 sharding, per-GPU footprint ≈ 12P / N (N = degree of parallelism)

    At trillion-parameter scale, training simply cannot start on a limited number of GPUs without full sharding. Compared with the first-generation implementation, FSDP2 uses DTensor as its sharding primitive, offering finer sharding granularity, better compatibility with native PyTorch semantics, and easier composition with other parallelism strategies such as expert parallelism.

    3. Communication Layer Abstraction

    Cross-device and cross-node collective communication is handled by a dedicated communication library (an abstraction comparable to the industry-standard NCCL layer). Under hybrid parallelism, the communication library must simultaneously support gradient All-Reduce for data parallelism, All-to-All for expert parallelism, and parameter gathering for FSDP. The priority design of communication scheduling directly affects training throughput.

    IV. Test Configuration and Result Validation

    1. Test Environment and Trimmed Configuration

    The actual test used two servers with 16 accelerators in total. Given the extremely high cost of full-scale pretraining, validation used a randomly initialized, trimmed configuration:

    • Language backbone: 13 layers, 16 routed experts (Top-8 routing);
    • Vision side: the complete 27-layer vision tower and the cross-modal projection module retained;
    • Data: an image-text QA dataset, global batch size 16, sequence length 1024.

    This trimming strategy is standard practice in the industry—it compresses validation cost while fully retaining the most complex architectural components (expert routing and cross-modal projection), which is sufficient to validate the functional correctness of the training pipeline.

    2. Numerical Metrics

    Sixteen training processes completed 400 consecutive optimizer updates with no numerical overflow or abnormal interruption. Key metrics:

    Metric Early Stage Final Stage Trend
    Training loss 8.9365 (mean of steps 21–70) 2.1802 (mean of last 50 steps) Steadily decreasing
    Validation loss 6.5297 (step 100) 4.6873 (step 400) Steadily decreasing
    Peak per-GPU memory — 44.80 GiB Within a controllable range

    Training and validation losses decreased in tandem with no sign of divergence, indicating that gradient propagation, optimizer updates, and numerical precision handling all worked correctly. The 44.80 GiB peak memory also shows that the FSDP2 sharding strategy effectively controlled per-GPU memory pressure.

    3. Verifying Genuine Vision Branch Participation

    This is the most instructive verification method in the entire practice. By inspecting gradient signals, the team confirmed that the vision tower’s image embeddings, its first and last layers, and the cross-modal projection module all produced non-zero gradients and parameter updates. This rules out the possibility of the vision encoder being frozen or its gradients being accidentally truncated, proving the vision branch genuinely participated in end-to-end training.

    In engineering practice, such verification can be implemented as follows:

    1. # After several training steps, check gradients of key modules
    2. for name, param in model.named_parameters():
    3. if "vision_tower" in name or "projector" in name:
    4. assert param.grad is not None
    5. assert param.grad.abs().sum() > 0, f"{name} has zero gradients"
    6. # Optionally compare parameter values before and after the update

    V. Optimizations for Larger-Scale Training

    Beyond bringing up the baseline pipeline, the team completed four deep optimizations, of which Chunk Loss was actually enabled in this 400-step test:

    1. FSDP2 and expert parallelism coordination: Correctly composing data-parallel sharding with expert-parallel partitioning within the same training process is a prerequisite for scaling to larger GPU counts.
    2. Parameter prefetching and gradient communication scheduling: Prefetching soon-to-be-used parameter shards and overlapping communication with computation hides collective-communication latency.
    3. High-performance KDA operators: Operator-level optimization of the core hybrid-attention computation directly determines training throughput.
    4. Chunk Loss computation: Computing the cross-entropy loss in chunks avoids materializing the full logits at once when the vocabulary is huge—an essential optimization for long-sequence, large-vocabulary training.

    VI. Conclusion and Takeaways

    The significance of this practice can be understood on three levels:

    • For hardware vendors: It validates a complete software stack spanning operators, communication libraries, and training frameworks while maintaining compatibility with mainstream training frameworks—a key threshold for domestic compute to enter the main arena of large model training.
    • For model development teams: It demonstrates the trainability of trillion-scale MoE multimodal architectures on non-mainstream GPU hardware, providing empirical evidence for compute diversification.
    • For the engineering community: It exemplifies a rigorous adaptation methodology—trimmed configurations, end-to-end loss monitoring, gradient-signal inspection, and peak-memory tracking—a workflow applicable to any heterogeneous hardware adaptation effort.

    It should be emphasized that 400 steps of continuous training validate functional correctness and short-term stability of the pipeline; long-duration stability, convergence quality, and throughput efficiency required for large-scale pretraining remain to be verified. But as a zero-to-one pipeline validation, it clearly presents the full technical landscape needed for a heterogeneous compute stack to support ultra-large model training: fully sharded parallelism, expert-parallel coordination, operator optimization, and numerical stability guarantees—none of which can be omitted.