Boosting Throughput by 53% on 8-卡 Domestic Accelerators: A Practical Optimization Guide
This article walks through a real-world inference optimization effort that raised total throughput by roughly 53.5% on an 8-card domestic accelerator server under fixed service-quality constraints. It explains how to set a fair baseline, why pure tensor parallelism (TP=8) creates communication bottlenecks, and how switching to TP=2 with data parallelism 4 (TP2×DP4) plus expert parallelism, sequence parallelism, communication overlap, and graph-mode operator compilation delivers the gain. Readers will find configuration examples, evaluation dashboards, reusable deployment notes, and a checklist of common pitfalls.
Boosting Inference Throughput by 53% on 8-Card Domestic Accelerators: A Practical Breakdown
1. Background: Why “It Runs” Is Not the Same as “It Runs Efficiently”
When teams deploy large-parameter models on domestic accelerator cards, they usually pass through three stages. The first is getting it to run, which focuses on whether the engine and image match and whether drivers and firmware are ready. The second is getting it to run stably, which focuses on memory watermarks, communication timeouts, and operator fallbacks during long-duration tests. Only the third stage is running cost-effectively: producing as many valid requests as possible per unit of hardware under a given service-quality constraint.
In most underperforming cases, the problem is not single-card compute. It is a mismatch between the parallel partitioning scheme and the hardware interconnect characteristics, serial waiting between communication and computation, and graph execution plus operator compilation that fail to exploit backend capabilities. In other words, throughput bottlenecks usually come from how work is organized, not from the chip’s peak numbers.
This article uses the inference optimization of a quantized large model on an 8-card domestic accelerator server as a thread, and abstracts a reusable methodology from it. For neutral phrasing, the hardware is referred to below as a “domestic accelerator card (8-card server)”, the inference framework as “the domestic backend version of a mainstream open-source inference engine”, and the model deployment scheme directory as the “model deployment scheme library”.
2. Baseline Setup: Make the Comparison Fair First
The credibility of any optimization conclusion depends on whether the baseline is fair. In practice, fix the following variables and allow only the parallel strategy and compilation/communication switches to change:
- Hardware and drivers: same server, same card model, same driver and firmware versions;
- Model form: same quantization precision, same weight file, same maximum context length;
- Service-quality constraint: explicit upper bounds on time-to-first-token and time-per-token (or end-to-end latency), with throughput counting only requests that satisfy the constraint;
- Load-testing method: fixed input/output length distribution, fixed concurrency gradient, and a steady-state window taken after warmup.
The baseline uses pure tensor parallelism (TP=8, DP=1). This configuration is simple to implement and balances memory usage across cards. Its drawback is that every layer’s forward pass triggers a cross-card reduction, so communication frequency is high, and as concurrency rises the collective communication becomes jittery, pushing up the latency tail. That forces a choice between protecting latency and protecting throughput.
3. Optimization Track 1: Moving from TP8 to TP2×DP4
The optimization adjusts the parallel topology to tensor parallelism of 2 and data parallelism of 4 (TP=2, DP=4), and introduces expert parallelism along the data-parallel dimension. The core logic has three points:
- Shrink the communication domain radius. TP communication is strict intra-layer synchronization, and the more cards participate, the more parties wait on a single reduction. Collapsing TP to 2 cards confines high-frequency communication to card pairs with tighter interconnect, significantly weakening long-tail latency across nodes or chips.
- Increase concurrency capacity. DP=4 means four independent replicas serve requests in parallel, and the scheduler can balance load across replicas. Per-replica queue depth drops, and steady-state throughput scales better with concurrency.
- Spread memory and bandwidth pressure with expert parallelism. For sparse expert structures, expert parallelism lets different cards hold different expert shards, and routing All-to-All distributes tokens. Given that the number of experts is divisible by the parallel degree and routing distribution is not overly skewed, this improves both memory headroom and effective compute utilization.
The applicability boundary needs emphasis: TP is not better when smaller. Too low a TP leaves insufficient per-card memory for weights and activations and raises per-card compute. Expert parallelism is sensitive to routing balance, and severe hot experts turn All-to-All into a bottleneck. Parallel degrees should therefore be treated as a search problem rather than an empirical value, and a small grid sweep over TP∈{2,4,8} with DP=8/TP is recommended.
An illustrative configuration snippet (expressed in generic YAML, not a specific product interface):
parallel:tensor_parallel_size: 2 # intra-layer split, shrink the communication domaindata_parallel_size: 4 # replica-level concurrency scalingexpert_parallel: true # sparse expert shardingexpert_parallel_size: 4runtime:max_model_len: 8192gpu_memory_utilization: 0.88scheduler: { policy: longest_queue_first }quantization:scheme: weight_only_int8 # exact scheme depends on model support
4. Optimization Track 2: Sequence Parallelism and Communication Orchestration
In long-context scenarios, the element-wise operators around LayerNorm, residuals, and attention grow with sequence length, and these fragments are redundantly computed within the TP domain. With sequence parallelism enabled, this computation is split along the sequence dimension, which both reduces per-card activation memory and cuts duplicated computation in the TP domain. Key implementation points:
- Sequence parallelism must align with the TP group; mismatched split granularity introduces extra reordering and concatenation overhead;
- For variable-length inputs, combine it with paged attention and continuous batching to avoid wasted padding for length alignment;
- For communication orchestration, overlap computation with collective communication as much as possible, hiding reductions inside the time window of matrix multiplications.
5. Optimization Track 3: Graph Execution and Operator Compilation
Domestic backends generally provide graph-mode execution and operator compilation. Switching from eager execution to graph capture lets the framework fuse tiny operators into fewer execution units, reducing scheduling and dispatch overhead. Compilation can also perform constant folding, memory reuse planning, and pipeline orchestration. Practical recommendations:
- Complete graph capture with static shapes first (fixed batch and sequence-length buckets) to avoid repeated recompilation caused by dynamic shapes;
- Persist the compilation cache to local or shared storage to prevent cold-start jitter after container restarts;
- Maintain a list of operators that fall back to generic implementations, and evaluate one by one whether shape constraints or version upgrades can eliminate the fallback.
# Pseudocode: general flow of graph capture and compilation cacheengine.build(model, mode="graph", shape_buckets=[(1,2048),(8,4096)])engine.compile(cache_dir="/shared/cache", fuse=true)engine.serve(port=8080, max_num_seqs=256)
6. Measuring Results: Look at Throughput and Latency Together
The core conclusion after optimization is that, under the same service-quality constraint, total throughput of the 8-card server improved by up to about 53.5%. The significance of this number is not the absolute value but that it shows the combined gain of “parallel topology restructuring plus communication and compilation optimization” far exceeds single-point parameter tuning.
A two-dimensional dashboard is recommended:
- Throughput: output tokens per second and completed requests per second among requests that satisfy the constraint;
- Latency: time-to-first-token P50/P95/P99, time-per-token P95, queue wait time;
- Resources: peak memory, inter-card communication share, operator fallback count, graph recompilation count.
Gains are deliverable only when throughput rises and the latency tail does not degrade. If throughput rises but P99 worsens, it usually means concurrency scheduling is too aggressive or expert routing is skewed; roll back the concurrency limit and check the routing distribution.
7. Capturing Experience: Making Optimization Reusable
The value of a single tuning round is limited; only structuring the experience makes it scale. Each “model × hardware” combination should be captured as a browsable entry in the deployment scheme library, recording at least: inference engine and image versions, resource specs, parallel and expert-parallel configuration, quantization scheme, key switches, and a comparison report of baseline versus optimized version. When working with domestic compute, teams can start from a similar entry and do incremental validation against their own hardware topology and business length distribution, instead of trial-and-error from scratch every time.
8. Common Pitfalls Checklist
- Load-testing only short inputs, which misjudges memory behavior and sequence-parallel gains under long context;
- Skipping warmup and counting compilation and cache cold start in the steady state;
- Setting the concurrency gradient too sparsely and missing the throughput inflection point;
- Not monitoring hot experts under expert parallelism, letting All-to-All become a hidden bottleneck;
- Mixing graph mode with dynamic shapes, triggering frequent recompilation.
9. Conclusion
The throughput gain on 8-card domestic accelerators is essentially systems engineering: keep communication close, arrange computation as a pipeline, and turn concurrency into replicas. Restructuring the parallel topology to TP2×DP4, layered with expert parallelism, sequence parallelism, and graph compilation, achieved more than a 50% throughput gain while meeting service-quality constraints. It is a replicable, verifiable, and reusable engineering path.
