Optimizing LLM Inference Throughput on 8 Domestic AI Accelerators
This article presents a practical approach to improving large language model inference throughput on a node with 8 domestic AI accelerators. Starting from a TP=8, DP=1 baseline, it shows how parallelism topology tuning, expert parallelism for MoE models, sequence parallelism, and graph-mode compilation can raise total throughput under SLO constraints by up to about 53.5%. It also covers baseline setup, SLO-throughput curve validation, and a deployment checklist for reproducible results.
1. Background: Why “It Runs” Is Not the Same as “It Runs Efficiently”
When deploying large models on domestic compute platforms, many teams aim to get the model running first and optimize it second. However, what really determines the cost per unit of compute is total throughput under service level objective (SLO) constraints, not single-request latency or peak compute utilization. A representative finding from the original practice is this: with the same model and the same 8 domestic accelerators, adjusting only the parallelism topology and the compilation/communication layers increased total throughput under SLO constraints by up to about 53.5%. The significance of this number is not the 53.5% itself, but the general rule it reveals: default configurations often use only a small fraction of the hardware’s capability.
Three common bottlenecks:
- Parallelism topology mismatched with the workload: A high tensor parallelism (TP) degree amplifies the share of cross-card communication, while a low data parallelism (DP) degree fails to keep concurrent requests fed.
- Load skew in expert-based structures: In mixture-of-experts (MoE) models, uneven expert distribution makes a few cards become long-tail stragglers.
- No platform adaptation at the graph and operator layers: Dynamic graph execution, unfused operators, and disabled compilation optimizations prevent computation and communication from overlapping.
2. Establishing a Baseline: Start With a Comparable Reference
Any optimization conclusion must rest on a reproducible baseline. The baseline should fix the following variables: model quantization precision, input/output length distribution, concurrency gradient, SLO thresholds (such as first-token latency and end-to-end latency limits), and the image and inference engine versions. The baseline uses a naive TP=8, DP=1 configuration, meaning the weights of each layer are split across 8 cards and a single replica serves all requests.
Illustrative load-test script (pseudocode, showing the flow only):
for concurrency in [8, 16, 32, 64, 128]:result = bench(model="quantized_model",tp=8, dp=1,concurrency=concurrency,slo={"ttft_ms": 800, "e2e_ms": 4000},)record(result) # Record throughput, P99 latency, and per-card utilization
The value of the baseline is an “SLO-throughput” curve: at low concurrency, latency meets the target but throughput is very low; at high concurrency, throughput rises but latency breaks the SLO. The turning point of the curve is the usable operating point.
3. Optimization Path 1: Moving From TP8 to TP2+DP4
The core idea is to split “one giant tensor parallel group” into “multiple smaller parallel groups plus multiple data parallel replicas.” TP=2, DP=4 means the model is split into 4 replicas, and each replica uses only 2 cards for tensor parallelism internally. The gains come from three aspects:
- Smaller communication domain: TP AllReduce happens only between 2 cards, significantly reducing cross-card synchronization overhead;
- Stronger concurrency capacity: 4 replicas can process different requests in parallel, reducing queue wait time;
- Thinned-out long tail: A single-replica failure or slow node affects only 1/4 of the traffic.
The cost is higher memory usage (more weight replicas), so it must be combined with a quantized model; otherwise, it may trigger out-of-memory errors.
4. Optimization Path 2: Introducing Expert Parallelism
For MoE structures, expert parallelism (EP) places different experts on different cards and works with routing policies to distribute tokens on demand. It naturally fits with DP: each data parallel replica further splits experts internally, avoiding oversized weights on a single card while mitigating expert hotspots. In practice, watch the routing balance metric; if individual experts are accessed excessively, adjust the routing capacity factor or introduce a load balancing loss.
5. Optimization Path 3: Sequence Parallelism and Communication Optimization
In long-sequence scenarios, the intermediate activations of attention computation grow linearly with sequence length. Sequence parallelism (such as FlashComm-style approaches) splits the sequence dimension across the communication group, reducing per-card activation pressure and allowing communication to overlap with computation. Complementary to this are the selection of collective communication algorithms and topology-aware scheduling, so that AllReduce/AllGather take better paths.
6. Optimization Path 4: Graph Mode and Operator Compilation
Dispatching operators one by one in dynamic graph mode introduces scheduling overhead. After enabling platform graph capture and operator compilation optimizations, the computation graph is lowered as a whole, and operator fusion, memory reuse, and pipeline orchestration are handled by the compiler. Typical gains are reduced CPU-side dispatch pressure and fewer kernel launch gaps, allowing communication to be hidden by computation.
Illustrative configuration differences:
baseline:tp: 8dp: 1graph_mode: falseoptimized:tp: 2dp: 4expert_parallel: truesequence_parallel: truegraph_mode: truecompile_opt: true
7. Validation and Reproduction: Making the Conclusions Credible
Optimization must be closed-loop validated: fix the random seed and dataset, sweep concurrency level by level, plot the SLO-throughput curve, and compare the throughput at usable operating points before and after optimization. At the same time, observe per-card utilization, communication share, expert routing distribution, and memory watermark to confirm that the improvement comes from structural changes rather than random jitter. It is recommended to archive the baseline configuration, the optimized configuration, and the load-test report together, forming reusable deployment plan entries so that other teams can search, compare, and reproduce with one click by model and hardware.
8. Deployment Checklist
- First use a quantized model to lower the memory threshold, then discuss parallelism restructuring;
- Use “minimize the communication domain + maximize the number of replicas” as the initial screening principle for choosing parallelism degrees;
- For MoE models, always monitor routing balance and adjust the capacity factor when necessary;
- For long-sequence workloads, evaluate sequence parallelism first;
- Always enable platform graph and compilation optimizations, and run A/B comparisons;
- Treat SLO as a hard constraint, and accept only conclusions about throughput improvement at operating points.
In summary, the more than 50% throughput improvement on an 8-card domestic platform does not rely on a single “black magic” trick, but on the combined effect of parallelism topology, expert splitting, sequence parallelism, and compilation optimization. Turning this process into a searchable, reproducible deployment plan is the key to continuously reaping compute dividends.
