Large Model Training Adaptation on Domestic Full-Featured GPUs: A Practical Guide
This article covers the practical engineering work of adapting large model training to domestic full-featured GPUs and draws a clear line between training adaptation (getting a model to run correctly and update parameters on the target hardware and software stack) and base model pre-training (learning general capabilities from random initialization at scale). It walks through building a full-chain stable training pipeline, validating operator adaptation with a concrete checklist, using Fully Sharded Data Parallel (FSDP2) with a runnable PyTorch example, addressing the core cross-node challenges of numerical stability and fault tolerance, checking the GPU software stack, choosing parallel strategies, and offering developer-focused recommendations on risk, cost, and moving toward "quasi out-of-the-box" training.
Introduction: Training Adaptation vs. Base Model Pre-Training on Domestic Full-Featured GPUs
As demand for ultra-large models, multimodal models, and agent training keeps growing, domestic full-featured GPUs are becoming a major platform for large model training. For engineering teams, a practical question comes up: does having domestic chips and an inference environment mean you can now train ultra-large models stably? The answer is usually no. It first helps to clarify a key distinction: training adaptation ≠ base model pre-training.
Training adaptation addresses whether “a model can correctly run on the target domestic hardware and software stack and complete parameter updates.” Base model pre-training addresses “training general capabilities from random initialization using large-scale data and high compute.” The two are related, but their engineering goals, acceptance criteria, and risk boundaries differ.
| Dimension | Training Adaptation | Base Model Pre-Training |
|---|---|---|
| Core objective | Verify that the domestic GPU and software stack can correctly complete the forward pass, backpropagation, gradient sync, and optimizer updates | Learn general capabilities such as language, vision, and multimodal from scratch |
| Compute scale | Single machine, small-scale clusters, or small-node validation | Large-scale clusters, long-cycle stable training |
| Data requirements | Small samples, representative or debug data | Massive corpora, high-quality cleaned data, and data mixing strategies |
| Fault tolerance requirements | Focus on checkpoint resume, task recoverability, and metric observability | Focus on long-run stability, node fault self-healing, and training throughput and cost |
| Evaluation focus | Loss, gradient norm, precision comparison, communication correctness, and operator correctness | Convergence, model capability, training efficiency, and compute utilization |
So when discussing “whether domestic full-featured GPUs support ultra-large model training,” it’s a mistake to equate a single successful small-scale training adaptation with full large-scale base pre-training capability. A more accurate statement is: only after completing training adaptation do you have the foundation to further evaluate the feasibility of large-scale training.
1. Bridging from Inference Deployment to Full-Chain Stable Training
Many domestic compute platforms initially entered through inference integration, first getting model loading, inference acceleration, and serving working on domestic GPUs. But inference typically only involves the forward pass, while training requires the full chain to work end to end:
Model loading → data and parameter sharding → forward pass → backpropagation → gradient sync → optimizer update → metric monitoring → checkpoint save
This chain is far more complex than inference. A reasonably mature domestic GPU training engineering system needs to cover at least three areas:
- Operator adaptation: Attention, normalization, activation functions, loss functions, and collective communication operators must all have correct and efficient implementations.
- Multi-GPU and multi-node coordination: You need to select strategies such as data parallelism, tensor parallelism, pipeline parallelism, and expert parallelism sensibly, while ensuring communication and computation overlap.
- Automated tooling: Task orchestration, logging and metrics, fault detection, checkpoint resume, resource scheduling, and monitoring and alerting must form a closed loop.
Operator Adaptation Validation Checklist
Before training on domestic full-featured GPUs, operator adaptation cannot be judged only by “does it run.” You also need to check “is it computed correctly, is it stable, and can it be accepted.” At minimum, complete the following validations:
| Validation Item | What to Check | Acceptance Suggestion |
|---|---|---|
| Reference implementation comparison | Compare against the official implementation, a CPU implementation, or a GPU reference implementation using identical inputs and parameters | Compare loss, logits, and gradients across multiple layers |
| Precision thresholds | Set error thresholds for the fp32, bf16, fp16, tf32, and similar paths | Define relative error, max error, and anomaly ratio thresholds |
| Unit test coverage | Cover operator forward, backward, edge shapes, abnormal inputs, and empty inputs | Build unit tests and regression tests for each key operator |
| Communication stress test | Test AllReduce, AllGather, ReduceScatter, Broadcast, and others | Record bandwidth, latency, tail latency, and congestion behavior |
| Fault injection | Simulate single-GPU anomalies, process exit, network jitter, and node dropout | Verify task detection, alerting, isolation, and recovery |
| Checkpoint recovery acceptance | Save a checkpoint, simulate an interruption, then resume training | Check step continuity, loss reproducibility, and optimizer state consistency |
Only after completing these validations can you judge whether a domestic GPU training pipeline can “just start” or can “train stably.”
2. FSDP2: Enabling Large Model Training with Fully Sharded Data Parallel
When a single machine’s GPU memory cannot hold an ultra-large model, Fully Sharded Data Parallel (FSDP) is one common option. FSDP2 continues the core idea of FSDP: it shards model parameters, gradients, and optimizer states along the data-parallel dimension across different processes, temporarily gathers the parameters of a given layer when they are needed in the forward or backward pass, and releases them after use, thereby reducing per-GPU memory usage.
Compared with earlier FSDP implementations, FSDP2 is better suited for engineering use in terms of sharding granularity, communication paths, model sharding abstraction, and scheduling clarity. For multimodal training, ultra-large model fine-tuning, and full-parameter training, FSDP2 can serve as one of the base parallel strategies, combined with tensor parallelism, pipeline parallelism, expert parallelism, and others.
The code below gives a minimal runnable example for PyTorch 2.4+ / versions that support torch.distributed.fsdp.fully_shard. In a real production environment, you need to replace it with a real model, data loader, mixed-precision strategy, and checkpoint logic.
# Applies to: PyTorch 2.4+ (torch.distributed.fsdp.fully_shard)# Example launch: torchrun --nproc_per_node=8 train_fsdp2.pyimport osimport torchimport torch.distributed as distfrom torch.distributed.fsdp import fully_shardfrom torch.distributed.device_mesh import init_device_meshdef main():# 1) Initialize the distributed process groupdist.init_process_group(backend="nccl")rank = dist.get_rank()world_size = dist.get_world_size()local_rank = int(os.environ.get("LOCAL_RANK", 0))torch.cuda.set_device(local_rank)# 2) Create a device mesh; here we use a single data-parallel dimension as an examplemesh = init_device_mesh("cuda",(world_size,),mesh_dim_names=("dp",),)# 3) Build the model and move it to the current device# In a real project, replace this with the actual large model structureclass ToyBlock(torch.nn.Module):def __init__(self):super().__init__()self.linear = torch.nn.Linear(64, 64)def forward(self, x):return torch.relu(self.linear(x))class ToyModel(torch.nn.Module):def __init__(self):super().__init__()self.transformer_blocks = torch.nn.ModuleList([ToyBlock() for _ in range(4)])self.head = torch.nn.Linear(64, 1)def forward(self, x):for block in self.transformer_blocks:x = block(x)return self.head(x).squeeze(-1)model = ToyModel().to(f"cuda:{local_rank}")# 4) Shard layer by layer to reduce per-GPU memory peaksfor layer in model.transformer_blocks:fully_shard(layer, mesh=mesh)# 5) Shard the whole modelfully_shard(model, mesh=mesh)optimizer = torch.optim.AdamW(model.parameters(), lr=1e-3)# 6) Move data to the current devicex = torch.randn(8, 64, device=f"cuda:{local_rank}")target = torch.randn(8, device=f"cuda:{local_rank}")# 7) Forward pass, loss, backpropagationpred = model(x)loss = torch.nn.functional.mse_loss(pred, target)loss.backward()# 8) Gradient clipping and non-finite value protectiongrad_norm = torch.nn.utils.clip_grad_norm_(model.parameters(),max_norm=1.0)if torch.isfinite(grad_norm):optimizer.step()else:optimizer.zero_grad(set_to_none=True)if rank == 0:print(f"loss={loss.item():.4f}, "f"grad_norm={float(grad_norm):.4f}")dist.barrier()dist.destroy_process_group()if __name__ == "__main__":main()
Note that FSDP2 is not a one-size-fits-all solution for every scenario. It is suited to sharding parameters, gradients, and optimizer states across multiple data-parallel processes to reduce per-GPU memory pressure. In practice, though, you need to weigh model size, interconnect bandwidth, node topology, and communication overhead together when choosing.
| Parallel Strategy | Applicable Scenario | Advantages | Main Cost |
|---|---|---|---|
| FSDP / Data Parallel | Model parameters are large; need to shard parameters and optimizer states | Low memory footprint, good scalability | High demands on interconnect bandwidth and communication efficiency |
| Tensor Parallel (TP) | Extremely heavy single-layer compute; need to shard inside the model | Reduces per-layer memory pressure | Frequent communication; a high TP degree is not recommended across nodes |
| Pipeline Parallel (PP) | Many model layers; suitable for cross-node sharding | Relatively low communication volume | Bubble overhead and complex scheduling |
| Expert Parallel (EP) | MoE models with experts distributed across devices | Improves sparse model training efficiency | Complex routing communication and high load-balancing requirements |
3. Core Cross-Node Challenges: Numerical Stability and Fault Tolerance
Joint cross-node training introduces new problems that single-machine training does not, and the most critical is numerical stability. A healthy training process should keep the loss and gradient norm finite and smoothly varying, without frequent NaN, Inf, or violent oscillations.
Judging whether training has “really run” cannot rely only on whether the processes started. You also need to check:
- whether multiple training processes completed continuous optimizer updates;
- whether the loss stayed finite with a reasonable trend;
- whether the gradient norm stayed within a controllable range;
- whether there were communication timeouts, node dropouts, or single-GPU anomalies;
- whether checkpoints can be successfully saved and restored.
NaN/Inf and Abnormal Training Troubleshooting Table
| Symptom | Possible Cause | Investigation and Handling |
|---|---|---|
| Loss suddenly becomes NaN or Inf | Learning rate too high, bad data, gradient explosion, or precision overflow | Lower the learning rate, add gradient clipping, skip abnormal samples, and check the data |
| Abnormal rise in gradient norm | Poor initialization, unstable layer design, or bf16/fp16 overflow | Use bf16 or fp32, check loss scaling, and analyze abnormal layers |
| Loss does not decrease or oscillates for a long time | Mismatched parallel strategy, abnormal gradient sync, or wrong optimizer config | Check gradient sync, learning rate schedule, data ordering, and model sharding |
| Slow communication or low training throughput | Insufficient interconnect bandwidth, unreasonable TP/PP sharding, or collective communication congestion | Adjust the parallel strategy, check RDMA/Ethernet configuration, and stress-test the communication library |
| Task interruption midway | Node failure, single-GPU dropout, network jitter, or storage anomaly | Enable checkpoint resume, fault detection, node isolation, and auto-recovery |
In engineering practice, stability is usually ensured with a combination of measures:
- Gradient clipping: prevents gradient explosion;
- Mixed precision and loss scaling: mitigates numerical underflow in low precision;
- Activation recomputation: trades off memory against compute;
- Periodic checkpoints: ensure a long run can resume from the most recent state;
- Adaptive communication libraries: fit different environments such as RDMA, high-speed interconnect, and standard Ethernet.
4. Software Stack Checks and Parallel Strategy Selection for Domestic Full-Featured GPUs
Before starting large-scale training, checking the domestic full-featured GPU software stack is critical. Many training problems are not caused by the model itself, but by mismatched versions of the driver, compilation toolchain, communication library, or operator library.
Software Stack Checklist for Domestic Full-Featured GPUs
| Check Item | Key Content | Acceptance Suggestion |
|---|---|---|
| Driver and firmware | GPU driver, firmware versions, and OS kernel compatibility | Establish baseline versions to avoid inconsistency across nodes |
| Compiler toolchain | CUDA/ROCm-compatible toolchain, compiler, and math libraries | Keep development, testing, and production environments consistent |
| Communication library | Collective communication library versions, RDMA, NCCL-like libraries, and NIC drivers | Stress-test cross-node bandwidth and latency |
| Operator library | Coverage of attention, normalization, loss functions, and optimizer operators | Build operator unit tests, precision comparisons, and regression tests |
| Framework adaptation layer | PyTorch, deep learning frameworks, and domestic GPU adaptation packages | Lock versions and record known issues and fixes |
| Memory and bandwidth | Per-GPU memory, HBM bandwidth, and memory fragmentation | Monitor memory peaks and set fragmentation alerts |
| Interconnect topology | Intra-node GPU interconnect and inter-node network topology | Choose TP, PP, and FSDP combinations based on the topology |
| Observability | Logs, metrics, alerts, and task status monitoring | Build training dashboards, fault alerts, and automated inspection |
How to Choose a Parallel Strategy?
| Scenario | Recommended Strategy | Notes |
|---|---|---|
| Model fits on a single GPU; mainly scaling the batch | Data Parallel / FSDP | Focus on gradient sync and throughput |
| Very large per-layer parameter count | Add Tensor Parallel (TP) | Prefer high intra-node bandwidth interconnect |
| Many model layers, cross-node training | Pipeline Parallel (PP) | Reduces communication volume but requires handling bubbles |
| MoE sparse model | Expert Parallel (EP) | Focus on routing communication and load balancing |
| Single-machine multi-GPU training | FSDP + small TP | Balance memory and communication overhead |
| Large-scale multi-machine training | FSDP + PP, use large TP cautiously | Avoid frequent high-bandwidth cross-node communication |
5. Developer Recommendations: Risk, Cost, and Quasi Out-of-the-Box Training
The ultimate goal of large model training adaptation on domestic full-featured GPUs is not a one-off “it ran,” but building reusable engineering capability. Once the driver, operators, communication, parallel configuration, and validation checklist all meet requirements, you can gradually move toward “quasi out-of-the-box” training. Here, “quasi out-of-the-box” does not mean unconditionally usable; it means that once the following prerequisites are met, users can reduce low-level debugging costs and start training faster:
- The driver and software stack versions have been validated;
- Key operators have completed precision and performance regression;
- The communication library and interconnect topology have passed stress tests;
- The parallel strategy matches the model structure;
- Checkpoint resume, fault injection, and monitoring and alerting are in place.
Risk and Cost Reminders
Before large-scale training, teams also need to watch for the following risks:
| Risk Type | Description | Mitigation |
|---|---|---|
| Compute cost | Large-scale training may consume significant GPU-hours and power | Do small-scale convergence validation first, then scale up |
| Data compliance | Training data may involve copyright, privacy, and compliance requirements | Establish data provenance auditing, anonymization, and access control |
| Node failure | A single point of failure in a long run can interrupt the task | Enable checkpoint resume, health checks, and node isolation |
| Data corruption | Storage failures or transfer anomalies can corrupt data | Do data validation, version control, and backup and recovery |
| Access control | Multiple teams sharing a cluster can cause misoperations and resource contention | Use quotas, queues, account permissions, and audit logs |
Developer Landing Checklist
- Validate numerical correctness first: Get a small-scale configuration running, compare its loss curve against a reference implementation, and confirm the operators and precision scheme are correct before scaling up.
- Prioritize communication and topology matching: Choose the parallel strategy based on interconnect bandwidth, and avoid using a high TP degree across nodes.
- Bring stability metrics into daily monitoring: Build dashboards and threshold alerts for loss, gradient norm, learning rate, per-step time, and memory usage.
- Stick to periodic checkpoints: Make checkpoint resume a default capability, not an after-the-fact patch.
- Accumulate reusable configurations: Fix the parallel strategy, precision scheme, default hyperparameters, and monitoring templates to reduce repeated adaptation work.
- Define clear acceptance criteria: Upgrade the bar from “can it start” to “can it stably complete N optimization steps, is the loss normal, and can checkpoints be recovered.”
Conclusion
Adapting ultra-large model training to domestic full-featured GPUs is fundamentally a systems engineering effort. It requires correctly understanding the boundary between training adaptation and base model pre-training, and continuously refining operator validation, FSDP2 sharding, cross-node numerical stability, software stack checks, fault tolerance, and cost control.
Once operator coverage, multi-GPU coordination efficiency, communication library maturity, and automated tooling reach a certain level, large model training on domestic full-featured GPUs can move from “trainable” to “acceptance-ready, reproducible, scalable, quasi out-of-the-box training.” This is not only an important sign of compute ecosystem maturity, but also the key foundation for stable deployment of ultra-large models on domestic platforms.
