Tuning LLM Inference on Domestic AI Chips: A 53.5% Throughput Gain on an 8-GPU Server

    This article walks through a real-world performance tuning exercise for serving a large quantized MoE model on an 8-card domestic AI chip server. It covers restructuring the parallelism strategy from pure tensor parallelism to a tensor-plus-data-plus-expert hybrid, enabling sequence parallelism, and applying graph-mode and operator compilation optimizations. Under the same strict SLOs for time-to-first-token and inter-token latency, these changes lifted total throughput by up to 53.5%. The article also discusses structuring deployment configurations into a browsable knowledge base and distills reusable tuning principles for teams migrating to domestic compute.

    Introduction: The Inference Performance Challenge on Domestic Compute

    As the domestic compute ecosystem matures, more teams are moving large language models onto locally produced AI chips. Choosing the model and the hardware is only the first step. The real engineering difficulty is extracting maximum inference throughput from limited hardware while strictly meeting service level objectives (SLOs). This article presents a detailed walkthrough of a deep performance tuning effort for a large-parameter MoE architecture model on a server equipped with eight of a recent domestic AI chip model. By systematically adjusting the parallelism strategy and enabling low-level compilation optimizations, the team achieved up to a 53.5% increase in total throughput under the same SLO constraints.

    Reusing What Works: A Browsable Deployment Knowledge Base

    When deploying large models in a domestic compute environment, organizations often end up reinventing the wheel. How should an inference engine be matched to a container image? How many compute cards does a model need? Which low-level optimizations actually fit the current workload? The answers to these questions are usually scattered across individual engineers’ notes.

    To make that experience reusable, the industry has started structuring deployment settings as reusable “model deployment plans.” A plan is typically built around a specific model and hardware combination and records the required inference engine version, container image, resource allocation, and core launch parameters. Importantly, a mature plan catalog keeps both a “baseline configuration” and an “optimized configuration,” along with the corresponding performance comparison report.

    With an online catalog, architects can search existing configurations by model or by hardware and sync the parameters directly to the deployment backend for one-click startup. This “configuration as code” approach to capturing knowledge means teams working with domestic compute no longer have to start from scratch. They can begin from a general baseline and fine-tune and validate it against their own production traffic, which significantly shortens the time to launch.

    Core Tuning Case: Pushing an 8-Card Setup to Its Limit

    The goal of this exercise was to deploy a large, quantized mixture-of-experts (MoE) model across eight of the latest domestic AI chips, using a mainstream high-performance serving framework as the inference engine. The hard requirement was to maximize total system throughput while keeping both time-to-first-token and inter-token latency within strict SLOs.

    1. Restructuring the Parallelism Topology: From Tensor Parallelism to Hybrid Parallelism

    The baseline used a traditional pure tensor parallelism setup (TP=8, DP=1), meaning the model was split across eight cards with a data parallelism degree of one. This configuration performed acceptably for single requests, but under high-concurrency inference the cross-card communication overhead of tensor parallelism grew sharply, leaving compute units frequently waiting on data movement.

    The optimized setup switched the parallelism strategy to a hybrid of tensor parallelism and data parallelism (TP=2, DP=4). The model is split into two shards within a single group of cards, while four such groups are replicated to process different user requests in parallel. Going further, to match the characteristics of the MoE model, an expert parallelism mechanism was introduced to distribute different expert networks across different chips.

    The reasoning behind this change is straightforward: it substantially reduces both the volume and the frequency of inter-card AllReduce communication, while data parallelism raises the system’s concurrency ceiling. The configuration logic is shown below:

    1. # Baseline configuration: heavy communication overhead
    2. # engine_args = {"tensor_parallel_size": 8, "data_parallel_size": 1}
    3. # Optimized configuration: low communication overhead + high concurrency + expert parallelism
    4. engine_args = {
    5. "tensor_parallel_size": 2,
    6. "data_parallel_size": 4,
    7. "enable_expert_parallel": True
    8. }

    2. Adding Sequence Parallelism and Low-Level Compilation Optimizations

    Adjusting the upper-level parallelism strategy alone was not enough; low-level optimizations targeting the hardware microarchitecture were equally necessary.

    The first step was enabling sequence parallelism. In the Transformer architecture, operations such as LayerNorm produce large activation memory and redundant computation under long sequences. Sequence parallelism splits these operations along the sequence dimension across different chips, which not only reduces per-card memory pressure but also keeps otherwise idle compute units busy during communication gaps, achieving deep overlap between computation and communication.

    The second step was graph mode and operator compilation optimization for the domestic chip. The default eager execution mode introduces substantial host-to-device interaction latency. Enabling the low-level NPU graph capture mechanism compiles and dispatches the entire inference computation graph at once, and compilation optimizations dedicated to matrix multiply-add and normalization operations were turned on. This removes the scheduling overhead of the Python interpreter and brings low-level operator execution efficiency close to the hardware’s theoretical peak.

    Results and a General Tuning Methodology

    After the three layers of optimization described above (parallelism topology restructuring, sequence parallelism, and graph and operator compilation), the final measurements showed that total throughput on eight cards improved by 53.5% over the baseline while still meeting the business SLOs.

    This exercise highlights a few general rules for tuning large model inference on domestic compute:

    1. Don’t rely on tensor parallelism alone: Blindly pursuing a high tensor parallelism degree creates a communication wall. For high-concurrency scenarios, favor a hybrid mode with small TP and large DP.
    2. Exploit hardware features fully: Go deep into the hardware layer, use graph compilation to eliminate scheduling latency, and use sequence parallelism to optimize memory usage and computation-communication overlap.
    3. Tune for the scenario: For specific architectures such as MoE, always enable the corresponding expert parallelism strategy to avoid leaving hardware resources idle.

    For development teams migrating to domestic compute, this layered tuning approach, spanning from the upper-level architecture down to low-level compilation, offers high reference value and is highly reproducible.