Latency, Throughput, and Cost

There is no single "make it fast" for LLM serving — latency and throughput pull against each other, and both trade against cost. The job isn't to maximize one number; it's to hit your latency targets at the lowest cost per token, which means knowing exactly which knob moves which metric and in which direction.

This final post ties the series together around the numbers that decide whether a deployment is good: the latency your users feel, the throughput that determines your cost, and the cost per token that determines whether the whole thing is viable. Every optimization in the series — KV cache, batching, quantization, speculative decoding, serving engines, scaling — is a lever on these three, and they’re in tension. Serving well is managing that tension deliberately.

The metrics, precisely

From the first post, but now the full production set:

Crucially, measure latency at percentiles, not averages. P50 (median) hides the tail; P95/P99 is what your worst-served users experience, and tail latency is where batching and queueing effects show up. An average that looks fine can mask a P99 that’s driving users away.

The central tension: latency vs. throughput

The defining trade-off of LLM serving, which every earlier post touched: the things that maximize throughput often raise per-request latency, and vice versa.

        latency ▲
                │        · bigger batch (cheap, slower per request)
                │      ·
                │   ·
                │·  smaller batch (fast per request, expensive)
                └────────────────────────▶ throughput / cost-efficiency

There is no universally correct point on this curve — it depends on your application. An interactive chat product prioritizes low TTFT and smooth TPOT (lean toward latency); a batch document-processing job prioritizes tokens/second (lean toward throughput). The first design decision is which end of this curve you’re optimizing for, because it dictates every other setting.

Which knob moves which metric

The value of the whole series is knowing, when a metric is wrong, which lever to pull:

Notice how the levers interlock: quantization helps TPOT and throughput (by freeing KV cache memory); prefix caching helps TTFT and throughput. The optimizations compound, which is why a well-tuned stack is several times better than a naive one on every axis at once.

Cost: the metric that pays the bills

Cost per token is downstream of throughput, and the ways to lower it recap the series through an economic lens (and connect to the AI Cost Optimization series):

The discipline is to optimize cost at a fixed quality and latency SLO — it’s easy to make serving cheaper by making it worse, so cost tuning only counts when quality and latency targets still hold.

Putting it all together

Serving an LLM well is a loop, not a one-time setup:

  1. Define SLOs. Decide your TTFT, TPOT, and P99 latency targets from the user experience, and your cost-per-token budget from the business. Without targets, “optimization” is aimless.
  2. Pick your point on the latency/throughput curve from the application (interactive vs. batch).
  3. Use a serving engine with continuous batching and PagedAttention — this is the foundation, not an optimization.
  4. Apply the levers to the failing metric — quantization and speculative decoding for latency, batching and KV cache efficiency for throughput, right-sizing and caching for cost.
  5. Measure at percentiles, under realistic load, and iterate — tail latency and throughput only reveal themselves under production-like traffic.

That loop is the whole series in practice. LLM inference is memory-bound and sequential; every technique here works around one of those two facts; and the art is combining them to hit your latency SLOs at the lowest cost per token. Know which lever moves which metric, respect the trade-offs, and measure honestly — and you can serve large models fast and affordably.

Key takeaways

Further reading

Sources & References

Serving performance and metrics