Adapting a Domestic AI Accelerator for Multimodal MoE Model Training: An Engineering Practice
A Chinese flagship AI training-inference accelerator and its software stack recently completed training adaptation for an open-weight native multimodal MoE large model, running 400 consecutive training steps across 16 GPUs without overflow or interruption, with verified gradient updates in the vision branch. This article breaks down the adaptation approach—module-level integration with the mainstream training framework, FSDP2 combined with expert parallelism, memory and communication optimization—and extracts reusable engineering lessons, including the principle that multimodal training validation must audit per-module gradient flow, not just loss curves.
1. Background: The Infrastructure Challenges of Multimodal MoE Training
A domestic flagship AI training-and-inference accelerator, together with its software stack, recently announced the completion of training adaptation for an open-weight natively multimodal large model. In a joint test on two servers with 16 GPUs, the setup completed 400 consecutive training steps with no numerical overflow or abnormal interruption, and the vision branch achieved real gradient updates. The significance goes beyond simply “getting it to run”—it reveals what multimodal MoE training genuinely demands from the underlying compute stack.
The model in question has roughly 2.8 trillion total parameters, supports context lengths of up to 1 million tokens, uses a hybrid attention mechanism combined with a Mixture-of-Experts (MoE) architecture, and offers both visual understanding and tool-calling capabilities. The training difficulty of such models concentrates in three areas:
- Dynamic sparse routing and expert assignment: The token-to-expert mapping is determined at runtime, making per-GPU load and communication patterns hard to predict statically.
- Joint vision-language training: The vision encoder and the language backbone must maintain consistent synchronization semantics across the forward pass, backward pass, and parameter update stages.
- Memory and communication pressure: Even with a trimmed configuration, trillion-parameter models consume significant per-GPU memory, and cross-node communication easily becomes the bottleneck.
2. Core Approach: Module-Level Integration into a Unified Training Pipeline
Rather than bypassing mainstream training frameworks, the adaptation focused on four key modules, integrating them into a unified forward, backward, and parameter-update pipeline:
- Attention computation: High-performance kernels were implemented for the hybrid attention mechanism, ensuring both numerical accuracy and computational efficiency.
- Dynamic routing: The expert routing logic was adapted to guarantee correct Top-K selection, load distribution, and gradient backpropagation.
- Vision encoding: The full vision tower was preserved so that it genuinely participates in gradient updates rather than serving merely as a data input.
- Cross-modal projection: The projection path from visual features into the language space was connected, keeping the multimodal gradient chain complete.
The training scheme retains the framework’s native automated pipeline. This strategy matters: reusing a mature ecosystem instead of rewriting the training loop minimizes the functional risk introduced by the adaptation itself.
3. Coordinating FSDP2 with Expert Parallelism
The distributed strategy is the technical centerpiece of this adaptation. The core is a fully sharded data parallel approach that distributes model parameters, gradients, and optimizer states across GPUs:
# Illustration: FSDP2-style full shardingfsdp_model = fully_shard(model,sharding_strategy="full_shard", # fully shard params/grads/optimizer statesmesh=DeviceMesh("2x8"), # 2-node, 16-GPU 2D topology)
In the MoE setting, FSDP2 must also coordinate with expert parallelism: the language backbone is sharded along the data-parallel dimension, while routed experts may be further partitioned across the device dimension. Cross-GPU and cross-node collective communication is handled by a self-developed communication library, combined with parameter prefetching and gradient communication scheduling to overlap computation with communication and hide synchronization latency.
4. Test Configuration and Results
The test used two servers with a total of 16 accelerator cards, running a trimmed model configuration: a 13-layer language backbone with 16 routed experts (Top-8 routing), while retaining the full 27-layer vision tower and the cross-modal projection module. Training data was an image-text QA dataset, with a global batch size of 16 and a sequence length of 1024.
Key metrics:
- Training loss: Averaged about 8.94 from steps 21 to 70, dropping to about 2.18 over the final 50 steps—a clear convergence trend.
- Validation loss: About 6.53 at step 100, falling to about 4.69 at step 400.
- Peak memory: Approximately 44.80 GiB per device as sampled, showing that the sharding strategy effectively controlled per-GPU pressure.
- Stability: All 16 training processes completed 400 consecutive optimizer updates with no overflow and no interruption.
5. Verifying That the Vision Branch Is Actually Learning
An easily overlooked question in multimodal models is whether the vision tower is “really learning.” The team inspected gradients of the image embeddings, the first and last layers of the vision tower, and the cross-modal projection module, confirming that all produced non-zero gradients and parameter updates—evidence that the vision encoding components genuinely participated in training.
This points to a general validation principle: validating multimodal training cannot rely on loss reduction alone; gradient flow must be checked module by module. Otherwise, the vision tower may silently degrade into a frozen feature extractor, and the model becomes effectively unimodal in training.
6. Boundaries That Should Be Clarified
This validation used a randomly initialized, trimmed configuration—not full-scale pretraining of the complete model. Its purpose was to verify the functional correctness and stability of the training pipeline. This should be viewed objectively: 400 training steps demonstrate that “the pipeline runs, the numbers converge, and communication stays stable,” but supporting full pretraining of a trillion-parameter model still requires further validation on larger clusters over much longer training cycles.
7. Reusable Engineering Lessons
- Ecosystem compatibility first: Preserve the framework’s native pipeline to reduce hidden defects from custom training loops.
- Layered sharding design: Fully shard parameters, gradients, and optimizer states, and combine with expert parallelism to handle MoE structures.
- Communication scheduling: Parameter prefetching and overlapping gradient communication with computation are key to improving MFU.
- Kernel-level optimization: Implement high-performance kernels for new attention mechanisms to avoid Python-level fallbacks that slow everything down.
- Chunked loss computation: Apply Chunk Loss for long-sequence loss computation to lower peak memory—this was actually enabled in this test.
- Gradient flow auditing: Make “non-zero gradients in every module” a required acceptance criterion for multimodal training.
Overall, this adaptation offers a reference engineering paradigm for a domestic compute stack supporting frontier model training: verify functional correctness first, then progressively scale up to larger training configurations—a steady and pragmatic path.
