Choosing an LLM Inference Optimization Technique: A Decision-Tree Approach

The Anatomy of the Inference Bottleneck
The fundamental physics of LLM inference is dictated by the memory wall. Because transformer-based models are massive, the GPU spends the vast majority of its time moving model weights and key-value (KV) cache states from memory to compute units, rather than performing the actual mathematical operations. When traffic scales, this bottleneck exacerbates. Requests queue behind long-running generation tasks, and the overhead of managing memory fragmentation can lead to significant compute idle time.
Historically, the evolution of inference optimization has moved through several distinct phases. Initial efforts focused on simple model compression, such as pruning or early quantization techniques. As models grew in size—moving from the billions to the hundreds of billions of parameters—the industry shifted toward architectural improvements like PagedAttention and continuous batching. Today, the field is entering an era of "system-level orchestration," where engineers must decide whether to disaggregate compute resources based on whether the workload is compute-bound (prefill) or memory-bound (decode).
The Six-Question Decision Tree for System Architects
To navigate the crowded landscape of optimization strategies, engineers should utilize a structured decision tree. This approach systematically identifies the bottleneck by asking six fundamental questions, ensuring that technical resources are allocated only where they provide the most substantial impact.
1. Assessing the Model-to-Hardware Fit
The first step is determining if the model fits comfortably within the GPU’s VRAM. If a model consumes 90% of available memory, there is no room for the KV cache, which grows linearly with the sequence length. This forces a low batch size, effectively nullifying any potential for high throughput. If the model is too large, techniques such as quantization (reducing precision from FP16 to INT8 or FP8), weight pruning, or distillation are the primary levers. Research from industry benchmarks suggests that 4-bit quantization can often reduce memory footprints by 60% with less than a 2% degradation in perplexity, making it a prerequisite for many production environments.
2. Identifying Repeated Prompt Structure
In environments like RAG (Retrieval-Augmented Generation) or multi-turn chat applications, prompts are rarely unique. They often contain massive, static system instructions or lengthy conversation histories. If a system recomputes the KV cache for these static tokens for every single request, it is wasting substantial cycles. Prefix caching allows the system to store and reuse the computed states of common prompt prefixes. This technique has proven transformative for enterprise chat interfaces, where the "system prompt" accounts for the majority of the input tokens.
3. Resolving Concurrent Traffic Variability
When a workload experiences "bursty" traffic with mixed output lengths, standard static batching fails. A long-generation request will block the entire GPU until it finishes, leaving other slots idle. Continuous (or in-flight) batching solves this by allowing finished sequences to exit the batch immediately and new requests to enter without waiting for a batch boundary. This is now considered the industry standard; without it, effective throughput typically drops by 30% to 50% in multi-user environments.

4. Mitigating Memory Fragmentation with PagedAttention
Even with efficient scheduling, memory fragmentation remains a persistent issue. Traditional implementations allocate contiguous blocks of memory for the maximum possible sequence length. If a user only uses 10% of that space, the remaining 90% is "dark memory"—allocated but unusable. PagedAttention, a technique inspired by virtual memory management in operating systems, addresses this by partitioning the KV cache into small, non-contiguous blocks. This innovation has been instrumental in allowing modern serving engines to increase batch sizes by 3x or more without requiring additional hardware.
5. Prioritizing Per-Token Latency
For applications where the user experience is defined by the "speed of typing" (token-per-second), speculative decoding is the most effective solution. This involves running a small, fast "draft" model to generate a sequence of tokens, which a larger "target" model then verifies in parallel. When the draft model is accurate, the system achieves near-instantaneous output. However, data indicates that the utility of this approach is highly dependent on the "acceptance rate" of the draft model; if the draft model is too simple, the overhead of verification outweighs the speed gains.
6. Evaluating Prefill-Decode Disaggregation
At the highest levels of scale, the prefill phase (processing the input) and the decode phase (generating the output) require different computational profiles. Prefill is compute-heavy, while decode is memory-bandwidth heavy. In high-traffic scenarios, these two phases can interfere with one another, causing latency spikes. Disaggregation separates these tasks onto dedicated hardware. While this adds complexity—requiring a robust mechanism to transmit KV cache states between nodes—it is the only way to maintain consistent latency targets in systems serving millions of tokens per second.
Analytical Overview of Optimization Trade-offs
| Technique | Complexity | Primary Benefit | Significant Risk |
|---|---|---|---|
| Quantization | Low | Reduced Memory | Accuracy Degradation |
| Prefix Caching | Medium | Higher Throughput | Strict Formatting Requirements |
| Continuous Batching | Low | Resource Utilization | Minor Scheduling Overhead |
| PagedAttention | Medium | Memory Efficiency | Increased Software Stack Complexity |
| Speculative Decoding | High | Reduced Latency | Draft Model "Miss" Penalty |
| Disaggregation | Very High | Massive Scalability | Network/Communication Latency |
Implications for Future Infrastructure
The shift toward these specialized optimization techniques marks a maturation of the AI infrastructure market. Companies are no longer asking simply "how do I run this model," but rather "how do I run this model with the highest possible ROI."
The implications are two-fold. First, the barrier to entry for building high-performance AI services is rising, as it now requires deep expertise in system architecture rather than just model fine-tuning. Second, the cost of inference is continuing its downward trend, not just through cheaper hardware, but through significantly higher utilization rates.
Industry analysts observe that as these techniques become integrated into standard inference engines (like vLLM, TGI, or TensorRT-LLM), the "default" state of a deployment is becoming significantly more efficient. However, the pitfall remains "over-optimization." Implementing speculative decoding or complex disaggregation on a low-traffic service introduces unnecessary points of failure. The most successful organizations are those that match the optimization to the actual traffic pattern, opting for simplicity until the data clearly dictates a move toward more complex architectures.
Conclusion and Best Practices
In summary, the path to efficient LLM inference is not a single "silver bullet" solution but a diagnostic process. By rigorously auditing where the GPU is spending its time—whether it is waiting for memory reads, recomputing redundant prefixes, or struggling with memory fragmentation—teams can apply the specific tool required to unblock their pipeline. The future of AI deployment lies in this intersection of software optimization and hardware orchestration, where the most performant systems will be those that minimize waste at every layer of the compute stack.







