Adapting Large Model Training on Domestic Full-Function GPUs: An Engineering Practice Guide

    This article walks through the engineering practice of adapting large model training to domestic full-function GPUs. It explains why training adaptation is far harder than inference enablement, what a complete software stack requires, what a native FSDP2 sharded training path brings, and how a two-node, sixteen-card run of 400 consecutive optimizer steps was used to validate numerical health. It also provides a troubleshooting checklist for numerical stability and outlines the four building blocks needed to move from "it trains" to "trains out of the box."

    1. Where the Problem Starts: Why Training Adaptation Is Much Harder Than Inference Enablement

    In the domestic accelerator ecosystem, two very different kinds of announcements show up regularly: one team enables inference for a new model on day one of its release, and another announces that it has completed training adaptation for a very large model. These two tasks are not on the same level of engineering difficulty.

    Inference enablement is essentially about getting a single forward pass to run. Batching can be adjusted, context length can be trimmed, and some features can be turned off. Training adaptation requires dozens of moving parts to be correct at the same time, beyond the forward pass: backpropagation, optimizer state, gradient clipping, mixed-precision scaling factors, random seeds, and data-parallel sharding. Any single inconsistency shows up as a loss that will not go down, a gradient norm that suddenly jumps, or a numerical overflow.

    So the bar for declaring a training adaptation complete should be: across a multi-node, multi-card environment, complete hundreds of consecutive optimizer updates with loss and gradient norm staying finite throughout and no abnormal interruptions. That is a far stricter standard than “a single card can run a forward pass,” and it is the main thread of this article.

    One common misunderstanding is worth clearing up: adapting a model’s training to run on certain hardware is not the same as saying the model was pretrained on that hardware. The former validates that the software and hardware stack has the engineering capability to carry this class of model training; the latter concerns the original compute source of the base model, which is usually not public. Conflating the two leads to a misjudgment of how mature domestic compute really is.

    2. The Technical Foundation: Why Unified Training-and-Inference Cards and a Unified Software Stack Matter

    The first gate for large-scale training adaptation is software stack completeness. A usable training foundation needs to cover at least four layers:

    • Driver and runtime layer: device management, memory allocation, and stream and event semantics.
    • Communication library layer: collective communication primitives (AllReduce, AllGather, ReduceScatter, AllToAll, and so on), which are the groundwork for data parallelism and tensor parallelism.
    • Operator library and graph compilation layer: coverage of high-frequency operators such as matrix multiplication, normalization, attention, and convolution, with support for operator fusion and graph optimization.
    • Framework adaptation layer: lets the distributed strategies, mixed precision, and checkpoint mechanisms of mainstream training frameworks land on the device seamlessly.

    The value of a unified training-and-inference design is that training and inference share the same operators and memory semantics, which avoids the awkward situation where inference runs but training is missing operators. For developers, this means a shorter debugging path: the same model definition can be verified for correctness at small-scale inference, then scaled up to multi-card training.

    3. The Core Path: What a Native FSDP2 Fully Sharded Training Path Means in Practice

    The key to this adaptation was building a native FSDP2 multimodal training path. FSDP (Fully Sharded Data Parallel) works by sharding model parameters, gradients, and optimizer state across all training processes, and temporarily gathering them only when needed.

    Compared with the earlier FSDP1, FSDP2 puts more engineering emphasis on a few things:

    1. DTensor as the unified abstraction for sharding: parameters, gradients, and optimizer state are all sharded tensors, and the sharding semantics are explicit and inspectable.
    2. More controllable overlap of communication and computation: explicit shard-and-gather scheduling reduces bubbles.
    3. Clearer state management: checkpoints are saved and loaded per shard, avoiding a single-point memory peak.

    A pseudocode view of the training loop makes the path easier to follow:

    1. for step, batch in enumerate(loader):
    2. with autocast(dtype=bf16):
    3. loss = model(batch).loss # forward: parameters all-gathered on demand
    4. loss.backward() # backward: gradients reduce-scattered to each shard
    5. clip_grad_norm_(model, max_norm) # global gradient norm clipping
    6. optimizer.step() # optimizer state updated per shard
    7. optimizer.zero_grad()
    8. log(step, loss, grad_norm) # record numerical health

    Multimodal models add extra complexity: the vision encoder, the projection layers, and the language backbone often use different parallel strategies and have different numerical sensitivity ranges. The point of a native path is that these heterogeneous modules can coexist within one sharding and scheduling framework, instead of requiring a hand-written set of parallel glue code for each module.

    4. Validation Method: What 400 Consecutive Steps on Two Nodes and Sixteen Cards Actually Shows

    The experiment used two servers with sixteen unified training-and-inference cards in total to run joint cross-node training. All sixteen training processes completed 400 consecutive optimizer updates, with loss and gradient norm finite throughout and no overflow or interruption.

    The information in this result concentrates on three points:

    • Stable cross-node communication: collective communication over intra-node interconnect and the inter-node network accumulated no error and hit no timeouts during a long run.
    • Correct shard scheduling: the sixteen-way sharding stayed numerically consistent through parameter gathering and gradient reduction, with no silent errors caused by some shards falling behind.
    • A healthy numerical stack: the mixed-precision scaling strategy and the implementations of normalization layers and attention softmax introduced no uncontrollable dynamic range problems.

    Four hundred steps is not a magic number, but it is enough to cover common early-instability windows such as learning rate warmup, gradient clipping taking effect, and changes in data order. A more complete engineering practice is to extend the validation and layer it:

    Validation layer Scale Metrics of interest
    Smoke test Single card Forward and backward run, loss is finite
    Correctness alignment Single card vs. multi-card Loss curve deviation within threshold under the same seed
    Stability long run Cross-node multi-card Consecutive update steps, gradient norm distribution, no interruptions
    Performance evaluation Cross-node multi-card Time per step, peak memory, communication share

    5. A Troubleshooting Checklist for Numerical Stability

    The most common failure in large-scale training is not a crash but a silent drift. The recommended order of investigation is:

    1. Check the magnitude of loss and gradient norm: a sudden jump of an order of magnitude usually points to a data anomaly or a learning rate that is too high.
    2. Inspect the normalization layers and softmax implementation: accumulation precision must be preserved under half precision.
    3. Verify random seeds and data sharding: non-overlapping data per card across multiple cards is a prerequisite for correctness.
    4. Locate the first anomalous rank: print gradient norms per process so a global average does not mask the problem.
    5. Keep checkpoints: when an anomaly appears, recover from the most recent healthy state instead of starting over.

    6. From “It Trains” to “Trains Out of the Box”: Four Building Blocks of a Mature Engineering System

    A single successful run only proves feasibility; reproducibility is what turns into productivity. A mature training engineering system usually includes:

    • Operator adaptation and regression testing: establish accuracy and performance baselines for high-frequency operators, with automatic regression on version upgrades.
    • Automated toolchain: unified task submission, environment build, log collection, metrics dashboards, and alerting, which can be implemented on general cloud capabilities such as container platforms, log services, and monitoring and alerting.
    • Checkpoints and fault tolerance: sharded checkpoints, automatic resume, and faulty node isolation.
    • Observability: turn time per step, communication share, and memory watermark into comparable time series to make bottlenecks easier to locate.

    7. Practical Recommendations and Conclusion

    For teams preparing to run large model training on domestic full-function GPUs, the recommended path is “validate in small steps, then scale up layer by layer”: first align with a reference implementation on a single card, then extend to single-node multi-card to validate sharding correctness, and finally run a long cross-node job to observe numerical health and throughput. In the meantime, turn the adaptation results into automated regression cases so that every model iteration does not repeat the same pitfalls.

    Overall, completing training adaptation for a trillion-parameter-class model and running it stably for 400 consecutive steps on two nodes and sixteen cards marks that the domestic software stack now has the engineering foundation to carry full-pipeline training of frontier complex models. The next focus is not whether it can run, but operator coverage, communication efficiency, and toolchain maturity. Those three determine whether domestic compute can truly become “trains out of the box.”