8-Card NPU Inference Optimization: Hybrid Parallelism for ~53% Higher Throughput
This article describes how switching the inference parallelism configuration from TP8+DP1 to TP2+DP4, combined with sequence parallelism and operator compilation tuning, improved total throughput by about 53.5% on an 8-card NPU server while meeting SLO targets. It covers the baseline bottlenecks, the effect of each change, measurement methodology, a deployment checklist, and the limits of these conclusions.
When deploying a lightweight large model on an 8-card NPU server, we changed the inference parallelism configuration from TP8+DP1 to TP2+DP4, combined with sequence parallelism and operator compilation tuning. Under the test configuration described in this article, total throughput improved by about 53.5% relative to the baseline while meeting the defined SLOs. Below we explain the baseline bottlenecks, the role of each change, the measurement methodology, and which conclusions should not be generalized.
1. Baseline and Bottlenecks
The test subject is [model name and version], with weights in [quantization format], running on 8 [NPU model] cards. The driver and compiler version is [version number]. The baseline uses a mainstream open-source inference framework with tensor parallelism (TP) set to 8 and data parallelism (DP) set to 1.
TP8+DP1 optimizes for the compute latency of a single request. Under concurrent load, however, two problems emerge. First, every forward-pass layer requires an All-Reduce across all 8 cards, and the communication links easily saturate as concurrency increases. Second, the memory of all 8 cards is used to shard model weights and activations, leaving limited space for the KV cache, which restricts the maximum batch size per card.
2. Parallelism Strategy: From TP8+DP1 to TP2+DP4
TP2+DP4 divides the 8 cards into 4 groups, each with 2 cards running tensor parallelism, and each group independently processes different requests. Communication occurs only between the 2 cards within a group, so the communication domain shrinks. With 4 instances processing requests simultaneously, total system throughput increases.
This configuration has a cost. Each instance shards its weights across only 2 cards, so each card holds more of the model weights than it would under TP8. Before deployment, you must verify that the sum of weights, KV cache, and activations on each card stays within the memory limit. Calculate the memory available for the KV cache first, then determine the maximum batch size.
Expert parallelism (EP) applies only to MoE models. If the target model is dense, remove all EP-related configuration. If the target model is MoE, EP distributes different experts across different NPUs, reducing the memory pressure per expert and allowing expert routing to complete within a local hardware domain. Whether to enable EP should be determined empirically, based on the number of experts, routing distribution, and remaining memory headroom.
3. Sequence Parallelism: Reducing Part of the Communication
In long-context or high-concurrency generation scenarios, Attention compute and KV cache usage are the main pressures. Sequence parallelism splits the input sequence by length across multiple cards, so each card computes only a segment of the sequence. In Attention computation, this replaces part of the All-Reduce with All-Gather and Reduce-Scatter, changing both communication volume and synchronization points, and making it easier to overlap computation with communication.
The gains appear mainly in long-sequence and high-concurrency scenarios. With short inputs and low concurrency, the overhead of splitting and reassembling may cancel out the benefits. The switch should therefore be decided based on measurements under the actual workload, not enabled by default.
4. Operator Fusion and Kernel Compilation Tuning
The inference engine rewrites the computation graph when loading the model. Fusing consecutive lightweight operators—such as MatMul, LayerNorm, and activation functions—into a single operator reduces the number of kernel launches and the memory reads and writes of intermediate results.
For key operators such as Attention and the MoE Router, you can tune tile sizes, register allocation, and data layouts to improve compute unit utilization. Compilation levels must be validated incrementally. Some levels trigger compilation errors or numerical deviations, so outputs should be compared before going live.
5. Measurement Methodology and Results
Throughput is measured under the same request distribution. The input length of requests is [to fill in], the output length is [to fill in], and the concurrency level is [to fill in]. TTFT is the time from request submission to the first token returned. TPOT is the average time per output token during the generation phase. P99 is the 99th percentile of end-to-end latency.
| Metric | TP8+DP1 (Baseline) | TP2+DP4 (Optimized) |
|---|---|---|
| Total throughput | 1.00 | ~1.535 (~53.5% improvement over baseline) |
| TTFT | [to fill in] | [to fill in] |
| TPOT | [to fill in] | [to fill in] |
| P99 latency | [to fill in] | [to fill in] |
| Max batch size per card | [to fill in] | [to fill in] |
Under the test configuration in this article, the throughput gain comes primarily from the increased number of instances and the larger per-card batch size enabled by reduced communication. TTFT, TPOT, and P99 all remain within SLO thresholds. This conclusion applies only to the configuration described above; after changing the model, concurrency distribution, or framework version, measurements must be repeated.
6. Deployment Checklist
Confirm each of the following items before deployment.
- Resource quotas: NPU model and count, per-card memory, driver version.
- Parallelism topology: TP, DP, and EP values, and which cards each instance includes.
- Memory accounting: the sum of weights, KV cache, and activations must stay below the per-card memory limit with [headroom ratio] reserved.
- Environment variables and engine parameters: sequence parallelism switch, compilation level, maximum sequence length.
- SLO monitoring: alert thresholds for TTFT, TPOT, and P99.
- Rollback conditions: if SLOs are continuously violated or the error rate exceeds the threshold, switch back to the baseline configuration.
7. FAQ
How to choose TP, DP, and EP? First determine whether the model fits on a single card or a small number of cards. If it does not fit, increase TP. If you need higher concurrency, increase DP. Only MoE models need to consider EP.
When should sequence parallelism be enabled? Enable it when measurements show clear benefits in long-context, high-concurrency scenarios. For short-text, low-concurrency scenarios, it can remain off.
How to verify throughput improvement? Run the same request distribution under both the baseline and optimized configurations, and record throughput, TTFT, TPOT, and P99. Throughput numbers are comparable only when all SLOs are met.
8. Scope of Applicability
The results in this article come from a single model and a single hardware environment. TP2+DP4 is not a universally optimal configuration. It is worth trying only when communication is the bottleneck and memory headroom is available. Under concurrent load, the fastest single-request latency often does not translate into overall throughput.
