Training Ultra-Large Models on Alternative Compute: Four Engineering Layers for Hardware-Software Co-design
As large language models scale from hundreds of billions to trillions of parameters, training costs and durations increase significantly. Relying on a single source of high-end GPUs introduces risks related to supply stability and cost control. This article explores four critical engineering layers—chip adaptation, compiler optimization, network communication, and stability assurance—required to train ultra-large models on diverse compute infrastructure while maximizing effective throughput.
1. Conclusion First: Success Relies on a Four-Layer Engineering Pipeline, Not Just Piling Up Cards
As model parameters scale from hundreds of billions to trillions, training costs and durations increase significantly. Relying on a single source of high-end GPUs introduces two types of risks: supply instability and uncontrollable costs. Therefore, ultra-large model projects on alternative compute infrastructure must simultaneously address three challenges: diversifying compute sources, ensuring controllable software stacks, and continuously improving cluster efficiency.
These three challenges correspond to four layers of engineering capabilities: chip adaptation, compiler optimization, network communication, and stability assurance. Each layer impacts the final effective throughput. The following sections detail the practices and boundary conditions for each layer.
2. Multi-Chip Adaptation: Managing Supply Risks with an Adaptation Matrix
Training ultra-large models often lasts for months. Any supply disruption in a specific chip ecosystem can halt the entire training task. Therefore, teams typically adapt their training frameworks to multiple alternative chips, covering different technical routes such as general-purpose GPUs and AI accelerators.
There are three main difficulties in adaptation:
- Operator Coverage: The completeness of operator libraries varies significantly across chips. Some long-tail operators, such as specific normalization or attention variants, may require manually written kernels to fill the gaps.
- Precision Alignment: Different chips have subtle differences in implementing BF16, FP16 mixed precision, and loss scaling. Numerical results should be compared layer by layer before training.
- Communication Semantics Unification: The implementation of collective communication differs across hardware, affecting the portability of distributed strategies. A unified communication interface generally needs to be abstracted.
A common method for managing these differences is the adaptation matrix. Each row of the matrix corresponds to a combination of a model version and a specific chip type, recording a verified configuration. Below is a minimal template:
| Field | Example | Description |
|---|---|---|
| Model Version | model-v2.1 | Architecture and weight version |
| Chip Type | Chip A, 8-card node | Chip model and number of cards per node |
| Parallel Strategy | TP=8, PP=4, DP determined by cluster size | Tensor, pipeline, and data parallelism partitioning |
| Batch Partitioning | micro batch=2, gradient accumulation=16 | Relationship between single-card and global batch |
| Precision Scheme | BF16, dynamic loss scaling | Mixed precision and scaling strategy |
| Validation Results | Layer-by-layer error within threshold, convergence curve aligned with baseline | Validation method and conclusion, with log link |
With this table, tasks can be migrated between different clusters. When hardware supply is tight, teams can quickly find verified alternative configurations without debugging from scratch.
3. Compiler Stack: Evaluate Chip Selection Based on Actual Utilization
The difficulty of adopting alternative chips often lies in the compiler stack. If the compiler cannot efficiently map the computational graph to the hardware, the actual utilization may fall far below the theoretical peak.
The core tasks of the compiler layer include three aspects:
- Operator Fusion and Scheduling: Merging multiple fine-grained operators into a single kernel to reduce memory read/write and launch overhead.
- Memory Planning: Statically analyzing tensor lifespans to select memory reuse and recomputation strategies.
- Instruction-Level Optimization: Adjusting code based on the hardware’s cache hierarchy and specialized compute units.
Many teams supplement general compilers with custom optimizations tailored to their models. For example, expert routing for Mixture of Experts (MoE) architectures, or attention chunking for long contexts. General compilers often lack sufficient coverage for these scenarios.
How to Choose a Compiler Stack for Alternative Chips?
During selection, peak compute parameters serve only as a reference. A more useful metric is MFU (Model FLOPS Utilization), the ratio of the actual model compute achieved to the theoretical peak of the hardware.
MFU measurement requires fixed conditions; otherwise, the results are not comparable:
- Fix the model architecture, sequence length, batch size, and parallel strategy.
- Skip the warm-up phase of the first few steps, then average several steps in the stable phase.
- When reporting, explicitly state the software version, driver version, and all configurations.
MFU values change significantly with model architecture, sequence length, and parallel strategy. It can only be compared horizontally under identical conditions and cannot be directly applied across different models.
4. Networking and Communication: Reducing Cross-Node Traffic via Hierarchical Synchronization
As cluster scale increases, communication overhead often becomes the primary bottleneck for throughput. Adjusting network topology and communication strategies can yield throughput gains without adding hardware. The magnitude of the gain depends on the specific topology, communication library, and model architecture, requiring confirmation through benchmark testing.
Common techniques include three categories:
- Topology-Aware Scheduling: Placing tasks with frequent communication, such as workers within the same partition, on physically close nodes to reduce cross-switch traffic.
- Hierarchical Communication: Completing reductions within the high-speed intra-node interconnect first, transmitting shards across the node network, and finally restoring complete results within the node.
- Prefill/Decode (P/D) Disaggregation on Inference Side: Separately deploying the prefill and decoding phases with independent scaling. This approach is suitable for scenarios with large variations in request length.
The basic form of hierarchical communication can be represented by the following pseudo-code. It is not executable code; function names and parameters vary by framework:
# Pseudo-code: API names and parameters depend on the specific framework; not directly runnable# Precondition: Communication groups have been divided by physical nodes; compression scheme verified for convergenceshard = reduce_scatter(grads, group=intra_node_group) # Intra-node reduction, each card holds a shardshard = all_reduce(shard, group=inter_node_group, compression="bf16") # Cross-node only transmits the shardgrads = all_gather(shard, group=intra_node_group) # Intra-node restoration of full gradients
Whether the compression parameter is available depends on whether the framework provides communication compression hooks; otherwise, custom implementation is required. Compression reduces communication volume but may affect convergence. Before going live, compare the loss curves before and after compression, and confirm on key evaluation datasets that results have not degraded.
5. Stability: Fault Recovery and Continuous Performance Regression
In large-scale clusters, hardware failures are common events. Stability engineering typically involves three tasks:
- Fault Detection and Automatic Isolation: Upon detecting a bad card or link, automatically isolating it and rescheduling the task to healthy nodes. Teams should establish corresponding fault tolerance and automated recovery mechanisms.
