LLM Inference Cost Evolution and Private Deployment Practices
As foundation models converge on general capabilities, the real competition is shifting from benchmark scores to the cost per token and engineering control. This article uses "how many tokens can one kilowatt-hour produce" as a practical lens to build a cost model covering power draw, PUE, aggregate throughput, and the asymmetry between prefill and decode. It then examines when the cost curve makes self-hosted inference clusters economically attractive for large enterprises, and closes with a complete optimization path: capacity planning, quantization and batching tuning, cache reuse, hybrid routing, and observability. The goal is to help developers make verifiable deployment decisions under hardware and electricity price constraints.
1. Why “Tokens per kWh” Is a Useful Metric
As models converge in general capability, the quality gains from model selection narrow while cost keeps taking a larger share of total spend. Under this assumption, the list price per token is less informative than the conversion between the physical layer and the commercial layer: how many usable tokens a unit of electricity produces. This metric ties together data center power bills, hardware depreciation, cluster utilization, and pricing strategy on a single chain, making it easier to compare real economics across different scales, hardware generations, and batching strategies.
This conversion is an order-of-magnitude estimation tool, not an exact bill. Its value lies in identifying the dominant cost drivers, locating the inflection point, and giving directional guidance on when to self-host versus when to call external services.
2. Layer One of the Cost Model: From Power Draw to Energy per Token
The calculation starts with effective per-card power plus whole-system overhead. For a typical high-power accelerator, a single card draws several hundred watts; adding cooling, networking, storage, and control overhead and scaling by a PUE factor yields the effective power attributed to one card. Next comes aggregate output throughput: in large-batch inference, the output tokens a card generates per second are constrained jointly by batch size, context length, attention implementation, and memory bandwidth, and typically vary across a wide range.
Energy per token is effective power divided by aggregate throughput:
def energy_per_token(card_power_w, pue, tokens_per_sec):effective_w = card_power_w * puereturn effective_w / tokens_per_sec # joules/token# Illustrative values: 700W per card, PUE 1.3, aggregate 1000 token/se = energy_per_token(700, 1.3, 1000)print(e) # ≈0.91 joules/tokenprint(3_600_000 / e) # ≈3.95 million tokens/kWh
The conclusion is robust: even adjusting aggregate throughput widely between hundreds and thousands, the output per kWh stays in the millions of tokens. Energy consumption is therefore not the dominant cost driver today; pricing and utilization are what actually determine the bill.
3. Layer Two of the Cost Model: The Asymmetry Between Prefill and Decode
Conflating the input side with the output side is a common mistake. Prefill is a highly parallel matrix operation whose aggregate throughput far exceeds autoregressive decoding, so energy per token can be an order of magnitude lower; decode generates tokens one at a time, limited by memory bandwidth and scheduling overhead, with noticeably higher energy consumption. The same kWh therefore maps to very different token volumes on each side.
In engineering terms, weight by a typical input/output mix rather than simply adding the two:
def blended_value(out_price, in_price, out_tokens, in_tokens):return (out_tokens * out_price + in_tokens * in_price) / 1e6# out_tokens/in_tokens are the volumes producible per kWh; prices are per million tokensprint(blended_value(50, 10, 4_000_000, 40_000_000))
Plugging in list prices shows that the “book revenue” per kWh can reach hundreds of dollars, thousands of times the industrial electricity price. This gap is the root of every economic driver discussed below: as long as it exists, the motivation to compress the middle layers and increase self-owned capacity will not disappear.
4. The Inflection Point: When Self-Hosting Inference Pays Off
The economics of self-hosted inference come down to four factors: electricity price and PUE, hardware depreciation period, target utilization, and the actual external price per call. A simplified break-even check:
def self_host_worth(cost_per_kwh, dep_per_kwh, util, external_price_per_mtok, tokens_per_kwh):effective = (cost_per_kwh + dep_per_kwh) / max(util, 1e-6)external = external_price_per_mtok * tokens_per_kwh / 1e6return effective < external, effective, external
The key insight is utilization. Depreciation is a fixed cost, so low utilization multiplies effective cost several times over, which is why small-scale self-hosting often loses to on-demand calls. When a workload has stable baseline traffic, running the baseline on self-owned clusters and sending peaks to external services is the cost-optimal answer.
5. Architectural Response to Capability Convergence
As the gap between models on general tasks shrinks, architecture should treat replaceability as a first-class concern: a unified inference gateway handles protocol adaptation and authentication, a model registry maintains versions and routing weights, and an evaluation pipeline runs regression on a fixed dataset so that swapping backends does not change business semantics. An illustrative configuration:
gateway:routes:- name: baselineweight: 0.7backend: self_hosted- name: overflowweight: 0.3backend: external_apipolicies:max_context: 32768cache: {enabled: true, ttl_seconds: 3600}
6. A Cost Reduction Engineering Checklist
- Batching and concurrency: raising aggregate throughput is the most direct way to cut energy per token and amortize depreciation; pair it with sensible queuing and timeout policies to avoid long tails.
- Memory and caching: prefix cache reuse significantly reduces repeated prefill overhead, with the largest gains for fixed system prompts and long-document question answering.
- Quantization and distillation: lowering weight and activation precision within an acceptable quality range pays off clearly in the bandwidth-bound decode phase, but regression evaluation is mandatory to prevent quality regressions.
- Elastic scheduling: scale replica counts by day/night and business cycles, keeping the baseline on self-owned resources and overflowing peaks to on-demand services.
- Observability: build monitoring and alerting around cost per million tokens, cache hit rate, batch size distribution, and per-card throughput so cost becomes a first-class, attributable metric.
- Capacity planning: run sensitivity analysis with electricity price and depreciation as inputs, and avoid heavy capital investment too early when utilization is insufficient.
7. Conclusion
The physical-layer energy conversion shows that electricity is not the dominant factor in inference cost today; list price and utilization are. Capability convergence accelerates the commoditization of tokens, while the price gap keeps pushing a layered market of self-hosted inference and pass-through services. For developers, the right preparation is not betting on one backend but making routing, evaluation, caching, and cost observability solid enough that both models and compute can be swapped at low cost. General-purpose capabilities such as the container platform, object storage, log service, and monitoring and alerting offered by Baidu AI Cloud can serve as the foundation components for this architecture, helping teams migrate smoothly when the cost inflection point arrives.
