Token Throughput Optimization Techniques That Actually Work

Token Throughput Optimization Techniques That Actually Work

Token throughput optimization techniques are the methods that raise how many tokens a language model serving system produces per second, and they decide whether a deployment is cheap or ruinously expensive. Which technique should you try first? Continuous batching, because it fills every spare GPU slot with waiting work, and it is the single change that most teams should make before touching anything else.

Throughput matters because it sets the cost per token. A GPU costs roughly the same per hour whether it produces 100 tokens a second or 5,000, so every technique that raises tokens per second without adding hardware cuts the unit cost of serving. The goal is not raw speed for its own sake: it is more useful work from the same GPUs, at latency your users will still accept.

Key takeaways

  • Token throughput is tokens produced per second, and it sets the cost per token on fixed hardware.
  • Continuous batching is the highest-value first step, because it keeps GPUs busy instead of waiting for whole batches to finish.
  • KV cache efficiency decides how large a batch can run, so paging and prefix caching raise throughput directly.
  • Speculative decoding trades a small draft model for faster token generation, and works best when the draft model is accurate.
  • Every technique trades something: latency, memory, accuracy or complexity, so measure before and after each change.

What token throughput means

Token throughput is usually measured in tokens per second across the whole serving system. It counts both prompt tokens processed in prefill and generated tokens produced in decode, though the two behave very differently. Prefill processes many tokens at once and uses the GPU well, while decode generates one token at a time per request and is limited by memory bandwidth.

The distinction matters because a technique that helps one phase may do nothing for the other. Larger batches help decode by sharing weight reads across requests, but they add waiting time to prefill. Quantisation helps decode by cutting memory traffic, but barely changes compute-bound prefill.

Knowing which phase dominates your workload is the first step in choosing techniques, and it varies by request type: long prompts are prefill-heavy, long replies are decode-heavy.

Throughput is also not the same as latency. A system can produce many tokens per second in aggregate while each individual user waits a long time, if requests queue behind large batches. Good serving balances the two, and the techniques below differ in how they strike that balance.

Continuous batching: the first technique to adopt

Traditional static batching waits until a whole batch of requests finishes before starting the next one. Because requests finish at different times, the GPU spends part of every batch running a handful of stragglers at low utilisation. Continuous batching, also called in-flight batching, removes that waste: as soon as a request finishes, a waiting request takes its place immediately.

The idea was popularised by Orca, a research system from Microsoft, and it is now standard in serving engines such as vLLM and TensorRT-LLM. It works at the level of individual generation steps rather than whole requests, so the batch is re-formed dozens of times per second as requests arrive and complete. The result is higher utilisation without any change to the model, and it is why continuous batching is the usual first recommendation for any serving deployment.

There is a limit, however. Larger batches raise throughput but also raise the time to first token, because a new request may wait for a slot. Most engines let you cap the batch size or the number of running sequences, and the right cap depends on your latency budget.

A chat product with a strict latency target will run smaller batches than an offline summarisation job that only cares about total tokens per hour.

KV cache management and prefix caching

The KV cache is often the binding constraint on batch size. Each running request holds a cache that grows with every token, and when GPU memory fills up, no new request can start. Techniques that shrink the cache or share it therefore raise throughput directly, by letting more requests run at once.

PagedAttention is the best-known approach: it stores the cache in small blocks allocated on demand, ending the waste of reserving maximum-length slabs. Prefix caching goes further by sharing blocks for identical prompt prefixes, so a long system prompt or retrieved document is stored once instead of once per request. Multi-query and grouped-query attention reduce the cache at the model level by sharing key and value heads across query heads, which is why many newer models are designed with grouped-query attention from the start.

Quantising the KV cache to 8-bit precision is another option, roughly halving its size with a small accuracy cost that should be tested on your own tasks. The common thread is simple: every gigabyte of cache saved is a gigabyte that can hold more concurrent requests, and more concurrent requests mean more tokens per second.

A monitor showing abstract performance graphs and bar charts in blue and green
Throughput work is measurement work: track tokens per second and time to first token per request type before changing anything.

Speculative decoding and other generation techniques

Speculative decoding attacks the decode bottleneck directly. A small, fast draft model proposes several tokens at once, and the large model then checks them all in a single parallel pass, accepting the correct ones and correcting the rest. When the draft model guesses well, several tokens emerge from one pass through the large model instead of one, which can substantially raise token throughput.

