Start with the bottleneck, not the technique
LLM inference tuning is less about finding one winning trick than matching a fix to the reason your workload is slow or expensive. A model can be compute-bound, short on memory, stuck behind long generations, or doing the same prompt work over and over. Pick the wrong target and you can add complexity without improving service.
This article lays out a six-question decision tree for choosing an optimization based on your model and traffic. It covers what techniques such as quantization, prefix caching, continuous batching, and prefill-decode disaggregation assume about a workload; how to follow the decision tree; and how to compare the options by latency, throughput, implementation cost, and signs that a choice isn’t paying off.

Why the workload matters
As request volume grows, inference can bog down for several reasons at once: generations keep requests queued, attention’s KV cache consumes GPU memory, and hardware can spend significant time waiting on memory reads. Inference optimization spans techniques for memory, compute, and request scheduling. Each works from a different assumption about the workload, so the useful question is where your system is constrained.
Here’s the thing: the technique names alone don’t tell you which one to try. The model may be too large for its hardware, prompts may repeat, or requests may arrive together and produce outputs of very different lengths. Those conditions point to different fixes, and each comes with its own trade-offs.
What each technique expects
| Technique | Workload assumption |
|---|---|
| Quantization / sparsity / distillation | The model exceeds the hardware or latency budget, and reducing its size is worth some risk to accuracy |
| Prefix caching | Many requests begin with exactly the same tokens, making repeated prefix computation wasteful |
| Continuous (in-flight) batching | Concurrent requests have unpredictable output lengths, so waiting for every request in a batch to finish wastes GPU time |
| PagedAttention | Fragmented or over-reserved KV cache limits batch size below the hardware’s capacity |
| Speculative decoding | Decode is the bottleneck, and a cheaper draft model can correctly predict several tokens at once |
| Prefill-decode disaggregation | Prefill and decode compete for one GPU, hurting both time-to-first-token and inter-token latency |
| Tensor / pipeline parallelism | The model cannot fit on one device, or a device’s compute capacity limits throughput |
| KV cache offloading | GPU memory pressure evicts useful cache entries too soon |
| Offline batch inference | Responses need not be interactive, so total throughput matters more than per-request latency |
The practical takeaway is straightforward: diagnose the constraint before changing the serving stack. The decision tree that follows starts with model fit, then checks prompt reuse, traffic shape, cache pressure, decode latency, and contention between prefill and decode.
Six questions to narrow the choice
1. Does the model fit with room to spare?
Model size sets the capacity available to the rest of the system. A model that barely fits in GPU memory leaves little space for the KV cache, which can restrict batch size even if scheduling is efficient.
If the model is too large, or inference is compute-bound at batch size one, consider model compression first:
- Quantization lowers the precision of weights and activations.
- Structured sparsity removes less important weights to cut computation.
- Distillation trains a smaller model to imitate a larger one.
These methods are largely independent of the serving stack. They also affect how much hardware capacity remains for inference, so assess them before tuning the scheduler. If the model fits comfortably, continue to the next question.
2. Do prompts repeat?
Repeated structure is common in chat histories, agent system prompts, and retrieval-augmented generation (RAG) pipelines, where shared instructions may precede different retrieved passages. If a meaningful portion of requests has an identical prefix, prefix caching can reuse its KV cache instead of calculating it again. Longer conversations can make those savings accumulate.
There’s a strict condition: the prefix must match character for character. Keep stable content at the start of the prompt and put changing content after it. If prompts rarely share a prefix, move on.
3. Do concurrent requests produce different amounts of text?
A one-sentence support reply and a 400-line code response won’t finish together. In a fixed batch, the shorter requests can leave the GPU waiting for the longest one.
Continuous batching lets finished sequences exit as soon as they’re done, while new requests enter without waiting for a batch boundary. It’s a good fit for overlapping traffic with varied output lengths, and most serving engines enable it by default. If your traffic is already well-batched and the GPU isn’t sitting idle, check cache use next.
4. Is KV cache fragmentation limiting batch size?
Some engines reserve one large, contiguous memory block per request, sized for the maximum sequence length. When actual requests are shorter, much of that reservation goes unused and remains unavailable to other requests.
PagedAttention allocates KV cache in fixed-size pages instead, reducing the need for large contiguous reservations. Most modern serving engines support it, so check whether it’s already enabled before changing configuration. If cache memory isn’t the limiting resource, consider decode latency.
5. Is faster token streaming the priority?
Speculative decoding uses a smaller draft model to propose several tokens, then has the main model verify them in one pass. When the guesses are accepted, the system can skip multiple sequential decode steps and reduce inter-token latency.
The extra model and verification work have to earn their keep. If you lack a suitable draft model, or its guesses are often rejected, the added complexity may not improve latency. If that’s your situation, the next question is whether prefill and decode are competing at scale.
6. Are prefill and decode competing for the same GPU?
This is primarily a production-scale architecture decision. When long prefills delay decode requests and worsen both time-to-first-token and inter-token latency, prefill-decode disaggregation can put the two phases on separate hardware. Prefill nodes process prompts and pass their KV cache to decode nodes built for token generation.
That transfer and the routing it requires add overhead. Disaggregation makes sense when the traffic justifies the extra architecture; for smaller workloads or jobs that don’t need interactive responses, offline batch inference may be simpler. If none of these conditions fit, start with continuous batching and prefix caching.

