LLM Inference Deployment: Parallelism, Memory, and Scheduling Design
Deploying large language models requires balancing weight placement, active computation, and request scheduling. This article explains how hardware constraints, tensor and expert parallelism, prefill–decode separation, KV caching, and speculative decoding shape inference performance. It also outlines evaluation criteria and a practical design sequence for moving from benchmarks to production.
An inference system must answer three questions at once: Where do the weights reside? How many parameters participate in each computation? How are requests queued over time?
For sparse models such as mixture-of-experts (MoE) architectures, the total parameter count is much larger than the number of parameters activated in a single forward pass. Compute requirements roughly follow the active parameter count, but accelerator memory must accommodate all expert weights and a growing key-value (KV) cache. Ignoring this asymmetry can lead teams to confuse “enough accelerators to compute” with “enough accelerators to hold the model.” In production, memory fragmentation and expert-routing hotspots may become bottlenecks before theoretical floating-point performance does.
A second asymmetry appears within generation itself. Prefill processes the entire input at once, using large matrix multiplications. It is generally more compute-intensive and largely determines time to first token (TTFT). Decode generates only a small number of new tokens per step but repeatedly reads the KV cache for the existing context. It is generally more memory-bandwidth-intensive and largely determines inter-token latency.
When both workloads share the same instances, large prefill batches can increase tail latency for requests already decoding. Small decode batches, meanwhile, can leave prefill compute capacity underutilized. The central deployment challenge is to distribute components with large weight footprints but limited active computation, then isolate execution stages so each can make effective use of its primary resource.
Hardware Constraints Define the Minimum Feasible Deployment
Hardware constraints fall into three categories: available compute, high-bandwidth memory (HBM) capacity and bandwidth, and interconnects between accelerators and nodes.
Weights, activations, and KV caches all consume HBM. Interconnect performance determines the cost of tensor partitioning, expert communication, and cross-node KV transfers. When the weights for one model replica exceed the memory of a single accelerator—or even a single node—the minimum parallel group is determined by the capacity needed to hold those weights, not by application concurrency.
Configurations with larger weight footprints often require broader combinations of data and expert parallelism. Smaller weights and more compact caches create room to shrink parallel groups and increase batch sizes per accelerator.
The storage hierarchy typically includes at least three tiers:
- On-device HBM
- Host memory
- Shared object storage or a distributed file system
Hot experts and KV caches for active requests should remain on the accelerator. Reusable prefix caches can move to host memory, while cold weights and checkpoints can reside in remote storage.
The benefit of additional cache tiers depends increasingly on prefix reuse. Long-context workloads should not be assumed to become faster “for free” simply because caching is available.
How Parallelism Strategies Divide the Work
Parallelism strategies are easier to reason about by their responsibilities than by their names alone.
Tensor parallelism partitions a layer’s matrices across multiple accelerators, reducing per-device activation memory. Because it introduces communication at every layer, it is best suited to domains with high interconnect bandwidth and low latency.
Pipeline parallelism partitions the model by layers and uses microbatches to reduce pipeline bubbles. It is more suitable for deep models whose individual layers fit within the memory available to each pipeline stage.
Data parallelism replicates the computation graph and distributes requests across replicas to increase throughput. Each replica, however, incurs its own weight-memory cost.
Expert parallelism shards expert weights. During routing, tokens are sent to the accelerators hosting the selected experts, and the results are gathered afterward. This directly addresses the MoE asymmetry: all expert weights must remain resident, but only a few experts are activated per forward pass. Distributing those weights also allows tokens routed to the same expert to form larger batches, improving the arithmetic intensity of expert computation.
In practice, deployments combine these approaches. Tensor or expert parallelism within a high-bandwidth domain addresses memory capacity and communication locality, while data parallelism across domains scales request concurrency.
The width of an expert-parallel group is constrained by expert count, load balance, and whether all-to-all communication remains within a high-bandwidth domain. Once the group spans nodes, communication that could previously be hidden may become the dominant source of latency. Increasing expert-parallel width further does not necessarily improve throughput.
The placement logic can be expressed as configuration intent rather than a framework-specific interface:
Weight-memory footprint per replica ≈ all expert weights + shared layers + runtime overheadMinimum parallel-group size ≈ ceil(weight-memory footprint per replica / usable memory per accelerator)Prefill instances prioritize compute batch size and maximum context lengthDecode instances prioritize KV-cache capacity and memory bandwidth
Prefill–Decode Separation and Caching
Separating prefill and decode creates two service pools for workloads with different resource profiles.
The prefill pool sets concurrency and batch limits according to input length and available compute. The decode pool sets concurrency according to cache capacity and memory bandwidth, preventing long-context requests from degrading inter-token latency for shorter requests.
The computed KV state must move between the pools. This can happen through shared memory on the same machine or through cross-machine transfers. As the state grows, transfer costs can consume the gains from separation. Attention compression and cache reuse should therefore be treated as prerequisites for an effective separated architecture, rather than optional finishing touches.
Multilevel caching reduces repeated prefill work. Identical system prompts and document prefixes do not need to be recomputed for every request. Its economics depend on hit rate, residency cost, and invalidation policy.
With a high hit rate, caching can substantially reduce TTFT. With a low hit rate or highly personalized contexts, cache residency can crowd out decode batches and even reduce total throughput. Caching should therefore be managed as an observable resource, not treated as an optimization switch that is enabled by default.
Useful measurements include:
- Prefix-length distribution
- The cache tier serving each hit
- Reasons for eviction
- Prefill compute saved through reuse
On the attention side, the engineering objective is to reduce KV-cache bytes per token while keeping accuracy loss acceptable. Greater compression can make long-context memory demand manageable through capacity planning instead of allowing cache growth to quickly exhaust available memory.
When comparing generations or implementations, evaluate cache bytes per token, changes in computation at long context lengths, and accuracy degradation from compression—not just a headline compression ratio.
Scheduling, Speculative Decoding, and Performance Metrics
Even after separating the stages, each pool still needs its own concurrency limits, batch limits, and queueing timeouts.
Prefill batching is well suited to token-count budgets. Decode is more sensitive to the cache footprint and synchronization delays associated with the longest sequence in a batch. Dynamic batching improves utilization but can increase tail latency. For interactive applications, TTFT and inter-token latency percentiles should take priority over aggregate throughput.
Speculative decoding uses a lower-cost draft to reduce the number of steps executed by the larger model. It may improve inter-token latency, but fluctuations in acceptance rate can also introduce latency jitter. Its effectiveness depends on draft quality, acceptance rate, and verification overhead; it should not be treated as a fixed, hardware-independent speedup.
Input length, cache hits, and batching policy also affect the relationship between throughput and latency. A single tokens-per-second figure cannot represent the production user experience.
A more reliable evaluation separates at least four workload conditions:
- Short input, short output
- Long input, short output
- Short input, long output
- High prefix reuse
For each condition, report TTFT, inter-token latency, throughput, accelerator utilization, and memory occupancy.
Cross-platform comparisons must also hold numerical precision, sampling settings, and deterministic execution settings constant. Heterogeneous accelerators differ in operator coverage, collective communication implementations, and cache-coherence semantics. Without aligning these conditions, comparative performance figures are only indicative.
Implementation Sequence and Open Questions
Design around the constraints first, rather than starting with the widest possible parallel configuration.
- Estimate memory requirements. Calculate the weight footprint of one replica and the KV-cache requirement at the target context length to establish the minimum parallel group.
- Decide whether to separate the stages. Use the resource profiles of prefill and decode to determine whether dedicated pools are justified.
- Protect expert parallelism from skew and congestion. Add load balancing and congestion controls so that a few hot experts do not erase the benefits of larger batches.
- Introduce caching and speculative decoding as reversible experiments. Use latency percentiles, rather than average throughput, as rollout acceptance criteria.
Several questions require continuing engineering validation:
- How efficiently does expert communication scale across nodes?
- Do compressed-attention implementations preserve both accuracy and cache savings at very long context lengths?
- How does a separated architecture recover from failures during state transfer?
- How consistent is deterministic inference across different hardware platforms?
These issues determine whether a design can move from a benchmark environment to multitenant production—not merely whether it can produce another peak-throughput number.
For cloud deployments, object storage is suitable for checkpoints and cold caches. Container platforms can scale prefill and decode pools independently. Monitoring and alerting should cover queueing latency, cache hit rates, and expert-load skew.
These are general infrastructure capabilities. Actual capacity and network topology still need to be calibrated through measurement; isolated results from public materials should not replace capacity planning.
