LLM Parallelism Tuning: How We Raised Throughput by 53.5% on 8 Domestic AI Accelerators
This article explains how a team improved inference throughput by up to 53.5% on an 8-card domestic accelerator setup by reworking parallelism and enabling compiler-side optimizations. It covers why a repeatable baseline is essential, how tensor, data, expert, and sequence parallelism trade off against memory and latency, and how quantization, graph mode, and kernel auto-tuning fit into a reusable tuning workflow. All configurations are illustrative, so readers can adapt the method to their own hardware and workloads under a defined SLO.
LLM Parallelism Tuning: Raising Throughput by 53.5% on 8 Domestic AI Accelerators
1. Background: Why “It Runs” Is Not the Same as “It Runs Efficiently”
When teams deploy large models on domestic accelerators, the first milestone is usually just getting the stack to work: choosing model weights, matching an inference engine and container image, and confirming that memory and card count are sufficient. Once real traffic arrives, attention shifts quickly to unit cost and service quality: how many tokens per second the node can sustain under a given service level objective (SLO), whether long inputs and multi-turn conversations cause queue amplification, and whether time-to-first-token blows up as concurrency rises.
The difficulty is that inference performance is not driven by a single factor. It is the combined result of compute, communication, memory bandwidth, scheduling policy, and compiler optimization. On the same hardware, changing only the parallelism layout can move total throughput by tens of percent. Using public baseline and optimized comparison data from an open-source compute deployment and inference optimization platform running on 8 domestic accelerators, this article abstracts a reusable tuning methodology: under a fixed SLO, restructuring parallelism and applying compiler-side optimizations raised total node throughput by up to 53.5%.
Note that this article is not tied to any specific hardware model, engine version, or image tag. All configurations are given as illustrative parameters, and readers should re-validate them against their own hardware and workloads.
2. Establish a Baseline First: Optimization Without a Baseline Is Guesswork
2.1 A baseline must include three things
- Hardware and software stack snapshot: card count, per-card memory, driver and runtime versions, inference engine version, quantization format, container image digest.
- Workload model: input/output length distribution, concurrency levels, request arrival pattern (Poisson or constant concurrency from a load test).
- SLO definition: upper bounds on time-to-first-token (TTFT), inter-token latency (TPOT), and end-to-end latency percentiles (P95/P99).
Missing any one of these invalidates later comparisons. The SLO matters most, because it defines the constraint under which throughput is measured. A throughput number with no constraint is nearly meaningless for production capacity planning.
2.2 Three common load-testing mistakes
- Testing only short inputs and short outputs, then hitting queue timeouts on long-text production traffic.
- Jumping concurrency straight from 1 to the maximum, skipping the inflection region, so you cannot tell whether the bottleneck is compute or scheduling.
- Looking only at averages while ignoring P99, which leads to capacity planned on averages and failures at peak.
Instead, run stepped load tests with concurrency on the horizontal axis, plot the throughput-latency curve, and find the maximum concurrency at which latency still stays within SLO. The throughput at that point is the comparable capacity metric.
3. Parallelism Strategy: The Trade-offs from tp8/dp1 to tp2/dp4
3.1 The cost of two extreme layouts
In the original case, the baseline used 8-way tensor parallelism and 1-way data parallelism (tp8, dp1). The optimized setup moved to 2-way tensor parallelism and 4-way data parallelism (tp2, dp4), with expert parallelism added on top. The general principles behind this are worth unpacking:
- Tensor parallelism set too high: each layer’s compute is split into more pieces, per-card compute utilization drops, and every layer requires cross-card reduction communication. Communication count accumulates linearly with depth and easily becomes the bottleneck when inter-card interconnect bandwidth is limited.
- Tensor parallelism set too low: each card must hold more weights and activations, memory pressure rises, usable batch size shrinks, and concurrency capacity suffers.
- The value of data parallelism: requests are spread across replicas, each replica has a smaller communication domain and a shorter critical path per request, so overall concurrent throughput improves markedly. The cost is redundant weight copies and higher memory usage.
So the essence of parallelism strategy is finding the intersection of “acceptable single-request latency” and “maximum node concurrency” under a memory capacity constraint.
3.2 Illustrative configuration comparison
# Baseline (illustrative)parallel:tensor_parallel: 8data_parallel: 1expert_parallel: 1compile:graph_mode: falsekernel_auto_tune: false# Optimized (illustrative)parallel:tensor_parallel: 2data_parallel: 4expert_parallel: 4 # shard experts across parallel groupssequence_parallel: true # reduce activation redundancycompile:graph_mode: true # whole-graph capture to cut kernel launch overheadkernel_auto_tune: true # auto-search kernel implementations for the target hardware
3.3 The added role of expert parallelism
For mixture-of-experts architectures, expert parallelism distributes different experts across cards so each parallel group only needs to hold a subset of expert weights, trading the same memory budget for larger batch capacity. Combined with data parallelism, routing balance matters: if popular experts concentrate on a few cards, individual cards overload while the rest wait. In that case, evaluate whether the routing policy or expert distribution needs adjustment based on the workload profile.
4. Communication and Sequence Parallelism: Cutting Redundant Compute and Communication Together
The general idea of sequence parallelism is to shard activations along the sequence dimension for element-wise operations such as normalization and residuals, so not every card holds a full copy of the sequence activations. It yields two benefits: lower memory usage, which frees room for larger batches; and lower communication volume at these points than the large-matrix reductions in tensor parallelism, making it more cost-effective.
Two cautions when enabling sequence parallelism: first, it shards a different dimension than tensor parallelism, so parallel group partitioning must stay consistent or shapes will mismatch; second, gains are limited on short sequences and it can even be slightly slower due to extra communication, so decide based on the actual input length distribution.
5. Compiler-Side Optimization: Graph Mode and Kernel Auto-Tuning
Inference frameworks typically dispatch work kernel by kernel by default. In structures dense with small operators, scheduling and dispatch overhead is significant. Two general optimizations pay off clearly:
- Whole-graph or subgraph capture: hand the compute graph to the runtime as a whole, reducing host-side dispatch count and lowering per-step latency jitter.
- Kernel auto-tuning: automatically search for better kernel implementations and tiling parameters based on the target hardware’s cache hierarchy and execution unit characteristics.
These two are orthogonal to parallelism strategy and can be stacked. However, graph mode has limited support for dynamic shapes. If input lengths vary widely, evaluate a bucketing strategy that collapses dynamic shapes into a finite set of buckets, balancing compilation gains against memory fragmentation.
6. Quantization and Memory Budget: The Invisible Ceiling on Throughput
The case used quantized model weights. Quantization is not only about saving memory; more importantly, it converts freed memory into larger batch capacity, and batch capacity directly determines the throughput ceiling. A practical budgeting order:
- Weight footprint (including extra metadata from the quantization format and grouping granularity);
- KV cache footprint (grows linearly with concurrency and context length, usually the largest variable);
- Activations and temporary buffers;
- Communication buffers and runtime reserves.
If the KV cache becomes the bottleneck, evaluate general techniques such as paged cache management, context length caps, and prefix reuse, rather than simply increasing tensor parallelism.
7. A Reusable Tuning Workflow
- Fix the baseline: record the software stack, workload model, and SLO, and produce a comparable throughput-latency curve.
- Locate the bottleneck: use the runtime timeline or operator timing view to determine whether you are compute-bound, communication-bound, or scheduling-bound.
- Tune parallelism: within the memory budget, lower tensor parallelism and raise data parallelism, adding expert and sequence parallelism where needed.
- Enable compiler optimizations: turn on graph mode and kernel auto-tuning, and handle dynamic-shape bucketing.
- Regression test: re-measure under the same SLO and confirm the gain did not come at the cost of worse latency percentiles.
- Capture the configuration: write engine version, image digest, resource specs, and parameters into a browsable, reusable deployment plan that the team can search and compare by model and hardware.
8. Conclusion
The 53.5% throughput gain on 8 domestic accelerators did not come from any single silver bullet. It came from stacking parallelism restructuring, sequence parallelism, expert parallelism, and compiler-side optimizations, all measured under a fixed SLO. For engineering teams, the more valuable takeaway is the method: build a comparable baseline first, validate each item against the bottleneck, and finally capture the configuration as an organizational asset. As the domestic compute software and hardware stack keeps evolving, this workflow applies equally well to rapid adaptation and capacity planning for new hardware and new model architectures.
