LLM Inference Deployment Explained: Parallelism Strategies, PD Disaggregation, and KV Cache Optimization

    This article provides a comprehensive guide to deploying large language models for inference, covering the two key cost asymmetries of MoE architectures, three core optimization techniques (expert parallelism, Prefill/Decode disaggregation, and multi-tier caching), KV cache compression, how to determine the minimum parallel domain, latency-throughput trade-offs, and practical benchmarking advice. Readers will learn a principled workflow: derive parallelism from model size, decide on PD disaggregation based on workload characteristics, and tune concurrency and caching against unified TTFT/TPOT SLOs.

    1. Background: Inference Cost Is Defined by Two Asymmetries

    The inference cost of ultra-large sparse Mixture-of-Experts (MoE) models is fundamentally governed by two asymmetries.

    The first is parameter asymmetry. There is a huge gap between total parameters and the parameters activated per token. For a publicly known model at the trillion-class scale, total parameters are around 671 billion, yet only about 37 billion parameters’ worth of experts actually compute on any given token. This means compute cost (FLOPs) scales with activated parameters, while memory must hold all expert weights. A frequently overlooked conclusion follows: MoE is a “compute-cheap, memory-expensive” architecture — the deployment bottleneck is usually memory capacity and inter-card communication, not peak compute.

    The second is phase asymmetry. Autoregressive generation splits into two phases with very different workload characteristics:

    Phase Processing characteristics Bottleneck resource Key metric
    Prefill Processes all input tokens at once; large matrix sizes Compute-bound Time to first token (TTFT)
    Decode Generates one token at a time; reads the full KV cache at each step Memory-bandwidth-bound Time per output token (TPOT)

    Placing both workloads on the same instance causes mutual interference: a long-prompt prefill blocks in-flight decoding requests, causing TPOT jitter, while the low compute utilization during decode wastes capacity provisioned for prefill.

    2. Three Core Technical Approaches

    Given these characteristics, mainstream solutions converge on three main directions.

    2.1 Expert Parallelism (EP)

    Different experts are distributed across accelerators, and token routing plus result collection are handled via All-to-All communication. This solves two problems at once: expert weights are spread across multiple cards, breaking the single-card memory ceiling; and small, scattered expert batches are aggregated into larger ones, increasing the arithmetic intensity of matrix multiplications.

    The key engineering concern is load balancing: skewed routing turns individual cards into long-tail stragglers. Common practices include a capacity factor with token dropping, combined with routing losses or lossless balancing biases to keep the expert distribution as even as possible.

    2.2 Prefill/Decode Disaggregation (PD Disaggregation)

    The two phases are deployed on separate resource pools, each with its own concurrency and batch limits. The prefill pool targets large batches and high compute utilization; the decode pool targets high bandwidth and low latency, with KV cache transfer bridging the two. The benefit is eliminating mutual blocking; the cost is KV migration overhead. Transfer bandwidth and topological affinity therefore become critical design considerations — the two pools typically need to sit within the same high-bandwidth interconnect domain.

    2.3 Multi-Tier Caching

    This includes prefix caching, which reuses shared system prompts and multi-turn history, and tiered storage (HBM — host memory — remote cache/object storage) for cold data. Cache hit rate directly determines TTFT, making it the first-order optimization for long-context and agentic workloads.

    3. Attention Compression: Reducing the KV Cache by Orders of Magnitude

    The KV cache dominates memory and bandwidth during decode. Low-rank latent attention (jointly compressing K/V into a low-dimensional latent space and up-projecting at inference time) shrinks the per-token cache from a scale of “layers × heads × head_dim × 2” down to “layers × latent_dim” — in public reports, from roughly 70 KB per token to under about 1 KB.

    The deployment implications are profound:

    • The number of concurrent sequences a single card can hold rises by an order of magnitude, directly amplifying throughput;
    • 1M-token contexts move from “infeasible” to “configurable”;
    • Cross-pool KV transfer costs drop accordingly, making PD disaggregation easier to adopt.

    Importantly, a higher compression ratio changes the optimal parallelism strategy — once the KV cache is no longer the bottleneck, expert weights and All-to-All communication become the primary constraint again.

    4. Parallelism Dimensions and Determining the Minimum Parallel Domain

    Before deployment, the parallelism combination must be determined. Common dimensions include data parallelism (DP, multiple replicas for throughput), tensor parallelism (TP, splitting operators within a layer), expert parallelism (EP, splitting experts), and pipeline parallelism (PP, splitting layers). The minimum parallel domain is derived backward from the memory requirement of a single replica:

    1. Per-replica weight memory ≈ total params × bytes per param / EP degree / TP degree
    2. Available KV memory = per-card HBM - weight memory - activation & framework overhead
    3. Max concurrency ≈ available KV memory / (KV bytes per token × average sequence length)

    By this logic, an ultra-large flagship model (~671B parameters) typically requires DP8+EP8 on a single 8-GPU node — one replica per machine — while a lighter ~100B-class version can run DP4+EP4, fitting two replicas per node and reducing the share of cross-node communication at equal throughput. Weight size directly determines the width of the minimum parallel domain — the hardest constraint at the selection stage.

    5. Scheduling and the Latency–Throughput Trade-off

    Even after PD disaggregation, each pool needs separate tuning:

    1. Prefill pool: use chunked prefill to cap tokens per batch and prevent long prompts from monopolizing resources;
    2. Decode pool: set maximum concurrency and batch limits to keep queuing latency under control;
    3. Speculative decoding: use a small model or n-gram drafts with parallel verification to reduce TPOT — but at high concurrency, verification overhead can reduce throughput, so enable it dynamically based on load;
    4. Priorities and preemption: separate interactive and batch traffic with dedicated queues.

    The takeaway: the throughput–latency relationship is jointly determined by hardware, input length, cache hit rate, and speculative decoding configuration; no single metric is sufficient to judge a system. A unified yardstick is recommended: “maximum throughput under given TTFT/TPOT SLOs.”

    6. Benchmarking and Practical Deployment Advice

    Four common pitfalls in cross-system comparisons: portability differences across heterogeneous platforms (the same parallelism strategy behaves very differently on different interconnect topologies), deterministic inference requirements (batch-order changes make results non-reproducible), cache economics (hit-rate gains must be weighed against storage cost), and inconsistent benchmark methodology (unaligned input/output length distributions).

    For production, adopt a layered observability stack: a container platform for elastic replicas, log services and monitoring alerts to collect TTFT, TPOT, cache hit rate, and expert load skew, and object storage for model weights and cold caches. General-purpose capabilities from cloud platforms such as Baidu AI Cloud (container platform, object storage, log service, monitoring and alerting) are common choices for this kind of foundation.

    7. Conclusion

    Improving LLM inference efficiency is never a single-point optimization. It is the coordinated result of model architecture (attention compression, sparse activation) and system implementation (expert parallelism, phase disaggregation, multi-tier caching, scheduling). The core decision order in engineering practice should be: first, determine the minimum parallel domain from weight size; next, decide on PD disaggregation based on workload characteristics; finally, tune concurrency and caching against a unified SLO yardstick.