Optimizing LLM Inference on Domestic NPUs: Boosting Throughput with Parallelism Strategies and Low-Level Acceleration
Deploying large language models on domestic NPU hardware involves far more than selecting a model. This article walks through a real-world optimization case on an 8-card domestic NPU setup, showing how restructured parallelism (from TP8 to TP2+DP4+EP), sequence parallelism, and graph/kernel compilation optimizations delivered up to a 53.5% total throughput improvement while meeting SLO requirements. It also summarizes best practices for hybrid parallelism, sequence parallelism, and leveraging hardware-native compiler toolchains.
Optimizing LLM Inference on Domestic NPUs: Boosting Throughput with Parallelism Strategies and Low-Level Acceleration
As large language models evolve rapidly, adapting and optimizing them for domestic AI chips has become a key focus for many organizations. However, deploying LLMs on domestic NPUs requires much more than picking the right model. How the inference engine matches the runtime image, how many cards the model needs, how parallelism strategies are configured, and which low-level optimizations best fit actual workloads—all of these deeply affect deployment efficiency and final performance. Using a mainstream large model on an 8-card, latest-generation domestic NPU as an example, this article explains how restructured parallelism combined with communication and compilation optimizations achieved up to a 53.5% total throughput improvement while meeting SLO (Service Level Objective) requirements.
1. Inference Deployment Challenges on Domestic Compute Platforms
When deploying large models on domestic AI hardware, developers often face a poor out-of-the-box experience. Different hardware architectures have fundamentally different communication mechanisms and operator characteristics, so directly copying deployment practices from general-purpose GPUs rarely works. Capturing successful deployment experience as reusable solutions is therefore especially valuable.
A mature compute deployment and inference optimization platform should organize inference engines, image versions, resource requirements, and deployment parameters into browsable, comparable deployment plans. For plans with existing performance tuning results, the platform can also provide detailed comparison reports between baseline and optimized versions. This “configuration as code” approach lets R&D teams working with domestic compute start from proven configurations, quickly validate and adjust them against their own hardware environment and business workloads, and significantly reduce trial-and-error costs.
2. Core Dimensions of Inference Optimization
Efficient LLM inference on domestic NPUs comes down to balancing computational efficiency against communication overhead. The main optimization dimensions include:
- Dynamic adjustment of parallelism strategies: Model parallelism is no longer limited to pure tensor parallelism (TP) or data parallelism (DP). Depending on the model architecture (e.g., MoE), expert parallelism (EP) should be introduced. Proper partitioning ensures every compute node runs at full load while minimizing cross-node or cross-card data transfer.
- Communication link optimization: In multi-card cooperative computation, collective communication operations such as AllReduce and AllGather often become bottlenecks. Advanced techniques like sequence parallelism can split long-sequence computation, reducing per-card memory pressure and optimizing communication flow.
- Low-level graph and operator compilation: For specific hardware characteristics, perform computation graph optimization and kernel operator compilation. Techniques like operator fusion and memory reuse reduce instruction scheduling overhead and improve low-level execution efficiency.
3. Deep Optimization in Practice: A Throughput Leap on 8 Domestic NPUs
This optimization practice targets a mainstream, large-parameter LLM (with an MoE architecture). The hardware environment consists of 8 of the latest-model domestic AI accelerator cards, with the underlying inference framework deeply adapted from a mainstream open-source engine.
3.1 Baseline Plan and Bottleneck Analysis
The initial baseline used a conventional deployment configuration: tensor parallelism degree of 8 (TP8) and data parallelism degree of 1 (DP1).
This configuration exposed clear bottlenecks under high-concurrency requests: a very high tensor parallelism degree means every forward pass requires dense global collective communication across all 8 cards. For MoE models, this not only drives communication latency sharply upward but also limits the number of requests processed per batch, preventing overall compute utilization from reaching its optimum.
3.2 Restructuring and Implementing the Optimized Plan
To address the baseline’s pain points, we comprehensively restructured the deployment strategy.
Parallelism adjustment: from TP8 to TP2+DP4+EP
We reduced tensor parallelism from 8 to 2 (TP2) while raising data parallelism to 4 (DP4). More importantly, given the MoE model’s characteristics, we introduced expert parallelism (EP).
This adjustment brought two significant benefits. First, TP2 shrank the communication domain for collective communication by half, greatly reducing per-operation latency. Second, DP4 allowed the system to process 4 independent inference batches simultaneously, dramatically improving concurrency. Finally, EP distributes different expert networks evenly across cards, reducing data movement during expert routing.
Enabling sequence parallelism and communication optimization
Beyond the parallelism reconfiguration, we enabled advanced sequence parallelism (via a communication optimization scheme). This technique partitions the input sequence along the sequence dimension and assigns the slices to different compute cards. It not only removes the single-card memory limit on sequence length, but also overlaps part of the computation with communication through clever communication scheduling, further improving multi-card efficiency.
NPU graph and kernel compilation optimization
To align software strategy with hardware characteristics, we enabled graph optimization and kernel compilation optimization for the domestic NPU. This includes static analysis of the computation graph to eliminate redundant nodes, and fusing multiple fine-grained operators into efficient large operators (operator fusion), thereby reducing memory access latency and instruction dispatch overhead.
# Pseudocode: optimized parallelism and compilation configurationengine_config = {"tensor_parallel_size": 2,"data_parallel_size": 4,"expert_parallel_size": 4,"enable_sequence_parallel": True,"npu_graph_optimization": True,"kernel_compile_mode": "high_performance"}
4. Test Results and Performance Comparison
Under the same SLO constraints (i.e., ensuring time-to-first-token and token generation speed meet business requirements), we ran rigorous stress tests on both the baseline and optimized plans.
The results show that the tuned model delivered outstanding performance on the 8-card domestic NPU. By balancing computation and communication, the optimized plan improved total throughput by up to 53.5% over the baseline. This means that with the same hardware investment, the system can handle more than half again as many concurrent requests—directly translating into lower per-inference cost and a better user experience.
5. Summary and Best Practices
This case fully demonstrates that deploying large models on domestic compute is never just simple framework adaptation—it requires end-to-end tuning across parallelism strategies, communication mechanisms, and low-level compilation. From this practice, we derived the following best-practice recommendations:
- Avoid blindly pursuing high TP: In multi-card environments, excessively high tensor parallelism is often canceled out by communication overhead. Combining DP and EP in a hybrid parallelism strategy is an effective way to boost throughput.
- Take sequence parallelism seriously: As LLM context lengths keep growing, sequence parallelism is not only a memory optimization tool but also a key driver of overall throughput.
- Leverage hardware-native capabilities: Making full use of the graph compilation and operator optimization toolchains provided by chip vendors is the last mile in squeezing out hardware compute.
As the domestic compute ecosystem continues to mature, codifying this kind of tuning experience into platformized, automated deployment solutions will become a core driver for enterprises to use domestic AI chips efficiently and accelerate LLM business adoption. Going forward, automated hyperparameter search and finer-grained operator-level optimization will further unlock the potential of domestic AI chips.
