LLM Inference Deployment and Parallelism Strategies Explained

    This article breaks down the cost structure of large language model inference, focusing on two key asymmetries: total versus activated parameters, and prefill versus decode workloads. It explains three core techniques—expert parallelism, prefill/decode disaggregation, and multi-tier caching—along with how KV cache compression changes memory and bandwidth requirements. It also covers how compute, HBM capacity, HBM bandwidth, and interconnect constraints shape deployment, why a single metric is insufficient for evaluation, and practical recommendations for memory budgeting, load testing, and reproducibility.

    1. Where the Problem Starts: Two Asymmetries That Drive Inference Cost

    The cost structure of LLM inference is governed by two asymmetries. Understanding them is the prerequisite for sound deployment and parallelism design.

    The first is the asymmetry between total parameter count and activated parameters. Take the sparse mixture-of-experts (MoE) architecture widely used in the industry as an example: total parameter scale can reach the hundreds of billions, yet only a small fraction of those parameters actually participate in computation for each token. Compute (FLOPs) is counted by activated parameters, but GPU memory must hold the weights of all experts. This leads to a counterintuitive conclusion: compute capacity may still have headroom while memory runs out first.

    The second is the load asymmetry between the two phases. The prefill phase processes all input tokens at once, with large matrix sizes and high arithmetic intensity. It is compute-bound and determines time to first token (TTFT). The decode phase generates tokens autoregressively one by one, and each step must read the entire KV cache and all activated weights. It has low arithmetic intensity, is memory-bandwidth-bound, and determines time per output token (TPOT).

    1. Prefill: high arithmetic intensity → bottleneck is compute (FLOPs) → metric: TTFT
    2. Decode : low arithmetic intensity → bottleneck is bandwidth (HBM BW) → metric: TPOT

    2. Three Core Techniques

    In response to these characteristics, mainstream industry approaches converge on three techniques, each addressing one problem: “weights don’t fit,” “loads interfere with each other,” and “recomputation.”

    2.1 Expert Parallelism: Distributing Weights and Increasing Batch Size

    Expert Parallelism (EP) places different experts on different devices, so each GPU holds only a subset of expert weights. This breaks the “all weights must reside locally” constraint across multiple GPUs. An additional benefit: once a token is routed to an expert, it can be batched with other tokens on the device hosting that expert, increasing the effective batch size and easing bandwidth pressure during decode.

    Three engineering concerns must be addressed simultaneously: routing balance (avoiding overload on a few hot experts), All-to-All communication overhead (the main cost source for EP), and competition for memory between expert weights and the KV cache.

    2.2 Prefill/Decode Disaggregation: Isolating the Two Loads

    Deploying the two phases to separate resource pools allows hardware and parallelism strategies to be configured according to each phase’s bottleneck: the prefill side pursues compute density and low latency, while the decode side pursues memory capacity and bandwidth. After separation, concurrency limits and batch size caps must still be set separately for each side, and the KV cache must be transferred to hand the context from the prefill side to the decode side. The transfer latency and bandwidth must be included in the budget.

    2.3 Multi-Tier Caching: Eliminating Repeated Prefill

    Prefix reuse is the most direct lever for reducing cost. System prompts, long documents, and multi-turn conversation history are often highly repetitive. Multi-tier caching (GPU memory—host memory—remote storage) stores the KV cache in layers, completely skipping prefill computation for the hit portion. The key to cache design is balancing hit rate, capacity, and eviction policy, and ensuring the cache key includes all context that affects the result.

    3. Attention Compression: A Step Change in KV Cache Size

    The KV cache is the primary consumer of memory and bandwidth in long-context inference. Low-rank compression approaches represented by Multi-head Latent Attention (MLA) compress the cache representation to tens of kilobytes per token; subsequent generations compress it further to roughly a thousand bytes per token. The benefits are compounding: lower memory usage makes larger batches possible, fewer bytes moved per decode step directly improves TPOT, and per-token compute and cache overhead under long context also drop significantly.

    It is worth emphasizing that a higher compression ratio changes the optimal width of the parallelism domain: when the memory requirement per replica drops, the minimum deployable parallelism degree drops as well, lowering the barrier to small-scale deployment.

    4. How Hardware Constraints Shape Deployment

    A deployment plan is not a free choice; it is framed by three categories of hardware conditions:

    • Compute: determines prefill-side throughput and the TTFT ceiling;
    • HBM capacity: determines the feasible combination of weights, KV cache, and batch size;
    • HBM bandwidth: determines the TPOT floor on the decode side;
    • Inter-GPU and inter-node interconnect: determines whether EP’s All-to-All and inter-phase KV transfer are acceptable.

    A common deployment difference: ultra-large-weight models are limited by the memory requirement per replica, so the minimum parallelism domain is wide, with a typical single-node configuration of 8-way data parallelism combined with expert parallelism. Small and medium models have a low per-replica requirement, and 4-way data parallelism combined with expert parallelism is sufficient. The width of the parallelism domain is not a performance tuning item but a hard constraint on whether the system can start at all.

    5. Metrics: Don’t Evaluate a System With a Single Number

    The relationship between throughput and latency is determined jointly by hardware, input length, cache hit rate, and speculative decoding configuration. No single metric is sufficient to characterize a system. At minimum, fix the following before comparing:

    1. input/output length distribution, cache hit rate, concurrency,
    2. batch size cap, speculative decoding acceptance rate, P50/P95/P99 latency percentiles

    Cross-system comparison is also limited by four factors: heterogeneous platform portability, deterministic inference (whether the same input yields the same output), cache economics (whether the gains from caching cover its cost), and differences in evaluation methodology.

    6. Practical Recommendations and Open Questions

    1. Do the memory budget first, then discuss parallelism strategy: account for weights + KV cache + activations + communication buffers, item by item.
    2. After phase separation, stress-test both sides separately; avoid inferring overall performance from one side’s metrics.
    3. Monitor cache hit rate as a first-class metric, observed alongside logging services and monitoring/alerting systems.
    4. For long-context scenarios, prioritize evaluating attention compression approaches, whose benefits cover memory, bandwidth, and compute.
    5. If the business requires reproducibility, constrain sources of non-determinism in batching and the order of parallel reductions.

    In summary, generational improvements in inference efficiency come from the co-optimization of model structure and system implementation: attention compression lowers the memory and bandwidth cost per token, expert parallelism makes weights distributable and batches larger, phase disaggregation keeps the two loads from interfering, and multi-tier caching eliminates recomputation. Together, the four determine the feasible deployment envelope on given hardware and the final service quality.