LLM Inference Throughput Tuning on 8 Domestic AI Chips: A Practical Guide

    This article walks through a complete inference performance tuning process for a quantized large language model deployed on eight domestic AI chips. It shows how refactoring parallelism (from TP=8/DP=1 to TP=2/DP=4 with expert parallelism), enabling sequence parallelism, and applying graph-mode operator compilation raised total throughput by up to 53.5% under an unchanged P99 latency SLO. Engineers will find a transferable, verifiable methodology for parallel topology, communication, and compilation tuning, plus a validation approach based on fixed SLO baselines, incremental load testing, single-variable rollback, and long-run stability checks.

    1. Introduction: Domestic Compute Moves into Fine-Grained Tuning

    As AI infrastructure localization progresses, more teams are migrating large model inference workloads to domestic AI chips. However, swapping hardware does not guarantee that performance targets are met. In real deployments, engineers often find that with the same model and the same number of cards, throughput can vary by tens of percentage points depending only on differences in parallelism strategy, communication paths, and compilation settings.

    This article uses the deployment of a quantized large language model on eight of the latest domestic AI chips as an example to systematically break down a complete inference performance optimization process. While strictly meeting the service quality objective (SLO), the optimized configuration improved total throughput by up to 53.5% over the baseline. The discussion focuses on three main threads: “parallelism strategy refactoring,” “communication and sequence parallelism optimization,” and “low-level graph and operator compilation optimization.” The goal is to help teams using domestic compute build a transferable, verifiable performance tuning methodology.

    It is worth emphasizing that the content here is general inference engineering practice. It does not involve any vendor-specific proprietary interfaces, and all configuration ideas are based on the layered architecture of inference engines and parallel computing principles that are widely accepted in the industry.

    2. Background: Why “It Runs” Does Not Mean “It Runs Well”

    In the early stage of migration, most teams adopt the most straightforward deployment: splitting the model across all eight cards, using tensor parallelism (TP=8) with a single data parallel replica (DP=1). This configuration is simple to implement and spreads memory pressure evenly, but it hides a key bottleneck: communication overhead scales linearly with the degree of parallelism.

    For models using a Mixture of Experts (MoE) architecture, the problem is more pronounced. Every layer of inference involves expert routing and cross-card dispatch/aggregation. TP=8 means each layer performs an all-reduce or all-exchange across eight cards, with many communication rounds and large per-round data volumes. Inter-card interconnect bandwidth quickly becomes the weak link. At the same time, the single-replica structure forces all concurrent requests onto the same execution pipeline, limiting batch scheduling flexibility, so tail latency can breach the SLO during traffic peaks.

    Therefore, the core goal of optimization is not simply to “increase peak compute utilization,” but to maximize the number of effective requests processed per unit time while meeting the P99 latency constraint. This goal requires working on three dimensions at once: parallel topology, communication patterns, and compiled execution.

    3. Overview of the Optimization Path

    The optimization breaks down into three progressive layers:

    1. Parallelism strategy layer: Change TP=8, DP=1 to TP=2, DP=4, and introduce expert parallelism (EP), shifting multiple cards from “collaborating on one layer” to “serving multiple requests concurrently in groups.”
    2. Communication optimization layer: Enable sequence parallelism (FlashComm-style approaches), converting part of the tensor parallel communication into more efficient sequence-dimension splitting and aggregation.
    3. Compilation and execution layer: Enable graph mode and operator compilation optimization on the domestic NPU to reduce host-side scheduling overhead, fuse operators, and shorten the kernel launch path.

    Each layer is discussed below.

    4. Layer One: Refactoring Parallelism So Multiple Cards Truly Serve Concurrently

    4.1 The Essential Change from TP=8 to TP=2, DP=4

    TP=8 splits the computation of every model layer into eight parts, and all eight cards must synchronously finish one forward pass before moving to the next layer. It is essentially a “large and synchronous” whole. After switching to TP=2, each card handles only a half-split within the layer, and inter-group communication volume drops significantly. Meanwhile, DP=4 organizes the eight cards into four data parallel replicas, and the four replicas can process four different batches of requests at the same time.

    The value of this combination lies in:

    • Smaller communication area: The TP domain shrinks from 8 cards to 2, greatly reducing the data volume and number of rounds for cross-card synchronization.
    • Higher concurrency: Four replicas consume the request queue in parallel, batch assembly is more complete, and idle bubbles in the GPU/NPU are filled.
    • Better fault tolerance and elasticity: If a single replica fails, the remaining replicas can still serve in a degraded mode instead of the whole system becoming unavailable.

    4.2 Why Expert Parallelism Is Necessary

    For MoE models, expert parallelism allows different experts to reside on different cards, so requests are computed locally according to routing results. This avoids the memory redundancy and repeated computation caused by every card holding all experts. Layering EP on top of TP=2 and DP=4 turns the overall topology into a three-dimensional structure of “intra-group tensor parallelism + inter-group data parallelism + expert-dimension splitting,” mapping computation and communication more precisely onto the hardware interconnect hierarchy.

    4.3 Configuration Example

    The following is an illustrative configuration (it only expresses parameter relationships, not any engine-specific syntax):

    1. # Baseline: single replica, high tensor parallelism
    2. tensor_parallel_size = 8
    3. data_parallel_size = 1
    4. enable_expert_parallel = false
    5. # Optimized: low tensor parallelism + multiple replicas + expert parallelism
    6. tensor_parallel_size = 2
    7. data_parallel_size = 4
    8. enable_expert_parallel = true

    When tuning, follow the order “set the SLO first, then the replica count, then fine-tune TP”: first estimate the concurrency a single replica can handle based on the latency budget, then decide the number of replicas, and finally probe TP values between 2 and 4. This avoids making a large change all at once, which makes problems hard to isolate.

    5. Layer Two: Sequence Parallelism and Communication Optimization

    Even after the parallel topology is adjusted, communication can become a new bottleneck in long-sequence scenarios. The core idea of sequence parallelism (the common FlashComm-style approach in the industry) is to move part of the communication that originally happens along the tensor dimension onto the sequence dimension: the input sequence is split across cards, each performs local computation, and then a lightweight aggregation is done.

    This approach offers three benefits:

    • Lower peak activation memory per card, leaving room for larger batches.
    • Splitting large all-reduces into smaller pipelined transfers, making better use of interconnect bandwidth.
    • Complementing TP, further compressing synchronization cost within the small TP=2 domain.

    In practice, sequence parallelism should not be enabled unconditionally. When input sequences are short, the scheduling overhead from splitting may outweigh the benefits. It is therefore recommended to run A/B validation based on the actual sequence-length distribution of the workload and to set a minimum-length threshold for enabling it.

    6. Layer Three: Graph Mode and Operator Compilation Optimization

    In eager mode, every step of large model inference comes with a large amount of host-side operator scheduling and kernel launches, and the CPU often becomes the bottleneck before the accelerator does. After enabling graph capture and compilation optimization on the domestic NPU, the entire forward pass is fixed into a compute graph, allowing the engine to:

    • Fuse operators (for example, merging adjacent normalization, activation, and matrix-multiply operators).
    • Reuse memory and plan lifetimes to reduce allocation jitter.
    • Auto-tune kernels, choosing better tiling and pipelining schemes for the specific chip’s memory hierarchy.

    This set of optimizations is orthogonal to the parallelism and communication changes above and can be stacked. In practice, it is recommended to roll out in two batches: first validate the throughput gains from parallelism and sequence parallelism, then enable graph compilation. This makes it easier to quantify each layer’s contribution and to roll back quickly.

    7. Results and Validation

    On eight domestic chips, with a quantized model and the same SLO constraint, the final combined configuration achieved up to 53.5% total throughput improvement over the baseline. More importantly, this result was not obtained by relaxing latency; it was achieved under an unchanged P99 constraint, which makes it directly valuable for production.

    Teams are advised to reproduce and validate with the following method:

    1. Fix the SLO baseline: Define the P99 latency ceiling and the input/output length distribution.
    2. Apply stepped load: Increase load gradually from low concurrency and record the throughput-latency curve and its inflection point.
    3. Single-variable rollback: Change only one dimension at a time (parallelism / sequence / compilation) and keep comparable logs.
    4. Long-run stability testing: Observe memory fragmentation, communication jitter, and tail-latency drift.

    8. Conclusion

    Unlocking the performance of domestic compute increasingly depends on fine-grained tuning of the software stack rather than simply stacking hardware. The three-layer method shown here—“parallelism refactoring + sequence parallelism + compilation optimization”—is a general engineering paradigm decoupled from specific hardware. For teams deploying large models on domestic chips, the recommendation is to first run the baseline configuration already available in the model directory, then, based on your own request lengths, concurrency peaks, and SLO budget, gradually approach the optimal topology in a single-variable manner, ultimately turning “it runs” into “it runs stably and fast.”