LLM Compute Bottlenecks Explained: Concurrency Limits and KV Cache Optimization
This article explains why LLM inference hits GPU compute and memory limits, how KV Cache management affects the number of concurrent users a service can support, and which engineering techniques help platforms handle compute shortages.
Large language models (LLMs) are now widely used, and the stability and response speed of chatbot services have become key factors in user experience. Recently, a large model platform announced that it was pausing membership access because of tight compute resources. The event made the gap between supply and demand for inference compute clear. In the chatbot era, GPU compute often determines the peak number of concurrent users a platform can serve. This article examines the compute and memory bottlenecks in LLM inference, explains how KV Cache management works, and reviews engineering practices for handling compute shortages.
1. The Core of the Compute Bottleneck: Token Throughput and GPU Utilization
In autoregressive generative models, inference usually has two stages: Prefill and Decode.
During Prefill, the model processes the user’s prompt in parallel and computes the initial KV Cache. This stage is compute-bound, and GPU utilization often approaches its limit. During Decode, the model generates tokens one at a time. This stage is memory-bound. Decode speed depends less on raw compute (FLOPS) and more on memory bandwidth.
If a GPU node is fast enough to finish the current user’s query at a very high token generation rate, it can return the result quickly, offload that user’s KV Cache, and load the next request right away. In this ideal case, the GPU stays near full load. A smaller memory capacity is then “not a big problem,” because fast compute offsets the slower memory turnover. This is a typical time-for-space trade-off. However, when concurrent requests surge and the GPU’s token throughput cannot keep up with incoming traffic, queues build up. The service may then degrade or stop accepting new users.
2. KV Cache: The Main Factor in Memory Usage and Concurrency Limits
To understand concurrency limits, you need to understand the KV Cache (key-value cache). During Decode, the model caches the Key and Value tensors of the attention mechanism at each layer, so it does not recompute the history of the context. As the generated sequence grows, the KV Cache grows linearly.
For a model with tens of billions of parameters, the KV Cache for a single long conversation can take several gigabytes, or even more than ten gigabytes, of GPU memory. GPU memory capacity is fixed, so it directly limits how many active users’ contexts the system can hold at once. When memory is full, new requests cannot be scheduled onto the GPU, and the system has to queue them or reject them.
Compute shortage therefore often comes from two effects combined. Memory capacity limits the batch size, and memory bandwidth limits the generation speed. When memory is constrained, how efficiently the system manages and schedules the KV Cache becomes the key to raising concurrency.
3. KV Cache Eviction and Swapping: Trading User Experience for Concurrency
In real chatbot traffic, user behavior follows a long-tail distribution. Many sessions are one-off, such as “Will it be sunny tomorrow?” or “What event did a celebrity attend yesterday?” These queries usually end after a single exchange, and users rarely reuse the same session. Even in longer multi-turn conversations, users seldom iterate on the same content many times in one day.
Based on this pattern, platforms that need to serve more users with limited compute often adopt aggressive eviction strategies:
- Proactive eviction: When GPU memory is tight, the system first evicts the KV Cache of inactive sessions and assigns the freed memory to new active requests.
- Cold data offloading: The system moves KV Cache that is not in use from expensive GPU memory to CPU memory or NVMe SSDs. When a user returns to a conversation days later, the system loads the context back from the SSD. This hot-cold separation architecture is common in cloud-native environments and is often built on object storage or high-performance distributed storage.
- Recomputation: If a user’s context has been fully evicted and cannot be restored from the SSD, the system must rebuild it. When the user sends the next request, the system replays the full chat history through Prefill. This adds latency and compute cost for that request, but it allows a higher peak concurrency across the whole system.
4. Engineering Practices for Handling Compute Shortages
Eviction alone does not solve compute shortages or concurrency bottlenecks. The industry commonly combines several hardware and software optimizations:
1. Memory paging and fragmentation management
Borrowing from the virtual memory paging mechanism in operating systems, modern inference engines, such as those based on the PagedAttention idea, divide the KV Cache into fixed-size blocks. This avoids the memory fragmentation caused by allocating KV Cache contiguously. It improves memory utilization and lets one GPU hold more concurrent requests.
2. Dynamic batching
Static batching waits until enough requests accumulate in the queue before sending them to the GPU together, which adds latency. Dynamic batching lets new requests join a batch while it is still running, and lets finished requests leave it. This keeps GPU utilization high and prevents compute from sitting idle while waiting for work.
3. Model quantization and kernel optimization
Quantizing model weights and activations from FP16 to INT8, or even INT4, greatly reduces the memory the model occupies. It also lowers memory bandwidth pressure during decoding, which increases the number of tokens generated per unit of compute.
4. Elastic cloud-native compute scheduling
For model providers, building their own compute centers is expensive, and expanding capacity takes a long time. During sudden traffic spikes, elastic cloud capacity is a common answer. For example, container platforms and elastic GPU instances from cloud providers such as Baidu AI Cloud let teams launch new inference nodes quickly, based on real-time monitoring and alerts, so overflow traffic can be absorbed. Combined with cloud object storage, providers can keep large volumes of cold KV Cache data at lower cost and separate compute from storage.
5. Conclusion
A platform announcing a compute shortage may look like it simply lacks GPUs. Underneath, it reflects a complex trade-off among token throughput, memory bandwidth, and KV Cache lifecycle management. When supply and demand are out of balance, fine-grained KV Cache eviction and swapping, dynamic batching, and elastic cloud-native architecture help platforms balance service availability with business growth. As inference frameworks and hardware continue to evolve, the concurrency capacity of LLM services is expected to improve further.
