Engineering Practices and Technical Key Points for Training Adaptation of Large Models on Domestic GPUs
This article examines what it really takes to adapt a domestic GPU stack for training trillion-parameter MoE models. It distinguishes inference adaptation from training adaptation, walks through the core technical chain—FSDP-based hybrid parallelism, expert parallelism, the full forward-backward-gradient-sync-optimizer loop, and numerical stability monitoring—and presents an engineering methodology for stability validation and a reusable tooling system for moving from "can train" to "train out of the box."
Engineering Practices and Technical Key Points for Training Adaptation of Large Models on Domestic GPUs
Introduction: The Leap from “Can Run Inference” to “Can Train”
As open-source large models scale from tens of billions to trillions of parameters, adapting the compute foundation has become a central topic in building the domestic GPU ecosystem. A phrase often heard in the industry is “Day 0 adaptation,” meaning a new model can be integrated for inference on the day of release. However, it is essential to distinguish between two engineering problems of completely different difficulty levels: inference adaptation and training adaptation. Inference involves only forward computation, with relatively manageable operator coverage and numerical precision requirements. Training, by contrast, requires the complete loop of forward pass, backward pass, gradient synchronization, and optimizer update—placing an order-of-magnitude higher demand on memory management, communication efficiency, and numerical stability.
Drawing on a representative case of adapting a full-featured domestic GPU for training a trillion-parameter MoE model, this article systematically reviews what training adaptation entails, its key challenges, and the engineering methodology behind it.
1. The Fundamental Difference Between Training and Inference Adaptation
The term “adapted successfully” is frequently misunderstood, so let us clarify three distinct levels:
- Inference operator verification: the model’s core operators (attention, routed experts, normalization, etc.) execute correctly on the target hardware, with outputs aligned to a reference implementation. This typically requires only operator-level integration and is the lowest barrier.
- Inference deployment: building on available operators, completing memory optimization, KV cache management, continuous batching, and so on to reach usable serving performance.
- Training adaptation: enabling the full pipeline from model loading, parameter sharding, forward and backward computation, and cross-node gradient synchronization to optimizer state updates—while requiring long continuous training runs without numerical overflow or abnormal interruption.
One point deserves emphasis: the fact that a chip has completed training adaptation for a model does not mean the model’s pretraining was performed on that chip. Industry convention is for model teams to validate multiple hardware paths in parallel in their technical reports, while typically not disclosing the original compute source of the base pretraining. Therefore, when interpreting such news, one should focus on the engineering capability demonstrated by the adaptation, rather than over-extrapolating.
2. The Core Technical Chain of Training Adaptation
A complete training adaptation typically requires solving the following stages.
2.1 Distributed Parallelism Strategy: FSDP and Hybrid Parallelism
A trillion-parameter model cannot fit on a single card, so parameter sharding is mandatory. The mainstream industry solution is the second-generation implementation of Fully Sharded Data Parallel (FSDP), which shards model parameters, gradients, and optimizer states across all compute devices, gathering them on demand before computation and releasing them afterward—compressing per-card memory usage to 1/N of the original.
For MoE (Mixture-of-Experts) architectures, Expert Parallelism (EP) must be layered on top: different experts reside on different devices, and tokens are dispatched via All-to-All communication. A typical parallel configuration looks like this:
parallel_config = {"data_parallel_size": 2, # Data parallelism"tensor_parallel_size": 2, # Tensor parallelism"expert_parallel_size": 4, # Expert parallelism (MoE)"sequence_parallel": True, # Sequence parallelism: shard long-sequence activations"activation_checkpoint": True # Activation recomputation: trade compute for memory}
The difficulty of adaptation lies here: different hardware vendors implement their communication libraries and collective primitives (AllGather, ReduceScatter, All-to-All) differently. Communication paths must be rewritten or tuned for the domestic GPU software stack, and compute-communication overlap scheduling must be handled carefully.
2.2 The Complete Loop from Model Loading to Gradient Synchronization
An adaptation validation typically confirms that all of the following stages work end to end:
- Model loading and sharding: support loading sharded weights on demand from distributed checkpoints, avoiding full-model loads that would exhaust memory;
- Forward computation: core operators—attention, routing, expert feed-forward—are numerically aligned on the target hardware;
- Backpropagation: gradient computation is correct and activation recomputation takes effect;
- Gradient synchronization: cross-node gradient aggregation is correct and efficient, supporting gradient bucketing and communication overlap;
- Optimizer update: optimizer states under mixed precision (e.g., Adam’s first and second moments) are maintained correctly, with loss scaling to prevent low-precision overflow.
2.3 Numerical Stability Monitoring
Whether training has “really worked” cannot be judged by the process simply staying alive; it must be judged by numerical metrics. The industry’s accepted acceptance criteria include:
- The loss remains finite throughout, with no NaN or Inf;
- The gradient norm stays within a reasonable range, without explosion or abnormal spikes;
- The loss curve aligns with the reference implementation, with deviation within an acceptable range under identical data and hyperparameters.
3. An Engineering Methodology for Stability Validation
Taking a cross-node joint training run on two machines with 16 GPUs as an example, a well-defined training adaptation validation process should include:
- Small-scale smoke test: run a single training step on one card with a small batch to verify operator correctness;
- Multi-card scaling test: scale progressively to 8 cards on one machine, then 16 across two, focusing on whether the communication path exhibits deadlocks or performance collapse;
- Continuous stability stress test: execute several hundred consecutive optimizer updates (e.g., 400 steps), recording loss, gradient norm, memory usage, communication time, and throughput throughout. The point of 400 steps is not to produce a usable model, but to prove the pipeline’s numerical stability and engineering robustness—most hidden problems (memory fragmentation, communication jitter, precision drift) only surface over long iteration sequences;
- Fault injection and recovery test: verify resume-from-checkpoint capability, ensuring checkpoint save/restore consistency under sharded scenarios.
A caveat is in order: concrete figures such as step counts and throughput should be taken from each project’s actual test reports; this article presents only a general methodological framework.
4. From “Can Train” to “Train Out of the Box”: An Engineering System
A successful point validation is only the beginning. What truly matters is distilling it into a reusable engineering system, which mainly includes:
- Operator adaptation layer: a high-performance operator library covering mainstream model architectures, capable of quickly adding support for new architectures (e.g., new attention variants or routing mechanisms);
- Multi-card coordination layer: automatic parallelism strategy search that selects sharding plans based on model structure and cluster topology;
- Automated toolchain: distributed launch, health checks, straggler detection, resume-from-checkpoint, training visualization, and more—lowering the barrier to use;
- Ecosystem collaboration: developers can combine general-purpose cloud platform capabilities—container platforms, object storage, logging services, and monitoring/alerting—to build end-to-end training pipelines. For example, on platforms such as Baidu AI Cloud, container orchestration can schedule multi-node training jobs, object storage can manage datasets and checkpoints, and the monitoring and alerting system can safeguard the stability of long-running training.
5. Conclusion
Training adaptation is the touchstone for evaluating the overall capability of domestic GPUs. It demands deep coordination among the chip, drivers, software stack, operator libraries, and distributed frameworks—and its difficulty far exceeds inference integration. Every step along the path—from completing several hundred consecutive stable training steps, to supporting full from-scratch pretraining of hundred-billion-parameter models, to joint efforts on trillion-parameter models—marks the progression of domestic compute from “usable” to “genuinely good to use.” For developers, understanding the technical chain behind training adaptation supports more rational decisions in model selection, cluster planning, and stability assurance. For the industry, the maturity of a “train out of the box” toolchain is the real moat of the domestic compute ecosystem.
