LLM Inference Compute Shortages: Capacity Planning and KV Cache Scheduling Explained

    This article explains why "compute shortage" has become a routine challenge for large language model inference services and reframes it as a capacity planning problem rooted in GPU memory and bandwidth rather than raw FLOPS. It breaks down the compute-bound Prefill and memory-bound Decode phases, shows how the KV Cache grows with sequence length and concurrency, and outlines scheduling strategies—priority preemption, offloading, and recompute—for handling memory pressure. It also covers continuous batching, paged memory management, capacity profiling, elastic scaling, and fail-safe designs to help developers balance peak concurrency, latency, and cost under traffic surges.

    1. Why “Compute Shortage” Has Become a Recurring Challenge for Inference Services

    When an AI assistant announces that it is temporarily pausing new paid signups amid a surge of users, people often assume “the model isn’t smart enough” or “the servers got overwhelmed.” From a systems-engineering perspective, though, this is closer to a classic capacity planning problem: the compute supplied per unit time cannot support the flood of concurrent requests arriving in an instant.

    Understanding this starts with distinguishing training from inference. Training is offline, queueable, and throughput-oriented batch work; conversational inference, by contrast, is an online, strongly real-time service that is highly sensitive to latency. When a user sends a greeting, they expect to see the first characters within a few hundred milliseconds—an interaction pattern that means inference cannot simply “wait until a batch is large enough and then compute,” as training can. So the core metric for an inference service is not raw total compute, but how many active sessions the system can sustain simultaneously under acceptable latency—in other words, the “peak concurrent user ceiling.”

    2. Prefill and Decode: Two Fundamentally Different Phases

    The autoregressive generation process of an LLM splits cleanly into two phases with very different hardware demands.

    Prefill phase: it processes the user’s entire prompt, feeding all input tokens into the model in a single parallel pass to compute attention and hidden-layer outputs. This phase is compute-bound—the matrix multiplications are large and can saturate the GPU’s FLOPS.

    Decode phase: it generates subsequent tokens one at a time. Each step processes only a single new token, yet it must attend against the Key/Value cache of all previous tokens. This phase is memory-bound—the bottleneck is not compute but the memory bandwidth repeatedly spent moving model weights and the KV Cache.

    This distinction matters: during decode, the GPU’s compute units often sit “underfed,” and what actually caps throughput is GPU memory bandwidth. Understanding this explains why “compute shortage” is sometimes not about insufficient FLOPS, but about memory capacity and bandwidth becoming the real ceiling.

    3. The Real Bottleneck for Peak Concurrency: GPU Memory and Bandwidth

    The following simplified pseudocode shows, intuitively, how each user is handled during decode:

    1. while not finished:
    2. # 1. Read model weights and the historical KV Cache from GPU memory
    3. # 2. Run attention between the new token and the cache
    4. next_token = model.step(last_token, kv_cache)
    5. # 3. Write the KV of the newly generated token back to the cache
    6. kv_cache.append(next_token.kv)
    7. yield next_token

    Generating every token in this loop requires moving the entire set of model weights and the ever-growing KV Cache across memory. Model weights are a fixed overhead, but the KV Cache grows linearly with session length. As concurrent users increase, the system must maintain a separate KV Cache for each active session in GPU memory, and memory usage accumulates quickly.

    Peak concurrency, then, is fundamentally governed by an inequality:

    1. Σ(weight memory + per-session KV Cache) + runtime overhead ≤ total GPU memory per device

    As this inequality is approached—or breached—the system has to make trade-offs. Notably, the decode phase’s compute units are often not fully loaded; what runs out first is GPU memory space and memory bandwidth. This is also why “just add more compute” does not necessarily raise concurrency linearly—expanding memory and optimizing memory access often yield larger gains.

    4. KV Cache: Both an Asset and a Burden

    The KV Cache is a key optimization for autoregressive inference. It stores the Key and Value vectors of each historical token so that generating each new token does not require recomputing the entire history—without it, producing the Nth token would require a fresh forward pass over the first N−1 tokens, driving complexity up sharply.

    But the KV Cache is also the biggest “memory hog” for concurrency. Its scale can be estimated from the formula below:

    1. KV memory ≈ 2 × num_layers × num_attention_heads × head_dim × sequence_length × concurrency × bytes_per_dtype

    As shown, the KV Cache grows bilinearly with sequence length and number of concurrent sessions. A single long conversation of tens of thousands of tokens can consume a substantial amount of memory on its own; stack hundreds or thousands of sessions together and GPU memory becomes scarce. This leads directly to the next core question: what do we do when memory runs out?

    5. Scheduling Strategies When GPU Memory Runs Short: Discard, Offload, and Recompute

    A key engineering insight is that a chatbot’s KV Cache is disposable. There are two reasons:

    • Uneven session reuse: many sessions are one-off (“Will it rain tomorrow?”, “What’s the key fact of this news story?”), and users rarely return to the same session to iterate within a short window.
    • Temporal sparsity of long conversations: even for a long conversation, the probability of a user following up repeatedly within the same time window is limited.

    Based on this, an inference system can adopt a layered strategy under memory pressure, balancing user experience against concurrency capacity:

    1. Priority preemption: when active sessions exceed what memory can hold, prioritize sessions in active interaction and demote the cache of long-idle sessions.
    2. Cache offloading: move the KV Cache of inactive sessions from GPU memory to larger, cheaper main memory or solid-state storage, freeing up precious GPU memory.
    3. Recompute as a fallback: if even the offloaded cache cannot be retained, discard it and, when the user returns, redo a prefill computation with the full historical context. This causes a one-off latency spike, but relative to holding GPU memory indefinitely and dragging down overall concurrency, the cost of recomputation is fully acceptable.

    The pseudocode below illustrates this scheduling logic:

    1. def schedule(gpu_kv_cache, session, memory_pressure):
    2. if session.is_active:
    3. return gpu_kv_cache.load_or_prefill(session)
    4. if memory_pressure.high and gpu_kv_cache.full():
    5. # Offload first, then discard; recompute when the user returns
    6. storage.offload(session.kv) # or
    7. gpu_kv_cache.evict(session.kv)
    8. return session

    6. Two Core Engineering Techniques for Improving Concurrency

    Beyond the scheduling strategies above, the industry relies on two general techniques to substantially improve concurrency and throughput:

    Continuous batching: traditional batching requires a batch of requests to start and finish together, so short requests must wait for the longest one to complete, leaving compute idle. Continuous batching schedules dynamically at the token level—the moment a session finishes generating, its slot is released and a new request is admitted, keeping the GPU as close to full utilization as possible.

    Paged memory management: it slices the contiguous KV Cache into fixed-size “pages” and allocates and reclaims them dynamically per session, reducing memory fragmentation and reserved waste. Compared with reserving contiguous space for the maximum possible length, paging markedly improves effective memory utilization and indirectly raises the concurrency the system can support.

    Combined with the offload/recompute cache strategies above, these two techniques form the key path for scaling modern inference services.

    7. Capacity Planning and Elastic Scaling

    Returning to the original question—“pausing new signups” is actually a protective product-side response to a capacity constraint. Architecturally, a more sustainable approach is to engineer capacity as a capability:

    • Load testing and capacity profiling: use standardized concurrency load tests to quantify the maximum number of sessions the system can handle at target latency (e.g., time to first token, inter-token generation interval), producing a clear capacity baseline.
    • Elastic scaling: with the horizontal scaling capabilities of container platforms, dynamically adjust the number of instances based on metrics such as queue length, GPU utilization, and GPU memory watermarks—scaling out at traffic peaks and scaling in at troughs.
    • Graceful degradation and queuing: when all instances are saturated, use a message queue to buffer requests and shave peaks, and rate-limit or queue lower-priority requests to avoid avalanche-style overload.
    • Observability: through logging and monitoring alerts, build dashboards and alerts for key metrics such as GPU memory usage, cache hit rate, offload/recompute counts, and queueing time, so capacity bottlenecks can be anticipated ahead of time.

    8. Fail-Safe Design for Stability

    Even with careful planning, sudden traffic can still overwhelm capacity. A robust system needs multiple layers of fallback:

    1. Request admission control: set a concurrency limit at the gateway layer so excess requests return a friendly message or enter a wait state quickly, rather than letting every request drag down the backend.
    2. Cache hit-rate monitoring: if recompute/offload happens too frequently, it signals sustained GPU memory pressure and should trigger scaling or rate limiting.
    3. Tiered service levels: reserve stable resource quotas for high-value or paying users to safeguard the core experience.
    4. Cost observability: bring GPU utilization, GPU memory utilization, and cost per token into monitoring so scaling decisions are driven by data rather than intuition.

    Conclusion

    Behind “pausing signups due to compute shortage” lies a typical inference capacity-constraint event. It reminds us that the competitiveness of an LLM service lies not only in the model’s own capability, but more in whether it can optimize peak concurrency, latency experience, and cost efficiency under limited compute. From the phase characteristics of Prefill and Decode, to the GPU memory trade-offs of the KV Cache, to continuous batching, paged management, offload/recompute, and elastic scaling, these together form a complete optimization chain for inference services. For developers and enterprises, solidly implementing capacity planning, scheduling optimization, and observability is what allows a system to weather traffic surges without sacrificing user experience or losing control of resource costs.