LLM Training Adaptation on Domestic AI Accelerators: Key Technologies from "Trainable" to "Stable Convergence"

    This article explains the key technologies behind training adaptation on domestic AI accelerators—adapting mature, already-trained open-source models to new hardware and software stacks so they run training correctly and converge consistently with the original implementation. It first clarifies the difference between training adaptation and base pretraining, then walks through the core building blocks: Fully Sharded Data Parallel (FSDP), the full pipeline from model loading and sharding to gradient synchronization, and cross-node multi-GPU collective communication. It details three lines of defense for training stability (loss checks, gradient norm monitoring, and numerical overflow protection), lays out the engineering maturity ladder from "runs" to "trainable out of the box," and offers practical recommendations for making large-scale training more stable and efficient.

    1. First, a Key Concept: “Training Adaptation” Is Not “Base Pretraining”

    When discussing domestic accelerators supporting large models, one concept that is often confused is “training adaptation.” Training adaptation means taking an already-public, already-trained model architecture and getting it to correctly complete the forward pass, backward pass, and optimizer updates on a new hardware and software stack, while keeping numerical behavior and convergence consistent with the original implementation. What it validates is whether this hardware can run training correctly and stably.

    “Base pretraining,” by contrast, is something else entirely: it is the process of “forging” a model’s base weights from scratch—starting from randomly initialized parameters, running through trillions of tokens, and consuming enormous compute. Technical reports for base pretraining typically disclose the training cluster scale, parallelism strategies, and compute sources, but that is original training rather than adaptation validation on third-party hardware.

    Distinguishing the two is important. A common misreading in the industry is this: when a chip “supports” an open-source model, people interpret it as if that model were “trained” on that chip. In reality, doing training adaptation and inference-operator validation for a mature open-source model, and conducting trillion-scale base pretraining from zero, are completely different orders of magnitude in terms of engineering difficulty, validation dimensions, and compute investment. The former proves that the hardware and software stack can correctly and stably execute training; only the latter is the true source of original compute.

    2. Fully Sharded Data Parallel: The Core Foundation of Training Adaptation

    Traditional data parallelism (DP) keeps a complete replica of the model on every card and only splits the data batch. As parameter counts scale from billions to hundreds of billions and trillions, a single card’s memory simply cannot hold the full model, let alone redundant copies of gradients and optimizer states.

    Fully Sharded Data Parallel (FSDP) was created precisely to break through this bottleneck. Its core idea is to shard model parameters, gradients, and optimizer states along the sharding dimension across all participating processes (ranks), so each rank holds only one shard of the full model. When a layer’s full parameters are needed for computation, they are temporarily aggregated via a collective all-gather operation; once the computation finishes, they are immediately released before moving to the next layer. During the backward pass, reduce-scatter completes gradient reduction and distributes the reduced gradient shards back to the corresponding ranks.

    Newer sharding implementations move further toward “per-parameter sharding” rather than “flattened per-parameter-group sharding,” bringing two key benefits: first, combining with other parallelism strategies such as tensor parallelism and pipeline parallelism becomes more natural, making it easier to build multi-dimensional hybrid parallelism; second, the scheduling granularity of communication and computation is finer, making peak memory and communication overhead more controllable.

    3. Connecting the Full Pipeline: From Model Loading and Sharding to Gradient Synchronization

    Training adaptation is by no means as simple as “the model can be loaded.” It requires connecting and validating each segment of the full chain—from model loading and sharding to gradient synchronization:

    1. Model loading and conversion: correctly map the open-source weights onto the domestic hardware’s operators and memory layout, ensuring that weights, tokenizer, positional encoding, and other metadata are fully aligned with the model structure.
    2. Sharding and scheduling: based on cluster size and memory capacity, decide how many cards to shard across, how to shard by layer, and whether to enable activation recomputation (recompute / activation checkpointing) to trade memory for compute.
    3. Forward and backward: every layer’s operator must have a correct and high-performance implementation on the target hardware, covering attention, normalization, residual connections, activation functions, and so on.
    4. Gradient synchronization and optimizer updates: after the sharded gradients obtained in the backward pass are reduced via collective communication, each rank updates the parameter shard it holds, keeping parameters consistent across all ranks at all times.
    5. Convergence validation: by observing the loss curve and gradient distribution over multiple steps, confirm that the training dynamics after adaptation are consistent with the original implementation, rather than “it runs but doesn’t learn correctly.”

    Only when the entire chain forms a closed loop can training adaptation be considered truly complete.

    4. Cross-Node Multi-GPU Coordination: Communication Topology and Collective Communication

    Large-model training is almost always multi-machine, multi-GPU. Take a typical validation scenario: two servers with 16 accelerator cards in total form 16 training processes for joint cross-node training.

    The core challenge in cross-node scenarios is communication. Within a single machine, multiple cards exchange data over a high-speed interconnect bus, while across machines they rely on the network. Gradient synchronization depends on collective communication primitives: reduce-scatter sums or averages gradients and then distributes them by shard, while all-gather aggregates parameter shards before computation. The efficiency of these communication operations directly determines training scalability—when the number of cards grows, if communication overhead cannot be effectively hidden behind computation (for example, through computation-communication overlap, bucketing, gradient accumulation, and similar techniques), you get the phenomenon of “the more cards, the worse the speedup.”

    Therefore, the stability of cross-node training is not just about “whether it can communicate,” but also includes the communication library’s awareness of topology, timeout and fault-tolerance mechanisms, and the absence of deadlocks or long synchronization waits at scale.

    5. Three Lines of Defense for Training Stability: Loss, Gradient Norm, and Numerical Overflow

    “Getting it to run” is only the passing grade; “running stably” is the real difficulty of training adaptation. Large-scale training often runs continuously for days, and any numerical anomaly can bring the entire run to a halt. Engineering practice typically sets up three lines of defense:

    • First line: loss finiteness check. Every step checks whether the loss is NaN or Inf. Once this appears, it means the forward or backward pass has produced a numerical anomaly and requires immediate intervention.
    • Second line: gradient norm monitoring. The gradient norm is the “thermometer” of training health. Under normal conditions it should fluctuate stably within a certain range; if it suddenly spikes, it often signals a gradient explosion that can cause the parameters to diverge. The common practice is therefore gradient clipping, which caps the global gradient norm within a threshold before the update, while logging the norm curve throughout for anomaly tracing.
    • Third line: numerical overflow and abnormal-interruption protection. Low-precision training (half precision / bf16) saves memory and bandwidth but has limited dynamic range and is prone to overflow. Engineering mitigates this through loss scaling, stable operator implementations, and using higher precision for accumulation; more importantly, it sets up a “skip abnormal step” mechanism that skips the update when non-finite values are detected, rather than letting the anomaly contaminate the weights.

    The following illustrative pseudocode shows the basic skeleton of this stability control:

    1. # Illustrative training loop (framework-agnostic pseudocode)
    2. for step, batch in enumerate(dataloader):
    3. loss = compute_loss(model(batch), batch)
    4. # Defense lines 1 & 2: compute and clip the gradient norm after backpropagation
    5. grad_norm = clip_gradients(model.parameters(), max_norm=1.0)
    6. # Defense line 3: skip non-finite steps to avoid corrupting the weights
    7. if not isfinite(loss) or not isfinite(grad_norm):
    8. log_warning(step, reason="non-finite detected")
    9. optimizer.zero_grad()
    10. continue
    11. optimizer.step()
    12. optimizer.zero_grad()
    13. if step % log_interval == 0:
    14. log_metrics(step, loss=loss.item(), grad_norm=grad_norm)

    Reliable training adaptation should keep the loss and gradient norm finite, free of overflow, and free of abnormal interruptions across hundreds of steps or even longer iterations. Take a typical multi-card validation as an example: 16 training processes collaboratively complete 400 consecutive optimizer updates, during which the loss and gradient norm remain finite throughout, with no numerical overflow or abnormal interruption—this is the most intuitive evidence of “stable convergence.”

    6. From “Trainable” to “Trainable Out of the Box”: The Engineering Maturity Ladder

    The industry often divides hardware’s ability to support large models into several maturity levels:

    • Runs: a single forward/backward step computes correctly, but it may be unstable, slow, and lack fault tolerance.
    • Trainable: can complete continuous multi-step training across multiple cards and machines while converging, with controllable loss and gradient norm.
    • Easy to train: training is stable with high throughput, operator coverage is complete, and common models work out of the box.
    • Trainable out of the box: mainstream open-source models require no extensive manual modification, and the accompanying automated toolchain can complete the entire workflow from environment setup to distributed training.

    Moving from “trainable” to “trainable out of the box” requires continued investment in three directions:

    1. Operator adaptation: cover as many of the operators the model needs as possible, and optimize the performance of hotspot operators to reduce the performance loss caused by falling back to generic implementations when operators are missing.
    2. Multi-card coordination: refine collective communication, hybrid parallelism, and memory and recomputation strategies so that training retains good scalability and stability at scale.
    3. Automated toolchain: provide automated capabilities for environment setup, configuration conversion, distributed launching, monitoring and alerting, and checkpoint resume to lower the barrier to entry.

    In terms of hands-on experience with large-scale training, domestic compute has already supported complete training practices for multiple types of models, covering base language models, world models, embodied intelligence models, and other modalities and structures, and is steadily pushing toward trillion-parameter scale. These training cases—built from scratch or full-stack native—validate exactly the engineering capability of full-chain stable training.

    7. Practical Recommendations: Making Large-Scale Training More Stable and Efficient

    1. Small before large: first validate the data pipeline and operator correctness with small-scale, short-sequence runs, confirm the loss decreases normally, and then gradually scale up to the target size.
    2. Monitoring first: connect logging and monitoring/alerting before training begins, and establish visualization and threshold alerts for key metrics such as loss, gradient norm, memory usage, communication time, and throughput.
    3. A robust data pipeline: in large-scale training, it is often data supply rather than compute that becomes the bottleneck first. Object storage can carry massive training data, and multi-process prefetching plus data sharding can avoid I/O waits.
    4. Fault tolerance and checkpoint resume: periodically write checkpoints to disk, and combine them with the scheduling and fault-restart capabilities of a container platform, so that a single point of failure does not ruin a long training run.
    5. Reproducibility: fix random seeds and record data versions and environment versions to ensure that anomalies can be precisely reproduced and located.

    Conclusion

    As domestic compute supports ultra-large-scale model training, it is moving from the early question of “whether it can train” to “whether it is stable and easy to train.” The essence of training adaptation is to polish every detail—across a series of engineering steps including fully sharded data parallel, cross-node communication, gradient synchronization, and numerical stability—so that it matches mature implementations. Only when operator coverage is more complete, multi-card coordination is more stable, and the toolchain is more mature can large models truly make the leap from “trainable” to “trainable out of the box” on domestic full-function GPUs.