LLM Inference Throughput Optimization on 8 Domestic AI Accelerators: A Practical Guide
This guide walks through a practical optimization path for serving a large Mixture-of-Experts (MoE) text generation model on eight domestic AI accelerators. It explains why throughput measured under a fixed service-level objective (SLO) is the metric that matters, how to build an honest baseline for single-variable comparison, and how to layer optimizations across parallel topology, sequence parallelism and communication, graph mode with operator compilation, and quantization. The case study reaches up to roughly 53.5% higher total throughput at the same SLO, while emphasizing a reusable tuning and validation methodology over the number itself.
1. Why “Throughput Under an SLO” Is the Metric That Matters
When deploying a large Mixture-of-Experts (MoE) model on domestic accelerators, the hardest problem is rarely getting the model to run. It is getting it to run economically. Chasing peak tokens/s in isolation is misleading: if you relax time to first token (TTFT) and time per output token (TPOT) beyond what the business can tolerate, the throughput number can easily double, but the live user experience collapses. In practice, teams care about a composite metric instead: the total throughput a cluster can serve while still meeting a defined service-level objective (SLO).
This article uses the deployment of an MoE text generation model on eight domestic accelerators as a worked example. Using a baseline configuration and an optimized configuration already catalogued in a cloud provider’s model catalog as the comparison, total throughput improves by up to roughly 53.5% under the same SLO. This figure comes from a specific hardware setup, a specific quantized model, and a specific workload profile, so it should not be treated as a universal promise. What is genuinely reusable is the tuning logic and validation method behind it.
2. Principles for Designing the Baseline and Comparison
For optimization conclusions to be credible, the baseline has to be honest. A common mistake is a baseline that is obviously misconfigured (for example, parallelism that does not match the card count, or no compilation optimizations enabled), which artificially inflates the improvement. A sound comparison should satisfy three conditions:
- Identical hardware and software stack: the same batch of cards, the same engine version, the same image and driver version, changing only the variable under test.
- Identical workload profile: the same input length distribution, output length distribution, concurrency gradient, and request arrival process, ideally using a synthetic dataset with a fixed random seed.
- Identical SLO criteria: the same TTFT and TPOT thresholds and the same statistical measure (mean or P99) across baseline and optimized groups.
In this case, the baseline uses tensor parallelism of 2 combined with data parallelism of 4 (tp2, dp4), with expert parallelism enabled to handle the routing computation of the MoE layers. The model is a quantized version, and the inference engine is a general-purpose framework adapted for domestic accelerators. This baseline is already usable, so the optimization headroom comes mainly from the parallel topology and the compilation/execution layer.
3. Optimization 1: Reworking the Parallel Strategy to Match Concurrent Requests
Choosing parallelism in an eight-card setup is fundamentally a three-way tradeoff among memory, communication, and concurrency.
Tensor parallelism (TP) splits a single layer’s weights across cards, significantly reducing per-card memory pressure, but it requires an all-reduce at every layer, making it communication-heavy and sensitive to interconnect bandwidth. Data parallelism (DP) replicates the model at the instance level and absorbs concurrency through multiple replicas; communication happens only at the scheduling layer, so per-request latency is more stable, but memory cost grows linearly with the number of replicas. Expert parallelism (EP) targets the MoE structure by distributing different experts across cards, improving memory utilization when the parameter count is very large, at the cost of all-to-all communication from routing.
The key judgment is this: when concurrency is high and per-request context is not extreme, moderately lowering TP and raising DP is often more cost-effective, because communication volume drops while the memory savings from parallelism are still sufficient. Conversely, long-context, low-concurrency offline batch processing favors larger TP. Beyond parallelism degrees, the following tunables also matter:
- Scheduling and batching: the maximum batch size for continuous batching and the chunk size for chunked prefill directly determine the balance point between TTFT and throughput.
- Memory and cache: the KV cache block size and reuse ratio affect queuing behavior under high concurrency.
- Topology mapping: with all eight cards in a single node and no cross-node communication, prioritize keeping the communication domain within the high-bandwidth interconnect and avoid needless copies across NUMA boundaries.
An illustrative configuration snippet (field names are for explanation only; naming differs across engines):
parallel:tensor_parallel_size: 2 # Per-layer split degree; higher saves memory but adds communicationdata_parallel_size: 4 # Number of replicas; increases concurrency capacityexpert_parallel: enabled # Distributes MoE expertsschedule:max_num_seqs: 256 # Max sequences in a batchenable_chunked_prefill: true # Chunked prefill to smooth TTFTkv_cache_block_size: 16
4. Optimization 2: Sequence Parallelism and Communication Tuning
In long-context scenarios, the intermediate activations of operations such as attention and normalization grow linearly with sequence length, becoming a new bottleneck for memory and bandwidth. Sequence parallelism (SP) splits the sequence dimension across cards as well, so these element-wise and reduction operators run on the split shards and their results are combined through communication primitives. It is complementary to tensor parallelism: TP splits weights, SP splits activations. Enabling it typically yields two benefits: lower peak memory, which allows larger batches, and less redundant computation per card.
At the communication layer, several general options are worth validating: overlapping computation and communication (pipelining all-reduce/all-gather with operator computation), the choice of communication algorithm (the optimal algorithm differs for small versus medium messages), and whether to enable a fused communication-computation module. The effect of these switches depends heavily on message size and topology, so results must be measured empirically. Never assume that “enabling everything is best.”
5. Optimization 3: Graph Mode and Operator Compilation
In eager mode, dispatching operators one by one incurs a fixed scheduling overhead. This is especially pronounced in the decode phase (generating one token per step), where the per-step computation is small and dispatch overhead takes a larger share. Graph mode captures the entire forward pass as a computation graph; combined with operator compilation and auto-tuning, it delivers three kinds of gains:
- Eliminating dispatch and scheduling overhead, shortening per-step decode latency;
- Cross-operator fusion (such as normalization with element-wise multiply-add, and internal attention fusion), reducing memory round trips;
- Shape-specialized compilation for the specific hardware, selecting better operator implementations and tiling parameters.
Note that graph mode is sensitive to dynamic shapes. If the input length distribution is too spread out, it triggers frequent recompilation, which slows the service instead. In practice, teams use bucketing to group lengths into a limited set of tiers, or capture graphs separately for prefill and decode. An illustrative flow:
# Pseudocode: bucketing + graph capture + compilationbuckets = [1024, 2048, 4096] # Prefill length bucketsfor length in buckets:model.compile_and_cache(shape=(length,)) # Warm up and cache compiled artifacts# At serving time, only hit already-compiled shapes to avoid runtime recompilationoutput = model.generate(request, bucketize=True)
6. Quantized Models and the Accuracy-Performance Balance
Quantization is one of the most direct ways to raise throughput on domestic compute, but more aggressive is not always better. Weight quantization (such as 8-bit) usually has controllable accuracy loss and clear memory gains. Activation quantization and KV cache quantization offer larger gains but are more sensitive to long context and low-probability tokens, and can cause output quality to fluctuate. A recommended validation order is: first fix weight precision and adjust only the parallelism and compilation switches to confirm the performance baseline; then gradually introduce KV cache quantization while watching P99 latency and quality metrics; and only then consider more aggressive low-bit schemes. Keep quality regression cases at every step to avoid “throughput went up, answers got worse.”
7. Interpreting Results and a Reusable Methodology
With this combination of techniques, the case ultimately achieves up to roughly 53.5% higher total throughput under the same SLO. More worth capturing is the process rather than the number:
- Define the SLO and acceptance criteria, and lock down the workload profile;
- Establish an honest baseline with single-variable comparison;
- Validate layer by layer in the order of parallel topology → sequence parallelism and communication → graph and compilation → quantization;
- Run quality regression with a fixed dataset and fixed seed;
5.固化 the validated configuration, image, resources, and parameters into a queryable model catalog, forming a reusable deployment plan for the team that supports one-click startup and side-by-side comparison.
When tuning experience is captured as configuration and documentation, onboarding new hardware and new models no longer means starting from scratch; it means doing incremental validation on top of an existing baseline. This is the key step in moving domestic compute adoption from “it runs” to “it works well and is reproducible.”
