LLM Inference Deployment: Memory Planning and Parallelism Strategies

    Deploying large language models requires balancing GPU memory, interconnect bandwidth, context length, concurrency, and latency targets—not simply choosing an inference framework. This article examines how KV cache compression, model size, parallelism, and prefill/decode disaggregation shape deployment decisions, then outlines the metrics and validation steps needed to evaluate performance on target hardware.

    1. Deployment Is a Constraint Problem, Not a Framework Choice

    An LLM inference deployment must satisfy a set of interdependent constraints under a given hardware configuration and business service-level objective (SLO): GPU memory capacity, memory bandwidth, interconnect topology, context length, concurrent requests, time to first token (TTFT), and time per output token (TPOT).

    An optimization in one area can create a bottleneck elsewhere. Before comparing parallelism strategies, clarify their purpose. The goal is not simply to keep every GPU busy. It is to fit a replica’s weights, KV cache, and activations into memory without letting communication overhead consume the benefits of distributed computation.

    Differences between model generations often appear along three observable dimensions:

    • Attention compression: KV cache bytes per token determine where long-context workloads hit the memory wall.
    • Parallelism group size: The combination and scale of tensor parallelism (TP), expert parallelism (EP), data parallelism (DP), and pipeline parallelism (PP).
    • Cache hierarchy: How GPU memory, host memory, and remote caches are organized, including policies for moving cached data between tiers.

    These are not independent controls. They represent different ways to allocate the same memory budget.

    2. Attention Compression: A Key Variable in Long-Context Feasibility

    Memory consumption during autoregressive inference can be roughly divided into four components: weights, KV cache, activations and temporary buffers, and framework and communication overhead. As context length grows, the KV cache can become the dominant component.

    Public technical reports describe substantial reductions in cache requirements through low-rank latent attention compression, such as MLA-style methods, and grouped-query attention (GQA). Paged block management complements these approaches by improving cache allocation efficiency. Across model generations, reported per-token cache requirements can fall from tens of kilobytes to below one kilobyte; reductions exceeding an order of magnitude are not unusual.

    The engineering implications are significant:

    1. Cache capacity can determine whether million-token contexts are practical. Lower per-token cache requirements increase the possibility of handling extremely long contexts on a single machine rather than distributing them across multiple machines and GPUs.
    2. Per-token computation may also decrease. Compressed attention structures affect both computation and caching. For long contexts, per-token FLOPs may fall to a fraction of those required by a previous generation.
    3. Compression is not free. Low-rank projections introduce additional matrix multiplications and reconstruction work. With short inputs and low concurrency, compression may actually be slower. The crossover point must be measured.

    The following capacity estimate illustrates the method; it does not represent the specifications of any particular product:

    1. def kv_budget(bytes_per_token, ctx_len, concurrency, dtype_bytes=2):
    2. per_seq = bytes_per_token * ctx_len
    3. return per_seq * concurrency / (1024 ** 3) # GiB
    4. # Before compression: approximately 70 KB/token
    5. # After compression: approximately 1 KB/token or less
    6. print(kv_budget(70 * 1024, 128_000, 32)) # Hundreds of GiB
    7. print(kv_budget(1024, 128_000, 32)) # Single-digit GiB

    3. How Model Weights Determine the Minimum Parallelism Group

    Model weights establish a lower bound on a replica’s memory requirements. At half precision, each billion parameters requires approximately 2 GB for weights. Adding KV cache and activation requirements gives the starting point for estimating the smallest viable model-parallel group.

    Larger weight footprints require wider parallelism groups. This is a direct source of deployment differences. Large flagship models, particularly those with sparse expert architectures, often combine data parallelism and expert parallelism, with representative single-machine configurations using groups on the order of eight devices. Smaller variants may start with four-device groups or run within even smaller groups because each replica requires less memory. These are indicative configurations, not universal requirements.

    The main trade-offs are:

    • TP: Typically communication-intensive and best kept within a machine using high-bandwidth interconnects. Cross-machine TP can quickly become network-bound.
    • EP: Suited to sparse expert architectures, distributing experts across GPUs. Its costs include all-to-all communication and load variability when routing is unbalanced.
    • DP: Uses multiple replicas to increase throughput and is the primary mechanism for horizontal scaling. Each replica must independently satisfy its memory constraints.
    • PP: Reduces the weight footprint on each GPU but introduces pipeline bubbles, making it less attractive for low-concurrency, short-sequence workloads.

    A practical ordering is: use memory requirements to determine the minimum parallelism group, use throughput targets to determine the number of DP replicas, and then consider secondary measures such as PP.

    4. Prefill/Decode Disaggregation: Configure Each Phase Separately

    Prefill processes the input prompt and is generally compute-intensive. It can drive high compute utilization and strongly affects TTFT. Decode generates tokens incrementally and is generally memory-bandwidth-intensive, with performance shaped by bandwidth and batch size. It primarily affects TPOT.

    Running both phases on the same instance creates interference. Prefill for a long prompt can delay requests that are already decoding, causing TPOT variability.

    When prefill and decode are deployed separately, their settings should also be separated. The following configuration is illustrative rather than a universal deployment prescription:

    1. prefill:
    2. max_batch_tokens: 8192 # Limit work by token budget, not request count
    3. max_concurrency: 16
    4. parallelism: { tp: 4 }
    5. decode:
    6. max_running_requests: 128 # Primarily limit concurrent requests
    7. max_batch_size: 64
    8. parallelism: { tp: 4, ep: 8 }
    9. kv_cache_dtype: fp8

    The key distinction is how each phase is constrained:

    • Prefill: Set batch limits primarily through a token budget.
    • Decode: Set batch limits through concurrent request counts and available memory.

    A KV transfer channel connects the two phases. Its bandwidth and the cache layout—including block size and alignment—can become new bottlenecks.

    5. Throughput and Latency: Avoid Single-Metric Comparisons

    The same deployment can show very different throughput–latency trade-offs depending on input length, cache hit rate, and speculative decoding settings.

    • Input length: Long inputs push the system toward a prefill bottleneck. Short inputs make decode’s memory-bandwidth bottleneck more visible.
    • Cache hit rate: Prefix cache hits can skip much of the prefill computation and substantially reduce TTFT. Throughput can therefore appear unusually high compared with a workload that has few cache hits.
    • Speculative decoding: A high draft-token acceptance rate can significantly improve throughput. A low acceptance rate can instead add wasted computation and latency.

    Evaluation should cover at least four categories:

    1. TTFT percentiles.
    2. TPOT percentiles.
    3. Effective output tokens generated per unit of time.
    4. Cache hit rate and speculative decoding acceptance rate as workload conditions.

    Throughput figures are not meaningfully comparable without the conditions under which they were measured.

    6. Four Practical Limits on Cross-System Comparisons

    Hardware Portability

    Accelerators differ in their compute-to-bandwidth ratios, interconnect topologies, and support for low-precision execution. A parallelism configuration cannot simply be transferred unchanged from one platform to another.

    Deterministic Inference

    Batch composition, reduction order, and speculative execution paths can affect numerical results. When reproducibility is required, batching policies and operator implementations need to be fixed.

    Cache Economics

    Moving cached data between memory tiers has a cost. The value of a cache hit must be assessed after accounting for transfer and storage overhead, not just the computation it avoids.

    Evaluation Methodology

    Input and output length distributions, whether prefix cache hits are included, and whether latency includes queueing time can all change—or even reverse—a comparison’s conclusions.

    7. Deployment Checklist

    • Build a memory budget for weights, KV cache, and activations, while allowing for framework and communication overhead. Use it to determine the minimum viable parallelism group.
    • Keep TP within a machine where possible, monitor routing balance for EP, and use DP as the primary throughput-scaling mechanism.
    • After separating prefill and decode, configure token budgets and concurrency limits independently, and load-test KV transfer.
    • Standardize the evaluation methodology. Report latency percentiles, effective throughput, cache hit rate, and speculative decoding acceptance rate together.
    • Measure crossover points on the target hardware to establish when compressed attention and speculative decoding provide a benefit.

    LLM inference optimization is a joint effort between model architecture and systems engineering. Model-side compression reduces cache and compute requirements; system-side parallelism, cache hierarchies, and phase separation turn hardware capacity into usable performance. Understanding these relationships is more valuable over the long term than memorizing any single deployment configuration.