LLM Throughput Optimization on 8 Domestic AI Accelerators: A Practical Guide

    This article presents a practical, hardware-agnostic methodology for improving large language model throughput on an 8-card domestic compute node. It explains why "getting it running" is not the same as "running cost-effectively," and walks through three layers of optimization: parallel strategy (TP, DP, and expert parallelism), sequence parallelism and communication path tuning, and graph mode with operator compilation. It also covers how to build a trustworthy SLO-bound benchmark baseline, common pitfalls such as dynamic-shape recompilation, and how to turn tuning results into reusable deployment assets. An 8-card tuning exercise achieved roughly 53.5% throughput improvement while meeting SLO targets.

    LLM Throughput Optimization on 8 Domestic AI Accelerators: A Practical Guide

    1. Background: Why “It Runs” Is Not the Same as “It Runs Efficiently”

    When deploying large language models on domestic compute platforms, teams usually solve the “can it run at all” problem first: pick a quantized variant, configure the inference engine and container image, load the weights into device memory, and call it done once results come back correctly. Once the model enters production, however, the evaluation criteria switch immediately to two hard metrics: per-card throughput under a given service level objective (SLO), and cost per request. The first determines cluster size; the second determines the bill.

    Take a typical single-node, 8-card deployment as an example. Getting a quantized, medium-sized MoE model running is not difficult. What is difficult is pushing total node throughput higher without changing the first-token latency and end-to-end latency constraints. In one complete tuning exercise, we achieved a maximum throughput improvement of roughly 53.5% while still meeting SLO. This number did not come from a single “magic switch.” It was the result of coordination across three layers: parallel topology, communication paths, and compiled execution. This article abstracts the process into a transferable methodology for teams working with domestic compute.

    Note that this article is not tied to any specific hardware model or commercial product. It discusses general engineering methods: how to overlap computation and communication more fully under constrained memory and interconnect bandwidth.

    2. Quantify First, Then Optimize: Building a Trustworthy Baseline

    The first step in optimization is not changing parameters, but defining “good” and “bad” clearly. At minimum, fix the following:

    • Workload profile: input/output length distribution (for example, the two extremes of short-input/long-output and long-input/short-output), concurrency gradient, and whether streaming responses are enabled.
    • SLO definition: percentile values (commonly P95/P99) for time to first token (TTFT), time per output token (TPOT), or end-to-end latency, plus the maximum acceptable queueing time.
    • Throughput definition: distinguish “offline batch throughput” from “total online throughput that meets SLO.” Only the latter is the production metric.
    • Resource definition: number of cards, per-card memory, and inter-card interconnect topology (full interconnect within a node vs. cross-node networking).

    A schematic load-testing flow can be abstracted as:

    1. for concurrency in [1, 8, 32, 64, 128]:
    2. start_service(parallel_config, compile_options)
    3. warm up for N rounds
    4. apply sustained load for M minutes with a fixed input length distribution
    5. record TTFT percentiles, TPOT percentiles, successful throughput, peak memory
    6. if any SLO percentile is violated -> mark this concurrency as unusable
    7. output: the maximum usable concurrency that meets SLO and its corresponding throughput

    The key point: throughput improvement is only meaningful when bound to an SLO. Without a latency constraint, any “improvement” can be faked by simply increasing batch size without limit.

    3. Layer 1: Parallel Strategy Sets the Concurrency Ceiling

    On a single 8-card node, the common parallel combinations are pure tensor parallelism (TP8, DP1) and tensor parallelism combined with data parallelism (TP2, DP4). MoE models can also introduce expert parallelism (EP).

    Pure TP8 is characterized by a single replica occupying all 8 cards, with weights sliced very finely and a cross-card reduction accompanying every layer. Its advantage is low single-request latency. Its disadvantage is that the replica count is 1, so concurrency scheduling relies entirely on batching within a single engine. Once batch size is limited by memory or latency, total node throughput cannot scale up.

    After switching to TP2 + DP4, the node becomes 4 independent replicas, each internally splitting across 2 cards with tensor parallelism. The gains come from three places:

    1. Higher replica-level parallelism: requests can be distributed across 4 engines, queueing time drops, and usable concurrency rises significantly.
    2. Smaller communication domain per replica: cross-card reduction happens only between 2 cards, reducing both communication volume and latency.
    3. More batching headroom: KV Cache pressure per card drops, allowing longer contexts or higher concurrency.

    For MoE structures, adding expert parallelism on top distributes different experts across different cards, separating expert computation from attention computation for scheduling and mitigating load skew caused by hot experts. Note that expert parallelism introduces additional routing and All-to-All communication. If the network or interconnect bandwidth is insufficient, the gains will be consumed by communication, so it must be measured rather than enabled by default.

    A rule of thumb: only consider TP8 when the model weights cannot fit into 8 cards as a single replica at the target precision. If they fit into 2–4 cards, prefer “small TP + multiple DP.” This is the most common first step for improving total throughput in online serving scenarios.

    4. Layer 2: Sequence Parallelism and Communication Path Tuning

    Once the parallel topology is fixed, the second layer of opportunity comes from “whether computation and communication overlap on the same card.”

    The core idea of Sequence Parallel is to split computation that was originally replicated along the batch dimension—such as LayerNorm and residuals—along the sequence dimension across cards. This spreads activation memory and some computation, while replacing redundant computation with more regular collective communication. For long-input scenarios, it alleviates both memory pressure and computational redundancy, making it an indirect means of increasing usable batch size.

    On the communication side, several general practices are worth checking:

    • Overlap communication with computation: run reductions/broadcasts in parallel with matrix computation on different streams to avoid serial waiting.
    • Communication primitive selection: prefer low-latency primitives for small tensor slices, and bandwidth-oriented primitives for large gradient/activation synchronization.
    • Topology awareness: keep the communication domain within the high-speed interconnect of a single machine to avoid cross-node networks becoming the bottleneck.
    • Reduce unnecessary synchronization: avoid frequent device-host synchronization that interrupts the pipeline.

    A schematic configuration abstraction (not a specific product interface, only expressing intent):

    1. parallel:
    2. tensor_parallel_size: 2
    3. data_parallel_size: 4
    4. expert_parallel: enabled
    5. optimization:
    6. sequence_parallel: enabled
    7. overlap_comm_with_compute: true
    8. graph_mode: enabled
    9. kernel_autotune: enabled

    5. Layer 3: Graph Mode and Operator Compilation

    The first two layers solve “how to split” and “how to overlap.” The third layer solves “how to execute.” Dynamic, operator-by-operator execution often fails to saturate the pipeline on domestic accelerators, because each operator dispatch has fixed overhead and cross-operator fusion is not possible.

    With graph mode enabled, the entire forward pass is captured as a static computation graph. At runtime, the engine can perform operator fusion, constant folding, memory reuse, and scheduling orchestration, compressing the dispatch overhead of many small operators into a single overall submission. Combined with operator autotuning, which selects better implementations and tiling parameters for the current shapes and hardware, additional gains can usually be obtained.

    The pitfalls in practice are also clear:

    • Dynamic shapes cause repeated recompilation. It is recommended to bucket input lengths, converging shapes to a finite set.
    • Graph capture is incompatible with custom operators, requiring fallback. Keep a toggleable degradation path.
    • First-time compilation takes a long time. Warm up thoroughly before load testing, otherwise the data is not trustworthy.

    6. Turning Experience into Reusable Assets

    The value of a tuning exercise lies not in the percentage in a report, but in whether the next person can reuse it. It is recommended to consolidate each “model + hardware” combination into a structured deployment profile containing at least: inference engine and image version, card count and parallel configuration, quantization precision, key optimization switches, SLO definition and measured data, and known limitations and fallback plans.

    In related practice at Baidu AI Cloud, this kind of information can be managed centrally through a model catalog and deployment backend: the catalog side organizes browsable profile entries by model or hardware dimension, recording the engine, image, resources, and parameters; the deployment side automatically syncs catalog configurations, reducing drift from manual copying. Teams can then run small-scale validation against their own hardware topology and business workloads, turning “pitfalls others have stepped into” into their own starting point rather than repeated trial and error.

    7. Deployment Checklist

    1. Are the SLO and throughput definitions fixed in writing, and was load testing warmed up sufficiently?
    2. Have you tried “small TP + multiple DP” and compared usable concurrency against pure TP8?
    3. For MoE models, have you evaluated the communication cost of expert parallelism?
    4. Is sequence parallelism enabled to trade for more batch headroom?
    5. Does communication overlap with computation, and is the communication domain kept within the high-speed interconnect?
    6. Are graph mode and operator autotuning enabled, and are input lengths bucketed?
    7. Are degradation switches and fallback paths preserved?
    8. Are tuning results consolidated in a structured form that the deployment backend can reuse directly?

    8. Conclusion

    Throughput improvement on an 8-card node is essentially about using constrained resources more fully: parallel strategy sets the concurrency ceiling, sequence parallelism and communication tuning determine the degree of overlap, and graph compilation determines execution efficiency. Stacking the three, a throughput improvement of roughly 50% while meeting SLO is an expected engineering result, not an accident. More importantly,固化 the evaluation definitions, parameter combinations, and measured data into reusable assets, so that every optimization on domestic compute can be inherited.