The gain depends on the acceptance rate: how often the large model agrees with the draft. A draft model that is too small guesses poorly and wastes the verification passes, while one that is too large costs almost as much as the main model. The technique shines for predictable text such as code and structured output, and less for open-ended creative writing.

Speculative decoding is worth testing on your own traffic rather than assuming a published speedup will apply.

Other generation techniques include chunked prefill, which splits long prompts into pieces so they do not block decoding for other requests, and disaggregated serving, which runs prefill and decode on separate GPUs so each can be scaled and tuned independently. Both add operational complexity, so they suit larger deployments rather than small services.

Model-level techniques: quantisation and distillation

Quantisation reduces the precision of model weights, typically from 16-bit to 8-bit or 4-bit. Because decode is memory-bound, halving the weight size roughly doubles the speed at which weights can be streamed, which raises token throughput directly. The accuracy cost is usually small for well-tested schemes, but it varies by model and task, so measure it on your own evaluation set before deploying.

Distillation takes a different route: a smaller student model is trained to mimic a larger teacher, and the student then serves the bulk of traffic at a fraction of the cost. The upfront training effort is significant, but for high-volume, narrow tasks such as classification or extraction, a distilled model can be the cheapest path to high throughput. Routing sits between the two: a small model answers routine requests and only the difficult ones reach the large model.

Choosing between these is a question of volume and task breadth. Quantisation is quick to try and keeps the same model, distillation is a bigger investment for a bigger saving, and routing needs a reliable way to judge which requests are hard. All three can be combined, and the best deployments usually do.

Token throughput techniques compared

The table below summarises the main techniques, what they improve, and what they cost.

Technique What it improves Main cost or risk Best for
Continuous batching GPU utilisation Higher time to first token Almost every deployment
PagedAttention and prefix caching Batch size via KV cache Needs a supporting engine Long or shared prompts
Speculative decoding Decode speed Draft model accuracy decides the gain Predictable text, code
Quantisation (8-bit, 4-bit) Memory traffic per token Small accuracy loss High-volume decode work
Chunked prefill Fairness between requests Added scheduling complexity Mixed long and short prompts
Disaggregated serving Independent prefill and decode scaling Two fleets to operate Large-scale deployments

Best for: busy serving deployments, where continuous batching plus KV cache efficiency delivers most of the gain before any model change is needed.

Checklist: raising throughput step by step

Work through this list in order, measuring after each step.

  • Measure current tokens per second, time to first token and GPU utilisation by request type.
  • Turn on continuous batching and set a batch cap that respects your latency budget.
  • Enable prefix caching if your prompts share system prompts or retrieved context.
  • Check KV cache usage and consider paged allocation or 8-bit cache quantisation.
  • Test 8-bit weight quantisation on your own evaluation set and confirm accuracy.
  • Trial speculative decoding on your most predictable workloads, such as code or structured output.
  • Split long prompts with chunked prefill if they delay other requests.
  • Only then consider disaggregated serving or distillation for the highest-volume paths.

Frequently asked questions

What is a good token throughput figure?

There is no universal good number, because it depends on the model size, the hardware and the request mix. Compare against your own baseline before and after each change, and against the cost per token rather than an absolute figure from another deployment.

Does a bigger batch always raise throughput?

Up to a point. Throughput rises with batch size until the GPU is saturated, then flattens while latency keeps growing. The right batch size is the smallest one that saturates the GPU at your latency budget.

Does quantisation hurt answer quality?

It can, but the loss is usually small for 8-bit quantisation on well-tested schemes, and larger for 4-bit. Measure on your own evaluation set, including your hardest tasks, before deploying to production.

Is speculative decoding always faster?

No. It is faster when the draft model predicts well, which depends on the text type. For unpredictable or creative text, the acceptance rate drops and the verification overhead can erase the gain.

Test on your own traffic.

How does batching affect time to first token?

Larger batches can delay the first token, because a new request may wait for a slot or for a long prefill ahead of it. Batching trades latency against throughput, so set batch caps from your latency budget rather than from throughput alone.

Token throughput optimisation is mostly about removing waste: idle GPU time, unused KV cache memory, repeated prefill work and memory traffic that a smaller representation could avoid. Start with batching and cache efficiency, measure everything, and add the more complex techniques only where your own numbers say they help.

Latest articles

Scroll to Top