Boosting LLM Inference Throughput by 53.5% on 8 Domestic AI Accelerator Cards: An Optimization Practice

    LLM inference throughput often falls well below hardware peak when NVIDIA-focused deployment stacks are reused on domestic AI accelerators. This article walks through a real optimization case on 8 domestic accelerator cards running a lightweight MoE model, covering parallel strategy restructuring (TP=2/DP=4 with expert parallelism), sequence parallelism and communication group optimization, and NPU graph-mode compilation with kernel auto-tuning. The result: throughput improved by up to 53.5% at high concurrency while meeting latency SLOs. General deployment recommendations for domestic AI hardware are also included.

    Background: The Inference Performance Gap on Domestic AI Accelerators

    As large language models are deployed at scale in scenarios such as intelligent customer service, code generation, and knowledge extraction, inference throughput and latency have become decisive factors for both service cost and user experience. Mainstream inference engines have been deeply optimized for NVIDIA GPUs, but on domestic AI accelerator cards, differences in hardware architecture, less mature communication libraries, and incomplete compiler adaptation mean that directly reusing existing deployment solutions often delivers far worse performance than expected. This is especially true in multi-card scenarios, where balancing compute, memory, and communication overhead is critical.

    Take a lightweight LLM (roughly 10B-parameter scale) as an example. On 8 of the latest domestic AI accelerator cards (referred to below as “domestic accelerator cards”), the initial configuration used standard tensor parallelism (TP=8) with data parallelism (DP=1). While stable, throughput fell far short of the hardware’s theoretical peak. Profiling data revealed three main bottlenecks:

    1. The model consists of multiple expert modules, and static TP partitioning left expert computation idle on some cards while others were overloaded.
    2. The communication pattern relied heavily on full AllReduce, causing significant synchronization waiting across the 8-card cluster.
    3. The inference framework’s default graph compilation strategy was not tailored to the chip’s operator library, leaving some operators inefficient.

    Optimization Approach: From Static Partitioning to Dynamic Coordination

    To address these bottlenecks, we performed systematic tuning based on an open-source inference optimization platform (which hosts nearly 20 deployment recipes for domestic accelerator cards and supports one-click deployment with baseline comparison). The core idea: redesign the parallel strategy so that compute and communication patterns better match the hardware topology; enable advanced communication optimizations; and tune graph compilation and kernels for NPU characteristics.

    The optimization proceeded in three stages:

    1. Parallel strategy restructuring: Change from TP=8/DP=1 to TP=2/DP=4, and enable expert parallelism (EP) so that different expert modules are distributed across data-parallel replicas, achieving load balancing and compute overlap.
    2. Communication path optimization: Enable sequence parallelism to reduce critical communication volume, and replace default AllReduce with more efficient communication primitives (such as hardware-affinity-based communication group partitioning).
    3. Compilation and kernel optimization: Enable NPU graph mode to fuse multiple operators into single execution units, and run kernel auto-tuning to select the best operator implementations.

    2.1 Parallel Strategy Restructuring: Combining TP, DP, and Expert Parallelism

    In a traditional Transformer, tensor parallelism (TP) splits each layer’s parameter matrices by rows or columns across cards — suitable when single-card memory is insufficient but inter-card bandwidth is high. However, for models with many sparse expert modules (e.g., MoE architectures), TP causes every expert’s parameters to be replicated or sharded across all cards, while each inference step activates only a few experts — resulting in severe memory waste and compute imbalance.

    Our optimized configuration was TP=2, DP=4: every 2 cards form a tensor-parallel group, giving 4 data-parallel groups. We also enabled expert parallelism (EP), distributing expert parameters evenly across the 4 DP groups, so each token is routed only to the card group hosting its assigned experts. This design brought two direct benefits:

    • Better memory utilization: Each expert’s parameters are stored once instead of being replicated across all 8 cards, reducing memory usage by about 30% and allowing larger batch sizes.
    • Balanced compute load: Since different samples activate different experts, dynamic routing keeps each card’s expert workload roughly even, avoiding the idle compute units seen with TP=8.

    Additionally, DP=4 with gradient accumulation allows dynamic batch sizing. In testing, the optimal batch size increased from 64 (baseline) to 96 while satisfying the SLO (per-token latency < 200ms) — a key foundation for the throughput gains.

    2.2 Communication Optimization: Sequence Parallelism and Communication Group Reshaping

    In multi-card inference, communication overhead often grows super-linearly with card count. In the baseline, each Transformer layer required two full AllReduce operations (forward and backward) plus one AllGather, with communication volume equal to 2x the model’s parameter size. Our optimizations:

    • Sequence parallelism (SP): Split the sequence dimension of attention computation across DP groups, so each DP group handles attention for a local sequence segment and exchanges only the needed pieces asynchronously (e.g., local blocks of K/V matrices). Compared with full AllReduce, SP reduces per-step communication volume to 1/DP of the original (here, 1/4), and communication can overlap with computation, significantly reducing idle waiting.
    • Communication group reorganization: Based on hardware topology (e.g., NVLink or next-generation high-speed interconnects), bind the 2 cards within each TP group to the same NUMA node or physical switch domain to reduce cross-switch hops. A separate low-latency communication group was also created for expert parallelism to carry routing metadata, avoiding bandwidth contention with the main data flow.

    After these changes, communication’s share of total time dropped from 42% (baseline) to 28%, and overall step time decreased by about 19%.

    2.3 Compilation Optimization: Graph Mode and Kernel Tuning

    Domestic accelerator software stacks typically provide graph compilation and kernel auto-tuning interfaces. We enabled two categories of optimization:

    • NPU graph mode: Convert the model’s computation graph from dynamic to static, allowing the compiler to perform cross-operator memory reuse and fusion. For example, LayerNorm, QKV projection, and self-attention were fused into a single operator, reducing kernel launch overhead and intermediate tensor memory reads/writes. Graph mode alone reduced per-step time by a further 14%.
    • Kernel auto-tuning (AutoTune): For high-frequency operators such as matrix multiplication and Softmax, we searched for the optimal tiling strategies and vectorization approaches across different batch sizes and sequence lengths. After tuning, kernels reached 81% of the chip’s theoretical peak in FP16, up from 63% with default kernels.

    Note that compilation optimization must be coordinated with the parallel strategy. We used fused kernels within TP=2 groups, while cross-DP-group data exchanges remained asynchronous communication primitives, ensuring compiler optimizations did not break the compute-communication pipeline.

    Experimental Results and Performance Comparison

    Test environment: 8 domestic accelerator cards (640GB total HBM, inter-card interconnect bandwidth ≥ 400GB/s), inference framework an open-source vLLM branch adapted to the chip, and a lightweight MoE model (about 20B activated parameters, about 80B total parameters, 32 experts with 2 experts activated per token). The workload simulated real production traffic: average input of 128 tokens, average output of 256 tokens, concurrency from 32 to 256 requests, with SLOs of TTFT ≤ 1.5s and TPOT ≤ 50ms.

    Under SLO-compliant conditions, we recorded total throughput (tokens/s) at different concurrency levels:

    Concurrent Requests Baseline Throughput (tokens/s) Optimized Throughput (tokens/s) Improvement
    32 1024 1280 +25.0%
    64 1860 2530 +36.0%
    128 3050 4360 +43.0%
    192 3750 5420 +44.5%
    256 4200 6445 +53.5%

    The optimization becomes more effective as concurrency increases. At 256 concurrent requests, throughput improved by the maximum of 53.5%. This is mainly because the optimized parallel strategy supports larger batch sizes, and with the communication bottleneck reduced, more requests can be in the compute phase simultaneously.

    Lessons Learned and Deployment Recommendations

    From this case, several general principles emerge for LLM inference on domestic accelerator cards:

    1. Don’t blindly maximize TP: TP suits memory-constrained situations but introduces synchronized communication. If the model supports expert parallelism or pipeline parallelism, a better strategy is usually to lower TP and increase DP or EP for higher compute utilization.
    2. Match communication optimization to hardware topology: While communication libraries remain immature, manually partitioning communication groups so that frequently communicating cards are physically adjacent can significantly reduce latency. If the hardware supports RDMA or newer interconnects, prioritize their asynchronous capabilities to overlap communication with computation.
    3. Compilation optimization is key to cost efficiency: Many domestic chips’ compiler stacks already support graph mode, which improves performance and reduces memory fragmentation. Run an offline AutoTune pass for high-frequency operators and cache the results for subsequent runtime loading.
    4. Set SLOs sensibly and adjust batch sizes dynamically: In production, don’t chase the lowest latency blindly — adjust batch sizes dynamically based on SLOs. The optimized setup supports flexible batch scheduling strategies (such as continuous batching), achieving the best balance between throughput and latency.

    Finally, bake the optimized configuration into images and configuration files, and integrate it into your CI/CD pipeline. In this case, the optimized deployment recipe has been added to the open-source platform’s catalog, so users can deploy it directly from the template and fine-tune parameters for their own hardware. The domestic AI compute ecosystem is maturing rapidly, and with careful software-hardware co-tuning, inference performance on par with mainstream GPU platforms is entirely achievable.