Match the technique to the trade-off
| Technique | Best fit | Trade-off |
|---|---|---|
| Quantization / sparsity / distillation | Models too large for the hardware or latency budget | Possible accuracy loss; quantized activations are harder to get right than quantized weights |
| Prefix caching | Chat, agent, and RAG workloads with repeated prompt structure | Any character-level difference breaks the shared prefix |
| Continuous batching | Concurrent requests with varied output lengths | Little downside in most cases; check whether it’s enabled |
| PagedAttention | Workloads constrained by KV cache fragmentation | Adds a page table layer to attention computation |
| Speculative decoding | Latency-sensitive, single-user generation | Needs a draft model with a sufficiently high acceptance rate |
| Prefill-decode disaggregation | Large-scale traffic where prefill and decode contend for a GPU | KV cache transfer costs and added routing complexity |
| Tensor / pipeline parallelism | Models that cannot fit on one device | Pipeline bubbles and communication between devices |
| KV cache offloading | Long-context or high-concurrency workloads running short on GPU cache memory | Retrieving offloaded cache adds latency |
| Offline batch inference | Non-interactive work where total throughput is the priority | Unsuitable when response time has a strict limit |
Watch for signs the choice isn’t working
A technique can look right on paper and still miss the live bottleneck. The next section turns to the symptoms that reveal when an optimization isn’t delivering, and what to check first.
When an optimization backfires
A disappointing result is often a clue that the technique’s assumptions don’t match your workload. Near-zero prefix cache hits can point to unstable serialization or changing content placed too early; keep the static prompt prefix first and make serialized key order consistent. If batch size stalls despite available memory, inspect the serving engine’s PagedAttention and cache settings, including page size, instead of trusting its defaults.
Speculative decoding depends on the draft model being accepted often enough by the target. If it runs slower than ordinary decoding, try a draft model with more similar behavior—or remove speculation from that workload. Disaggregation can also add latency when traffic is small or requests are short and cache-heavy; use local prefill until traffic passes a threshold you’ve defined. And if weight quantization brings no throughput gain, profile the execution path: full-precision activations and conversions back to full precision before compute may erase the benefit.
Here’s the practical lesson: when an optimization keeps underperforming, investigate the assumption behind it before adding another layer of complexity.
Choose for the bottleneck
Inference tuning starts with identifying what’s limiting the system. Model size, prompt overlap, concurrent traffic, memory fragmentation, and the trade-off between throughput and per-user latency can each call for a different approach. Most deployments will need a small combination of techniques, chosen from measurements of their own workload. The obvious optimization may not be the useful one; the bottleneck decides.
For a broader guide, see The Roadmap to Mastering LLM Inference Optimization.
Happy learning!