The Economics of Serving — Cost per Token
Deriving unit cost from hardware price, throughput and utilisation, and the exact price of a tighter latency target.
The unit cost
Let a replica cost per hour, have maximum sustainable output tokens per second, and run at utilisation . Then
Key idea
Three multiplicative factors, and only one of them is a procurement decision:
A replica at 30% utilisation costs per token what the same replica costs at 100%. Negotiating 20% off the hourly rate is worth less than moving utilisation from 50% to 65%.
What a latency target costs
Utilisation cannot be pushed freely, because latency rises with it. Making that explicit turns the cost model into a statement about the latency target itself.
Model a replica as a single-server queue with mean service time and mean latency . Then achieving a mean-latency target requires , and
The factor is decreasing in , equals in the limit of an unbounded latency budget, and diverges as .
Assumptions
is the M/M/1 relation from Queueing and the Utilisation Wall. A different service distribution changes the constant through the variability factor but not the shape: every work-conserving queue has a term, so every such system has a cost that diverges as the latency target approaches the bare service time.
Reading off the exchange rate, with as the unit:
| latency target | |||||
|---|---|---|---|---|---|
| utilisation | 0.50 | 0.67 | 0.75 | 0.90 | 1 |
| relative cost | 2.00 | 1.50 | 1.33 | 1.11 | 1 |
Key idea
Tightening the mean-latency target from to raises unit cost by — 50% more expensive, for a latency improvement. That is the whole trade, in one number, and it is why interactive and batch traffic belong in separate pools: batch work has and should be run at the utilisation that implies, subsidising nothing and being subsidised by nothing.
Where comes from
In weight-bound decoding, each decode step streams the weights once regardless of batch size, so a step takes time and emits tokens. Hence
linear in the batch , and unit cost falls like until the arithmetic units saturate.
Key idea
Unit cost is inversely proportional to batch size, and by Sizing a Serving Cluster End to End the achievable batch is — a memory quantity. So the dominant lever on cost per token is KV-cache footprint, not FLOPs. Halving through grouped-query attention or KV quantisation halves unit cost in the memory-bound regime, which no amount of arithmetic throughput would have done.
What this does not say
This is a model of marginal serving cost. It excludes training amortisation, which for a frequently-retrained model can exceed serving cost entirely; it excludes the cost of the over-provisioned headroom that Autoscaling — Delay, Overshoot and Standing Headroom shows is mandatory; and it assumes the replica is billed continuously, which is wrong for spot or serverless capacity where the pricing model interacts with the scaling delay. Each of those is a real term, and each moves the answer in the same direction.
References
- PaperR. Pope et al. (2022). Efficiently Scaling Transformer InferenceReports the throughput-latency Pareto frontier that the cost-of-latency theorem describes.
These works are cited as sources to read, not reproduced. All exposition, examples and problems on this site are written independently; where an argument is standard, the citation points to a canonical treatment.
Results stated on this page
- PropositionCost per tokenproof includedUnit cost is the hourly price of a replica divided by the tokens it actually delivers, which is its capacity scaled by utilisation.
- TheoremThe cost of a latency targetproof includedUnder a single-server queueing model, cost per token is proportional to W/(W−S), so it diverges as the latency target approaches the bare service time.
- CorollaryWhy batching dominates the cost structureproof includedIn the weight-bound decode regime, tokens per second scale with batch size, so unit cost falls roughly inversely with the batch a replica can hold.