Large Model Training Adaptation on Domestic Accelerators: A Full-Link Engineering Practice
This article breaks down the engineering work required to adapt a domestic accelerator card for full-link large model training, using a reference practice of a frontier multimodal model running stably for 400 consecutive steps on 16 cards across two nodes. It explains why training is harder than inference, how to build a native FSDP2 sharded training path, how to split parallelism across a two-node topology, and how to validate long-run stability, along with common failure modes and a practical troubleshooting order.
1. Background: Training Adaptation Is Moving from “It Runs” to “It Stays Stable”
Over the past two years, one clear change in large model compute supply is that there are more hardware options to choose from. Early adaptation work often stopped at single-card or single-node small-scale inference validation, where the measure of success was “does it produce correct output.” What the industry actually cares about now is different: at parameter scales ranging from billions to trillions, can a non-mainstream accelerator support a complete pre-training and post-training pipeline, and stay stable across hundreds of consecutive steps?
One phenomenon from the source material is representative. A technical report validated two accelerator routes with different architectures side by side in the same document and proposed a fine-grained expert parallelism scheme, yet it was widely read as inference-side operator validation rather than a description of the original compute source for foundation model pre-training. This illustrates a judgment principle: appearing side by side does not mean training is in production. Telling “usable for inference” apart from “usable for training” requires checking whether four dimensions form a closed loop: operator coverage, completeness of parallel strategies, numerical consistency, and long-run stability duration.
This article takes a practice of the form “a domestic accelerator completed training adaptation for a frontier multimodal large model, running stably for 400 consecutive steps on 16 cards across two nodes” as a prototype and abstracts a reusable engineering method from it.
2. Why the Hard Part Is Training, Not Inference
Inference is “one forward pass, relatively fixed shapes, higher fault tolerance.” Training is “forward + backward + optimizer update, dynamic shapes, and errors that accumulate.” The specific difficulties concentrate in four areas:
- Operator long tail. Backpropagation introduces many operator types that inference never touches, such as custom gradients, fused normalization backward, and attention backward for variable-length sequences. A single missing operator breaks the computation graph.
- Numerical stability. Under mixed precision, loss scaling, normalization statistics, and the optimizer’s second-order momentum are sensitive to precision. Differences in hardware implementation can amplify into loss spikes after hundreds of steps.
- Communication and computation overlap. Once data parallelism, tensor parallelism, pipeline parallelism, and expert parallelism are stacked, the communication topology becomes complex. If overlap is insufficient, accelerator compute gets consumed by communication waits.
- Long-run stability rather than an instantaneous result. Occasional memory fragmentation, communication timeouts, or a single card throttling down can interrupt training. Whether the system can detect this automatically and recover from the most recent checkpoint is the core of long-run stability.
3. Building a Native FSDP2 Sharded Training Path
“Native” means not relying on bolt-on patches, but letting the training framework itself carry the sharding semantics. Taking the widely used fully sharded data parallel approach as an example, the core idea is to shard parameters, gradients, and optimizer states along the data parallel dimension, and aggregate them on demand when needed.
# Illustrative code: key semantics of fully sharded data parallel (not a specific product API)for step, batch in enumerate(loader):# 1) Forward: aggregate parameter shards layer by layer on demand, release immediately after usewith shard_all_gather(module.parameters()):loss = model(batch)# 2) Backward: aggregate parameters layer by layer, reduce gradient shards layer by layerloss.backward()# 3) Optimizer: each rank updates only the parameter shards it holdsoptimizer.step()optimizer.zero_grad(set_to_none=True)# 4) Periodically write sharded checkpoints, not full weightsif step % save_interval == 0:save_sharded_checkpoint(step)
Three things need to be handled in engineering:
- Trade-off between shard granularity and peak memory: shards that are too fine amplify the number of communication calls, while shards that are too coarse raise peak memory. Tuning is usually done with “layer blocks” as the unit.
- Mapping communication primitives: map the aggregation and reduction operations to the collective communication library provided by the accelerator vendor, ensuring topology awareness (high bandwidth within a node, network traffic across nodes).
- Sharded checkpoints: both saving and loading follow the sharded layout, avoiding a global merge during recovery that would cause a memory spike.
4. Two-Node, 16-Card Parallel Topology and Strategy Split
A two-node, 16-card setup is a typical “high bandwidth within a node, relatively constrained across nodes” structure. The strategy split should follow a “bandwidth first” principle:
| Parallelism dimension | Suggested placement | Reason |
|---|---|---|
| Tensor parallelism | 8 cards within a node | Most communication-intensive, needs a high-bandwidth domain |
| Expert parallelism | Within a node first, cross-node only for necessary All-to-All | Routing All-to-All traffic is large |
| Pipeline parallelism | Split stages across nodes | Low communication volume, tolerates higher latency |
| Data parallelism / sharding | All 16 cards globally | Naturally fits backward reduction |
Multimodal models also require attention to the structural differences between the vision encoder and the language backbone: the former has fewer layers with larger tensors, the latter has more layers with smaller tensors. If both share the same parallelism degree, one will be compromised for the other. In practice, a common approach is “grouped, differentiated parallelism degrees plus a unified gradient reduction domain.”
5. How to Validate 400 Consecutive Stable Steps
“400 consecutive stable steps” is meaningful because it covers key windows: optimizer state warm start, the learning rate schedule entering its stable phase, and memory allocation settling into a steady state. A recommended validation checklist:
- Numerical consistency: under the same configuration, compare the loss curve of the first several steps against a reference implementation; the deviation should be within an acceptable range. Then compare the gradient norm trend.
- Throughput steady state: compare per-step time at step 50 and step 350. Continuous drift indicates memory fragmentation or cache degradation.
- Memory watermark: record peak and steady-state memory to confirm there is no slow leak.
- Fault tolerance drills: actively inject single-card failures and network jitter to verify that the system can detect them and recover from the most recent sharded checkpoint.
- Observability: connect metrics to common monitoring, alerting, and logging services, with threshold alerts for loss spikes, communication timeouts, and card temperature and throttling.
6. Common Failure Modes and Troubleshooting Order
- Broken computation graph: usually a missing or unsupported operator. Locate the first failing operator, then evaluate a replacement implementation or adjust hyperparameters to work around it.
- Loss spikes: check the learning rate and gradient clipping first, then the mixed precision scaling strategy and normalization implementation.
- Communication timeouts: confirm whether collective communication is properly overlapped with computation, and check cross-node network bandwidth and topology binding.
- Recovery failures: usually caused by a mismatch between the checkpoint sharded layout and the parallelism degree. Ensure the parallelism degree is variable and shards can be re-split.
7. Conclusion
The gap between “fast inference deployment” and “full-link stable training” is not a single operator, but an engineering system made up of parallel strategies, numerical consistency, fault-tolerant recovery, and observability. The practical advice for developers is: first validate numerical alignment at a small scale, then gradually scale up the parallelism degree and card count, treat long-run stability duration as the core acceptance metric, and make checkpoints and monitoring default capabilities rather than add-ons.
