Deploying Ultra-Large Language Models on Heterogeneous Compute: Key Considerations
This article explains how ultra-large language models run on mixed hardware, covering new architecture designs, memory and low-bit precision constraints, operator adaptation, parallelism strategies, chip selection, and cloud deployment. It is intended for engineers planning model inference on domestic or general-purpose accelerators.
As parameter counts grow from hundreds of billions toward trillions and context windows extend to millions of tokens, large model inference places growing demands on GPU memory and low-bit compute. In the past, many models could run only on a small number of high-end accelerators. Migrating models to domestic chips and general-purpose chips and keeping them stable in production is now a major challenge for AI deployment. This article covers the technical principles, deployment problems, adaptation methods, hardware selection, and pre-launch checks. The performance trends cited here come from public descriptions. Exact figures must be measured on your own models and hardware.
1. What Architectural Changes Do New Models Bring?
As context length increases, the compute cost of standard attention grows quadratically with sequence length. Hybrid attention addresses this by combining different attention types. For example, distant content can use compressed sparse attention, while local or hierarchical content uses another attention type. This can reduce the compute per token while preserving long-context understanding. Whether the overhead actually drops depends on the specific implementation and input length. Measure inference latency and accuracy on samples at your target length.
In deep networks, signals and gradients tend to attenuate between layers. Manifold-constrained hyper-connections are a structural design that strengthens signal propagation across layers, so deep feature extraction is more thorough. For deployers, this structure mainly affects model quality and training stability. It generally does not change the inference-time calling interface.
During training, some teams have started using optimizers based on momentum and orthogonalized updates, such as Muon. At larger batch sizes, these optimizers tend to have good numerical stability. This mainly concerns the training side. Deployers only need to track the format and precision of the final weights.
Post-training usually happens in two steps. The first step uses supervised fine-tuning and reinforcement learning, such as GRPO, to build capabilities in specific domains. The second step uses on-policy distillation to merge those domain capabilities so that one model performs evenly across multiple tasks. Before deployment, evaluate the merged model on a test set that covers every task. Do not judge it by a single score.
2. What Problems Arise in Heterogeneous Deployment?
Operator fragmentation. Chips from different vendors have their own operator libraries and instruction sets. Some operators in the original model may be missing on the target chip, or they may run only through a less efficient substitute implementation.
Insufficient memory. The KV cache is the largest part of memory use during inference. You can estimate it with the following approximation:
KV cache bytes ≈ 2 × number of layers × number of KV heads × head dimension × sequence length × batch size × bytes per element
With BF16, each element takes 2 bytes. In long-context and high-concurrency scenarios, the KV cache can exceed the memory used by the model weights. Hybrid attention can reduce part of the cache, but you still need to calculate the estimate using your actual configuration.
Low-bit precision incompatibility. Newer models may be trained with mixed FP4 and FP8 precision to reduce size and speed up computation. Many mainstream and domestic chips do not support native FP4 computation. The model must first be converted to FP8 or BF16 before it can run.
3. How to Apply the Key Adaptation Methods
1. Unify the operator layer.
The core of adaptation is an operator abstraction layer. It exposes a unified interface upward and connects to each chip’s implementation downward. Verify every operator against the reference implementation. In the verification, compare numerical error on identical inputs and confirm that the error falls within the defined tolerance. Then profile performance on the target chip and optimize the operators that take the most time first.
2. Use grouped tensor parallelism.
The source describes a grouped, independent tensor parallelism strategy. The grouping rules, the objects being split, and the model structures it applies to should follow the relevant implementation documentation. In principle, tensor parallelism splits a layer’s weights across multiple cards. This reduces the memory pressure on each card, but inter-card communication increases. Pipeline parallelism places different layers on different cards. It transfers less data, but it creates pipeline idle time and lowers device utilization. Combining the two lets you run a large model on a cluster of cards with smaller memory. The cost is lower throughput, and the size of the drop depends on the inter-card interconnect bandwidth.
3. Convert precision.
Converting from mixed FP4 and FP8 to FP8 or BF16 is not a simple change of numeric type. It usually involves three steps: dequantization, rescaling, and precision calibration. To keep precision loss under control, follow these practices:
- Calibration set: Cover general text, code, math, and your target business samples. The quantity and distribution should be close to your live traffic.
- Evaluation metrics: Compare perplexity before and after conversion, and compare accuracy on key tasks. Set an acceptable drop threshold before launch. For example, if accuracy on any task drops by more than one percentage point, delay the launch.
- Rollback plan: Keep the original precision version. Support falling back to higher precision by layer or by module, which helps locate precision issues.
4. How to Choose Chips and Parallelism Schemes
Check the following rules item by item when selecting hardware:
- If the target chip does not support FP8, first confirm that the BF16 version after conversion fits in memory. If it does not, change chips or reduce the model size.
- If a single card cannot hold the weights and the KV cache for the target batch size, introduce tensor parallelism or pipeline parallelism, and evaluate the communication overhead.
- If a critical operator has no implementation on the chip, test the numerical error and speed of a substitute operator before deciding whether to use it.
- If the workload is latency-sensitive, prioritize nodes with high inter-card interconnect bandwidth rather than simply adding more cards.
5. Cloud Deployment Considerations
This section uses Baidu AI Cloud products as examples. These cloud products are vendor solution examples. Readers can choose equivalent services that fit their own environment.
Container platform: Using the Kubernetes Device Plugin mechanism, a cluster can detect and schedule different types of accelerator cards. When deploying, set resource requests and node selection conditions for each chip type. This prevents the model from being scheduled onto incompatible nodes. Autoscaling can be driven by request queue length or latency.
