Boosting LLM Inference Throughput on a Domestic NPU Cluster: From Parallelism Strategies to Compiler Optimization

    This article presents a real-world practice of improving large language model inference throughput on an 8-card domestic NPU cluster. Deploying an open-source quantized MoE (Mixture-of-Experts) model, the team achieved up to a 53.5% total throughput improvement under fixed SLO constraints by restructuring parallelism (TP2/DP4 with expert parallelism), compressing communication paths via sequence parallelism and fused communication, and applying graph capture and operator-level compilation optimizations. Beyond the tuning itself, the article discusses how to turn one-off optimization efforts into a searchable, reusable model deployment solution catalog indexed by "model × hardware", so that subsequent teams can start from proven configurations instead of tuning from scratch.

    Boosting LLM Inference Throughput on a Domestic NPU Cluster: From Parallelism Strategies to Compiler Optimization

    Introduction: Why Performance Optimization Deserves Systematic Documentation

    When deploying large language models in production, “choosing the right model” is only the first step. What truly determines inference cost and service quality is how the model is deployed on specific hardware: which inference engine to select, how many accelerator cards the model requires, how to split tensor parallelism and data parallelism, how to compress communication paths, and how to combine compiler optimization flags. These factors are tightly coupled, and a single misconfiguration can significantly reduce the utilization of expensive compute resources.

    This article walks through a real large-scale inference tuning practice: an open-source LLM (with a Mixture-of-Experts architecture, compressed via quantization) deployed on an 8-card domestic NPU cluster. Through parallelism strategy restructuring, sequence-parallel communication optimization, and graph/operator compilation optimization, the team achieved up to a 53.5% improvement in total throughput while meeting the target Service Level Objective (SLO). More importantly, we discuss how to distill such tuning experience from “one-off parameter tweaking” into a “searchable, reusable deployment solution”, so future teams don’t have to start from zero.

    1. The Baseline Metrics: Throughput, Latency, and SLO

    Before discussing optimization, let’s align on the metrics. Inference services typically care about three categories of indicators:

    • Throughput: the number of tokens or requests the system processes per unit of time, which directly determines how much business load a unit of compute can support;
    • Time to First Token (TTFT) and Time Per Output Token (TPOT): which determine the responsiveness users experience;
    • Service Level Objective (SLO): the constraint line on latency metrics, e.g., “P99 TTFT must not exceed a given threshold.”

    It is critical to stress that throughput is meaningless without an SLO. Any system can inflate throughput by endlessly increasing batch size—at the cost of soaring latency. Therefore, all performance comparisons in this article are made under the same SLO constraint: the optimized configuration and the baseline are compared on their maximum achievable throughput while meeting latency targets. This ensures the numbers are engineering-credible.

    2. Baseline: A Conventional Tensor-Parallelism-First Deployment

    The baseline configuration uses the most common deployment pattern in the industry: all 8 NPU cards form one tensor parallelism group (TP=8), with a data parallelism degree of 1 (DP=1). The logic: the model is sharded across all 8 cards, each card holds a fraction of the weights, and all requests are computed cooperatively across these 8 cards.

    TP=8 offers clear advantages—a single instance can host the full model, memory pressure is minimal, and implementation is straightforward. But the costs are equally apparent:

    1. Communication overhead grows with parallelism degree: tensor parallelism requires cross-card collective communication (e.g., All-Reduce) after each layer’s computation. The higher the degree, the more frequent the communication and the more devices involved, inflating communication’s share of end-to-end latency;
    2. Limited concurrency: DP=1 means the entire cluster presents itself as a single inference instance, and batch size is constrained by a single instance’s scheduling capacity;
    3. MoE-specific characteristics are underutilized: for MoE architectures, expert weights are naturally suited to being sharded along the expert dimension. Pure TP sharding causes expert routing to introduce extra cross-card communication.

    3. Optimization 1: Restructuring Parallelism — TP2 + DP4 + Expert Parallelism

    The first optimization step is changing the parallelism configuration from TP8/DP1 to TP2/DP4, combined with expert parallelism (EP). The reasoning behind this adjustment:

    • Lower TP degree to shrink the communication radius: reducing TP from 8 to 2 means each collective communication happens between only 2 cards, significantly cutting communication volume and latency. The high-speed interconnect within a modern NPU node can easily absorb TP2’s overhead, whereas communication across larger groups tends to become the bottleneck;
    • Use data parallelism to boost concurrency: DP=4 divides the cluster into 4 independent inference instances, each scheduling requests independently. Multi-instance parallel processing shortens request queuing, so under the same SLO the system as a whole can sustain higher concurrent traffic;
    • Expert parallelism matches the MoE architecture: distributing expert weights across devices along the expert dimension, combined with the routing mechanism, lets each expert compute on a fixed card—avoiding the global weight movement triggered by expert activation and further reducing communication.

    The essence of this combination is shifting the mindset from “parallelizing to fit the model” to “parallelizing to compute fast”—organizing computation with minimal communication cost within the memory budget.

    4. Optimization 2: Compressing Communication Paths — Sequence Parallelism and Fused Communication

    With the parallelism strategy settled, the second step is cutting the remaining communication overhead. Two main techniques are used in practice:

    1. Sequence Parallelism

    Built on top of TP, sequence parallelism shards the input sequence along the sequence dimension across devices, so operators that originally require the full sequence—such as layer normalization and residual connections—can also run in parallel. It also splits some All-Reduce operations into Reduce-Scatter and All-Gather, which can overlap with other computation. For long-context scenarios, sequence parallelism is particularly effective at reducing communication’s share of total latency.

    2. Communication Operator Fusion

    Fusing multiple small messages into one large message, and scheduling communication to overlap with computation on the stream, so communication latency is hidden behind computation time. Such optimizations are typically provided jointly by the inference engine and the hardware communication library, and must be explicitly enabled in deployment parameters with benefits verified through testing.

    5. Optimization 3: Graph Compilation and Operator-Level Optimization

    The third step targets single-card compute efficiency, mainly through:

    • Computation graph capture and graph execution: capturing fixed-shape computation subgraphs in inference as static graphs, eliminating the scheduling overhead of per-operator dispatch. For the decoding phase—whose computation pattern is highly repetitive—graph execution can substantially reduce host-side overhead;
    • Operator compilation optimization: compile-time optimization of core operators such as matrix multiplication and attention for the target NPU’s instruction set and memory hierarchy (e.g., tiling strategies, memory reuse, instruction scheduling), improving per-operator execution efficiency;
    • Enabling the quantized computation path end-to-end: since the model itself is quantized, it is necessary to ensure quantized operators also execute efficiently in graph mode, avoiding quantization/dequantization nodes that break graph fusion.

    The gains from these optimizations are strongly hardware-dependent. The recommended approach is to enable them one at a time on the target platform and validate each with benchmarks, rather than turning everything on at once.

    6. Test Results and Interpretation

    On the 8-card NPU cluster, under the same SLO, the optimized configuration achieved up to a 53.5% total throughput improvement over the baseline. The gains can be roughly attributed as follows:

    Optimization Dimension Main Mechanism Typical Direction of Gains
    Parallelism restructuring (TP2/DP4 + EP) Smaller communication radius, more concurrent instances Both throughput ceiling and latency improve
    Sequence parallelism and communication fusion Reduced communication volume, compute/communication overlap Lower communication share at long sequence lengths
    Graph execution and operator compilation Eliminated dispatch overhead, higher per-operator efficiency Lower per-request compute time

    To be objective: 53.5% is the maximum observed improvement. Actual gains vary with request length distribution, concurrency level, and how tight the SLO is. Readers reproducing this work should benchmark against their own production workloads.

    7. Making Deployment Knowledge Reusable: From Tuning Notes to a Solution Catalog

    Equally valuable in this practice is how optimization knowledge was organized. When deploying LLMs in a domestic-computing environment, teams repeatedly face the same questions: how to match the inference engine with the image, how many cards are needed, how to set parallelism parameters, and which optimizations suit their workload. If the answers live only in individual engineers’ notebooks, every new project pays the same “tuition” again.

    A practical approach is to build a model deployment solution catalog: indexed by “model × hardware”, each combination records the inference engine version, image, resource requirements, and deployment parameters. For solutions that have been tuned, the baseline configuration, optimized configuration, and benchmark reports are retained as well. Users can search solutions by model or hardware, compare performance data across configurations, and use them as a starting point for validation in their own environment. When the catalog is integrated with the deployment platform, solutions can be automatically synced into actual deployment configurations, further shortening the path from “finding a solution” to “getting it running.”

    Such a catalog currently covers nearly twenty domestic-computing deployment solutions, including the latest generation of domestic NPUs. Teams working on domestic accelerators can start directly from existing configurations and focus their effort on validating against their specific workloads.

    Conclusion

    This optimization practice demonstrates that improving LLM inference throughput is not a single trick, but the combined effect of three layers: parallelism strategy, communication optimization, and compiler optimization. More valuable than a one-off 53.5% gain is distilling the tuning process into a structured, searchable, reusable deployment solution. For teams advancing LLM deployment on domestic accelerators, we recommend the path of “establish a baseline first, optimize item by item, use SLO as the yardstick, and consolidate experience into a solution catalog” to steadily unlock the hardware’s potential.