Optimizing LLM Inference Parallelism on China-Made NPUs: Strategies and Reusable Practices

    Deploying a large language model on an 8-card China-made NPU server is more than choosing a model. The inference engine, runtime image, accelerator count, parallelism layout, and low-level compilation all affect whether the system meets latency targets and delivers useful throughput. This article presents a real Mixture-of-Experts (MoE) inference optimization case: moving from TP8+DP1 to TP2+DP4 with expert parallelism, then adding sequence-parallel communication fusion and graph/kernel-level compiler optimization, raised total throughput by up to 53.5% under the same service-level objective (SLO). It also explains the reasoning behind each tuning decision and why a reusable deployment solution catalog is essential for scaling that experience across model-hardware combinations.

    Deploying an LLM Is More Than Selecting a Model

    In a China-made NPU environment, selecting the model is only the first step. What actually decides deployment efficiency and online performance is a set of engineering decisions: matching the inference engine with the runtime image, determining how many accelerator cards the model needs, choosing tensor and data parallelism, and selecting low-level optimizations that suit the workload. If any of these is misconfigured, the system can either leave compute capacity idle or, while still meeting latency SLOs, deliver throughput far below the hardware’s theoretical limit.

    For models based on Mixture-of-Experts (MoE), the problem is more acute. MoE activates only a subset of expert parameters in each forward pass, which naturally fits expert parallelism, but also adds cross-card communication. Balancing compute, memory, and communication is the core challenge.

    This article uses an actual optimization case: an MoE model running on an 8-card China-made NPU server. By reworking the parallelism strategy and applying communication and compilation optimizations together, total throughput improved by up to 53.5% under the same SLO. The following sections reconstruct the process and the methodology.

    Baseline: The Intuitive TP8 + DP1 Configuration and Its Limits

    For an 8-card deployment, the most common baseline is TP8 + DP1: eight-way tensor parallelism splits the model across all 8 cards, and a single data-parallel instance handles one request stream.

    This setup is simple and has enough per-instance memory to hold a large model. Its limitations are also clear:

    • Communication overhead grows with parallelism degree. Tensor parallelism requires collective communication such as AllReduce after each layer. With TP8, all 8 cards participate in each step. When per-card computation is small, the communication share rises quickly, and more cards can make the system slower rather than faster.
    • Batch processing is bounded by a single instance. DP1 means all requests queue into one inference instance. Under high concurrency, scheduling and memory fragmentation pressure concentrate on that one point.
    • MoE characteristics are not used. The baseline treats an MoE model like a dense model by uniformly slicing its expert parameters. During forward execution, All-to-All communication and TP communication stack, further increasing latency.

    So the baseline often “works,” but it is far from the hardware’s real capability.

    Optimization 1: Reworking the Parallelism Strategy

    The optimized configuration rebalances parallelism to TP2 + DP4 and adds expert parallelism (EP) for the MoE layers. The reasoning is worth examining.

    Lower Tensor Parallelism, Shrink the Communication Domain

    Reducing TP from 8 to 2 means layer-level collective communication only happens between 2 cards. The amount of data exchanged and the number of participating devices both drop significantly. For inference workloads where per-layer computation is small, especially in decode phases, reducing the communication ratio directly improves end-to-end latency.

    Data Parallelism Increases Concurrency

    DP4 organizes the 8 cards into 4 independent inference instances, each using 2 cards. Multiple instances can handle request streams in parallel, which is effectively horizontal scaling inside one server. Under SLO constraints such as first-token latency and inter-token latency limits, a multi-instance architecture can absorb much higher concurrency and therefore push the system’s total throughput higher.

    Expert Parallelism Matches the MoE Structure

    For MoE, expert parameters are distributed across devices along the expert dimension, so each card stores and computes only part of the experts. This can significantly reduce per-card memory consumption, leaving more room for KV cache and larger batches. During the forward pass, the required All-to-All exchange is limited to devices that hold the routed experts. Compared with “TP slicing plus full AllReduce,” this communication pattern better matches the MoE computation structure.

    A Practical Tuning Sequence

    There is no universal best TP/DP/EP split. It depends on model size, expert count, per-card memory, interconnect bandwidth, and the concurrency characteristics of the business workload. A common practical method is:

    1. Use memory constraints to determine the minimum TP value.
    2. Use concurrency demand under SLO to determine the DP value.
    3. Add EP for MoE, then verify with real measurements.

    Optimization 2: Communication and Compilation-Level Acceleration

    Parallelism strategy determines how work is split. The second set of optimizations determines how fast each step executes.

    Sequence Parallelism and Communication Fusion

    Sequence-dimension splitting can break apart the communication originally belonging to tensor parallelism and overlap it with computation, reducing communication exposure on the critical path. This kind of communication-compute fusion, often called communication fusion or sequence-parallel optimization, is especially effective for decode-phase small-batch computation, where each step is short and communication occupies a larger share.

    Graph Compilation and Kernel-Level Optimization

    The next optimization enables graph-mode compilation for the NPU. The model forward pass is compiled as a whole graph, reducing the scheduling overhead of dispatching operators one by one. Kernel-level compilation then lets core operators such as matrix multiplication and attention better match the hardware’s compute units and memory hierarchy.

    The benefits of graph compilation come from two directions: it removes Python scheduling and operator launch bubbles, and it gives the compiler the chance to perform global optimizations such as operator fusion and memory reuse.

    These optimizations are additive to the parallelism change. Parallelism defines the shape of communication; communication and compilation optimizations reduce the actual time spent on each communication and compute segment.

    Test Results and Methodological Lessons

    With the same SLO, the optimized configuration improved total throughput by up to 53.5% over the baseline. The results point to several practical lessons:

    • Tuning is a combinatorial engineering effort. Individual optimizations often produce limited gains. In this case, the parallel strategy, communication optimization, and compilation optimization together produced more than 50% improvement.
    • SLO is the premise for throughput. Discussing throughput without latency constraints is meaningless. Pushing batch size can produce very high offline throughput, but it can make an online service unusable. All comparisons should be made under the same SLO.
    • The optimal configuration is workload-dependent. Different concurrency ranges and different input/output length distributions may favor different parallel layouts. It is best to run tiered stress tests on representative workloads before finalizing a configuration.

    Making Deployment Experience Reusable: The Value of a Solution Catalog

    The larger value of this case is methodology. In China-made NPU environments, each “model × hardware” combination may need a similar round of tuning. If every deployment starts from zero, the cost is extremely high.

    A practical engineering practice is to build a model deployment solution catalog. For a specific model and hardware, record:

    • Inference engine version
    • Runtime image
    • Resource requirements
    • Parallel parameters
    • Optimization switches

    For already-tuned deployments, archive both the baseline and optimized configurations, together with their benchmark reports.

    With this catalog, teams can search by model or hardware, compare performance data, and start from an existing configuration by validating and adjusting it for their own workload, instead of repeating trial-and-error. The deployment platform can also automatically sync configurations from the catalog, so selecting a solution becomes deploying it. This shortens the cycle from model selection to production.

    Conclusion

    Optimizing LLM inference on China-made NPUs is essentially a joint optimization of model architecture, hardware characteristics, and business workload. This case shows that reworking parallelism and adding communication and compilation optimizations can deliver substantial throughput gains without sacrificing latency. Turning those tuning experiences into searchable, reusable solution assets is the key to scaling such gains across more models and more deployment environments.