Training Trillion-Scale Multimodal Models on Domestic GPUs: Adaptation Practices and Engineering Pathways

    This article presents a systematic engineering approach to adapting trillion-scale multimodal large models for training on domestic full-function GPUs. It breaks down the core challenges—heterogeneous operator gradients, joint vision-language optimization, and extreme memory/communication pressure—and details a practical adaptation strategy built on unified computation graphs, FSDP2-based sharding, mixed precision, and scaled-down verification. The article concludes with a reusable four-stage engineering pathway and actionable insights for ensuring end-to-end training stability and scalability.

    1. Background: Why Multimodal Model Training Is a “Hard Nut”

    Recently, open-weight, trillion-parameter multimodal models have become a focal point in the industry. These models typically share three distinctive characteristics:

    • Massive parameter scale: With total parameters in the trillions, no single GPU’s memory can hold the full model state.
    • Highly heterogeneous architecture: Linear recurrent states, dynamic sparse attention, and mixture-of-experts routing are combined within the same network, breaking the assumptions of conventional dense Transformer training.
    • Closed vision–language loop: The vision encoder and language backbone must be jointly trained in the same forward, backward, and parameter update passes. Missing any part of this loop breaks the entire training chain.

    These three factors make training adaptation significantly more complex than for standard large language models. For domestic full-function GPUs, the ability to run the complete pipeline—model loading, sharded scheduling, gradient synchronization, and parameter updates—serves as a critical test of the maturity of the software–hardware stack.

    2. Decomposing the Core Challenges

    2.1 Gradient Integrity for Heterogeneous Operators

    Conventional training frameworks already provide mature support for standard attention and dense feed-forward networks. However, hybrid attention mechanisms (e.g., combinations of linear recurrent states and dynamic sparse retrieval) and MoE routing introduce many non-standard operators:

    • Linear recurrent states require maintaining implicit states across time steps; their backward pass depends on historical state dependencies.
    • Index selection in dynamic sparse retrieval is non-differentiable; surrogate gradients or straight-through estimators are required.
    • Top-k selection and load-balancing losses in expert routing must be integrated into the computation graph along with the main loss.

    If any operator lacks a forward or gradient implementation, the backward pass will either raise errors or silently produce incorrect numerical values. Therefore, the first step in adaptation is to incrementally implement forward and backward routines for all critical operators and plug them into a unified computation graph.

    2.2 Joint Closure of Vision and Language Backbones

    Multimodal training requires image features to be projected into the language backbone’s representation space via a cross-modal projection, where they participate in language supervision together with text inputs. Two engineering paths exist:

    • Frozen vision tower: Simple to implement, but the model cannot adjust visual representations for downstream image–text tasks.
    • Fully trainable vision tower: Visual parameters are updated during training, yielding better performance, but imposing stricter requirements on memory, communication, and numerical stability.

    Serious multimodal alignment training typically chooses the latter, meaning vision encoder gradients must also be included in the sharding and synchronization system.

    2.3 Memory and Communication Pressure under Trillion Parameters

    For a trillion-parameter model, even with mixed precision, only the FP32 parameters, gradients, and AdamW optimizer states require tens of terabytes of GPU memory. Fully sharded data parallelism becomes a necessity, but it shifts pressure from memory to communication: during forward and backward passes, sharded parameters must be gathered on demand and released promptly after computation; otherwise, improper gathering timing causes memory peak overflow.

    3. Key Design Decisions in the Adaptation Plan

    3.1 Plugging Modules into a Unified Computation Graph

    The core principle of adaptation is: all newly introduced structures must enter the same forward, backward, and parameter update flow—avoiding fragmented implementations such as “side calculations with manual gradient passing.” This involves three layers:

    Attention and routing: Implement operators for hybrid attention and MoE routing; expert dispatch and merge operations are integrated into the unified graph, ensuring routing gradients flow back with the main loss and load-balancing auxiliary losses participate normally in optimization.

    Vision and cross-modal: Keep all trainable parameters of the vision tower; image features pass through the cross-modal projection into the language backbone. Image and text inputs close the loop in the same forward and backward passes, guaranteeing correct joint training semantics.

    Precision and memory: Main computation uses BF16 for numerical range and efficiency; persistent parameters, gradients, and optimizer states are stored in FP32 to prevent divergence from low-precision accumulation. Activation checkpointing is used to balance memory usage against recomputation overhead.

    A representative precision configuration is shown below:

    1. # Pseudo-code for mixed precision and activation checkpointing
    2. model = AutoModel.from_pretrained(
    3. config, dtype=torch.bfloat16 # Main computation in BF16
    4. )
    5. # FSDP2 evenly shards parameters/gradients/optimizer states across ranks,
    6. # persistent states stored in FP32
    7. fsdp_model = fully_shard(model, sharding_strategy=FULL_SHARD)
    8. # Activation checkpointing: trades ~30% compute time for significant memory savings
    9. fsdp_model.enable_activation_checkpointing()

    3.2 Runtime Mechanics of FSDP2 Sharded Scheduling

    FSDP2’s core idea is to evenly shard parameters, gradients, and optimizer states across data-parallel ranks:

    1. Forward phase: As data flows through each sharded unit, full parameters are gathered on demand; after computation, non-local shards are immediately released.
    2. Backward phase: Similarly, full parameters are gathered on demand; after gradient computation, gradients are reduced and the reduced result is kept locally on each card according to its shard.
    3. Optimizer update: Each rank updates only the locally held parameter shard, eliminating the need for global synchronization of optimizer states.

    This “gather-on-demand, release-after-use” pattern makes per-GPU memory usage nearly inversely proportional to the total number of GPUs—a key enabler for trillion-scale training on a limited number of cards.

    3.3 Validation Method: Stability Testing with Scaled-Down Configurations

    Direct end-to-end validation on the full trillion-parameter model is extremely costly. A common engineering practice is to combine architecture scaling-down with short-run training:

    • Build a reduced model (e.g., 13 layers, a small number of experts) while keeping the full vision tower, ensuring the cross-modal path is genuinely exercised.
    • Run several hundred training steps on a multi-node, multi-GPU setup (e.g., 2 nodes with 16 GPUs).
    • Monitor whether the training loss curve decreases smoothly, gradient norms remain stable, expert loads are balanced, and communication does not deadlock.

    If the system runs continuously and stably with a smoothly decreasing loss curve, the plan is proven usable and stable in a multi-card cooperative scenario. The same engineering path can then be extended to larger scales.

    4. Reusable Engineering Path Summary

    This adaptation practice yields a generally applicable pathway for the industry:

    Phase Key Actions Validation Criteria
    Operator completion Implement forward/backward for new structures Single-card numerical alignment tests
    Loop closure Unified graph for vision and language Joint image–text forward/backward with no errors
    Sharded scheduling FSDP2 even sharding across ranks Memory usage matches expectations; no OOM
    Precision strategy BF16 compute + FP32 persistent states Loss curve decreases smoothly
    Multi-card validation Scaled-down multi-node training Stable long-running operation; no communication deadlock

    Several empirically derived conclusions:

    1. Pipeline integrity comes before performance optimization. Ensuring correct forward, backward, and parameter update semantics first, then gradually applying operator fusion and communication optimization, significantly reduces debugging cost.
    2. Scaled-down validation is a low-cost, high-confidence method, but it must preserve all structural types (especially the cross-modal projection); otherwise, conclusions cannot be extrapolated.
    3. Numerical stability requires systematic design—mixed precision, activation checkpointing, and gradient clipping should be planned as a combined strategy rather than configured independently.
    4. The maturity of domestic software–hardware stacks must be measured by end-to-end training capability, not by isolated operator performance.

    5. Conclusion

    Training trillion-scale multimodal models is, at its core, a bidirectional validation between model architecture innovation and hardware–software stack capabilities. By successfully running the full pipeline—model loading, sharded scheduling, and gradient synchronization—on domestic full-function GPUs and validating stability through multi-node, multi-GPU training, the engineering team not only verified the maturity of its own technology stack but also established a reusable and scalable engineering methodology for future, even larger multimodal training tasks. As the domestic computing ecosystem continues to mature, such end-to-end adaptation practices will serve as important references in the journey toward self-reliant large-model infrastructure.