LLM Inference Throughput: Understanding High-Throughput Cache Residency Strategies
This article examines why memory bandwidth, rather than compute, is often the real bottleneck in high-throughput LLM inference, especially during autoregressive decoding. It breaks down two practical cache residency strategies: using capacity headroom to keep hot data pinned in high-bandwidth memory, and using prefetch timing to ensure data is still cached when needed. For each approach, it covers core assumptions, design details, trade-offs, and sample pseudocode, then explains how to combine both in a layered setup. It also outlines the observability metrics and load-testing practices needed to verify that the design truly keeps hot data resident instead of shifting pressure elsewhere.
1. The Real Bottleneck in High-Throughput Inference
When people talk about throughput metrics such as “tokens per second,” the first instinct is often that compute is insufficient. In real-world LLM inference serving, however, the autoregressive decoding stage is different: generating each token requires re-reading the massive model weights and the ever-growing context state. As a result, memory bandwidth frequently becomes the bottleneck before compute does.
This has led to a simple but effective idea in the industry: keep hot data in high-bandwidth GPU memory as much as possible, reduce back-and-forth movement across the storage hierarchy, and trade “data never leaving memory” for stable high throughput.
Here, “never leaving memory” does not mean data exists out of thin air. It means hot data stays resident in high-bandwidth memory and is not evicted to lower-bandwidth media due to jitter in capacity management. The source material summarizes two implementation paths: one relies on capacity headroom to prevent eviction, and the other relies on prefetching so data is still in cache exactly when it is needed. Below, both paths are abstracted into general engineering principles with actionable design details.
2. Strategy 1: Trading Capacity Headroom for “Never Evicted”
The core assumption of the first strategy is that as long as the working set always fits, the cache will not incur writebacks and reloads. The implementation focus is not on algorithms but on capacity governance.
- Capacity accounting must leave enough headroom. You need to measure the peak working set, including model weights, key-value state, temporary activations, and runtime metadata, and reserve a safety watermark so that a sudden long context does not consume all the remaining space.
- Admission control must be explicit. When the cache required by a request exceeds the safety watermark, the request should be queued or degraded rather than accepted first and then passively evicted. Passive eviction amplifies local pressure into global jitter.
- The eviction policy should be conservative. When headroom is sufficient, approximate least-recently-used (LRU) is enough; the key is to avoid prematurely evicting blocks still referenced by sequences being decoded, which requires reference counting or active markers.
A schematic admission check can be written as:
def can_admit(req_blocks, used_blocks, total_blocks, safety_ratio=0.9):watermark = int(total_blocks * safety_ratio)return used_blocks + req_blocks <= watermark
The advantage of this path is predictable behavior and stable tail latency; the drawback is conservative capacity utilization and higher hardware cost. It suits online services where the context length distribution is relatively concentrated and latency stability is critical.
3. Strategy 2: Trading Prefetch Timing for “Always a Cache Hit”
The second strategy acknowledges that capacity cannot be infinite, so it changes the goal from “never evicted” to “still there when needed.” This is essentially a timing scheduling problem between cache and computation.
- Prefetch early, but not too early. Prefetching too early crowds out space currently in use, while prefetching too late fails to hide loading latency. The lead time needs to be estimated based on decoding steps and the block access sequence.
- Prefetch in blocks and predictably. Key-value state growth during autoregressive decoding is incremental, so sequential prefetching at block granularity is friendlier than random small-granularity transfers.
- Prefetching needs a cancellation mechanism. When a request is interrupted or finishes early, unused prefetch tasks should be cancellable to avoid wasting bandwidth.
- The hit rate must be measurable. If the hit rate stays below expectations over time, it means the prefetch window does not match the real access pattern, and you should return to access-sequence modeling rather than simply increasing the prefetch volume.
The pseudocode can be expressed as:
def schedule_prefetch(seq, cur_step, block_size, lead_steps):target_step = cur_step + lead_stepsstart = (target_step * block_size) // block_sizereturn [b for b in seq.blocks[start:start + PREFETCH_BATCH]]
The advantage of this path is high capacity utilization and better output per unit of hardware; the drawback is high demands on timing modeling and scheduler quality. Poor tuning can cause the phenomenon of “constant movement, yet the hit rate still does not improve.”
4. How to Choose and Combine the Two Paths
In practice, it is rarely an either-or choice. A layered combination is more common: pin the hottest weights and short-context state in high-bandwidth memory using the headroom strategy, and let the prefetch strategy handle long-tail context in rolling windows. The decision mainly depends on three factors: context length variance, burstiness of request arrivals, and tolerance for tail latency. Low variance and weak burstiness favor the headroom strategy; high variance and cost sensitivity favor the prefetch strategy.
5. Observability and Validation
Regardless of which path you choose, you must establish a metrics feedback loop: cache hit rate, number and bytes of swaps in and out, prefetch lead-time distribution, queueing time, average time per token, and tail latency. Validation should use load-testing traffic that closely matches the real distribution, covering mixed short, medium, and long context scenarios, and should observe whether the hit rate decays over long-running periods. Only when the hit rate, transfer volume, and tail latency are all stable can you conclude that the “data never leaving memory” design is truly effective, rather than shifting pressure elsewhere.
