LLM Inference Energy: How to Calculate Tokens per kWh
As leading models' capability gaps on most general tasks gradually narrow, inference cost and energy consumption are becoming important variables in long-term competition. This article presents a reproducible framework for estimating how many tokens one kilowatt-hour (kWh) can produce. It breaks down inference-phase energy, separates the asymmetric energy profiles of prefill and decode, converts energy use into revenue under mixed input/output workloads, and runs a sensitivity analysis on the parameters that matter most. It closes with a capacity-planning checklist and engineering practices for improving tokens-per-kWh output.
As leading models’ capability gaps on most general tasks gradually narrow, inference cost and energy consumption are becoming important variables in long-term competition. Many teams ask: how do you calculate tokens per kWh? Why do prefill and decode consume energy differently? And how is this accounting used for capacity planning? This article provides a reproducible framework: first break down inference-phase energy, then estimate tokens per kWh using conservative assumptions, and finally land on sensitivity analysis and engineering optimization.
1. Tokens per kWh: a reproducible framework
Start with a set of conservative assumptions to make order-of-magnitude estimates:
- A single data-center-class AI accelerator card draws about 700W;
- Including facility overhead for cooling, power delivery, and networking, PUE is about 1.3;
- At large batch sizes, aggregate output throughput per card is about 1000 token/s.
A note on PUE: it only reflects data-center facility overhead and does not include the power of server components such as the CPU, memory, and network cards. This article approximates total IT power with accelerator power, which is fine for order-of-magnitude estimates. If you already have whole-machine power—the server power including CPU, memory, and network cards—replace card_power_w in the code; otherwise you may underestimate actual energy use.
Similarly, 1000 token/s is not a universal constant. For reproducibility, the example conditions in this article are: a 10B-class dense model or an MoE model with equivalent compute cost, FP8 or INT8 quantization, a batch of about 32 to 64, input length 4k, output length 512, and a single card with 80GB HBM, giving an aggregate output throughput of about 1000 token/s. If the model is larger, the context longer, the batch smaller, or the precision higher, output throughput drops noticeably and the parameters need to be re-stated.
Under these assumptions, the calculation can be written as a parameterized function:
def energy_per_kwh(card_power_w=700, pue=1.3, throughput_tok_s=1000,price_per_mtok=50.0, kwh_joule=3.6e6):# card_power_w can be the accelerator power, or the more accurate# whole-machine IT powereffective_power = card_power_w * pue # effective facility power, W = J/sjoules_per_token = effective_power / throughput_tok_stokens_per_kwh = kwh_joule / joules_per_token # tokens produced per kWhrevenue_per_kwh = tokens_per_kwh / 1e6 * price_per_mtokreturn joules_per_token, tokens_per_kwh, revenue_per_kwhfor tp in (500, 1000, 3000):jpt, tpk, rev = energy_per_kwh(throughput_tok_s=tp)print(f"Throughput {tp:>5} tok/s -> {jpt:.2f} J/tok, "f"{tpk/1e6:.1f}M tok/kWh, revenue {rev:.0f} USD/kWh")
If output throughput is 1000 token/s, the energy per output token is about:
910 J/s ÷ 1000 token/s = 0.91 J/token1 kWh = 3.6 × 10^6 J3.6e6 ÷ 0.91 ≈ 3.96M output tokens / kWh
So under the conservative assumptions above, one kWh produces roughly 3.96 million output tokens. If throughput rises to 3000 token/s, the theoretical output approaches 11.88 million output tokens per kWh.
2. Why prefill and decode consume energy differently
LLM inference has two phases with very different energy profiles, and they must be viewed separately:
- Prefill: processes the input prompt in one pass, feeding input tokens into the network in parallel. It is essentially dense matrix multiplication, compute-bound, with high throughput and low energy per token.
- Decode: generates output autoregressively, one token at a time, and every step must read all model weights and the growing KV Cache. It is memory-bandwidth-bound and inherently serial, with higher energy per token.
As a result, per-token energy on the input and output sides is not symmetric. Estimating only from card power without separating prefill and decode easily distorts the conclusion. One common mistake is to estimate using accelerator power only, ignoring server components such as CPU, memory, network cards, and storage, and ignoring the bandwidth pressure from KV Cache growth. A more reliable approach is to use whole-machine power or server-level power for the calculation.
Under the example assumptions, input-side prefill throughput can reach about 10k token/s per card at about 0.09 J/token; output-side decode is about 0.91 J/token. The two differ by about an order of magnitude, so capacity planning cannot look only at “total token count”—it must look at the input/output structure.
3. From energy to revenue: calculating the mixed input/output figure
If you count output tokens only, revenue can be estimated like this: assuming an output price of $50 per million tokens, one kWh produces about 3.96 million output tokens, corresponding to about:
3.96M tokens × $50/M ≈ $198/kWh
If you count input tokens only, assuming an input price of $10 per million tokens while one kWh can process about 40 million input tokens, the corresponding revenue is about:
40M tokens × $10/M ≈ $400/kWh
But a real service usually involves both input and output. Here you cannot simply add the two results; you must weight by token count and each side’s energy. Let the input token count be Nin, the output token count Nout, the input-side energy Jin, and the output-side energy Jout. The mixed energy is:
Jmix = (Nin × Jin + Nout × Jout) / (Nin + Nout)
Assuming 3 units of input and 1 unit of output, weighted by each side’s energy:
Jmix = (3 × 0.091 + 1 × 0.91) / 4 ≈ 0.296 J/tokenTotal token output ≈ 3.6e6 / 0.296 ≈ 12.16M tokens/kWhinput ≈ 9.12M tokens, output ≈ 3.04M tokensRevenue ≈ 9.12M × $10/M + 3.04M × $50/M ≈ $244/kWh
At the example exchange rate, this is roughly on the order of 1800 RMB per kWh. But note: this is a revenue-side estimate, not profit after subtracting electricity, depreciation, bandwidth, software stack, and margin. It is also affected by token price, exchange rate, model structure, and hardware efficiency, and cannot be used directly as a financial forecast.
4. Sensitivity analysis: which parameters matter most
This estimate is highly sensitive to the throughput assumption, so sensitivity analysis matters more than a single conclusion:
| Factor | Direction | Impact on the conclusion |
|---|---|---|
| Output throughput 500→3000 token/s | 6x increase | Tokens per kWh scale up roughly linearly |
| Batch size | Larger | Weight reads amortized over more requests, throughput rises |
| PUE from 1.3 to 1.1 | Optimized | Effective power drops, tokens per kWh rises |
| Model size or quantization | Smaller model or fewer bits | Energy per token drops |
| Electricity price | Up or down | Does not change tokens/kWh, but changes electricity cost |
| GPU utilization | Higher | Effective throughput rises, unit cost drops |
| Context length | Grows | KV Cache reads increase, decode energy rises |
| Token price | Up or down | Revenue per kWh changes proportionally |
If you care about electricity cost itself, use the following approximation to estimate the electricity cost per million output tokens:
Electricity cost / 1M token = J/token × 1M / 3.6e6 × electricity price
At 0.91 J/token and an electricity price of $0.1/kWh, the electricity cost is about:
0.91 × 100 / 3.6 × 0.1 ≈ $0.025/1M token
This shows that in most API pricing scenarios, electricity is not the only major cost, but engineering efficiency significantly affects depreciation, capacity, and margin.
5. Using it for capacity planning: a checklist
To actually use “tokens produced per kWh” in capacity planning, check at least the following items:
- Input/output ratio: whether input or output dominates on average determines the resource split between prefill and decode.
- Target throughput: work backward from QPS, concurrency, and token/s to the number of cards and cluster size.
- P99 latency: first-token latency and per-token latency are affected by prefill and decode respectively.
- KV Cache hit rate: a high hit rate reduces redundant computation and bandwidth pressure.
- Quantization scheme: FP8, INT8, or lower precision reduces weight-read pressure.
- Continuous batching toggle: whether continuous batching is enabled directly affects GPU utilization.
- Prefill/decode separation: if latency and throughput goals conflict, separate deployment scales better.
- Observability metrics: monitor throughput, latency, memory use, energy, and unit token cost.
6. Raising tokens-per-kWh output: engineering practices
Since cost is mainly driven by “tokens produced per kWh,” the optimization directions are fairly clear:
- Improve effective throughput: use continuous batching, dynamic batching, or chunked prefill so expensive weight reads are amortized over more requests.
- Reduce unit energy: reasonably adopt quantization, sparsification, more efficient attention implementations, and KV Cache management to reduce memory-bandwidth pressure.
- Separate prefill from decode: do capacity planning separately for latency-sensitive and throughput-sensitive scenarios to avoid resource waste from co-location.
- Manage PUE and scheduling: improving facility cooling efficiency and optimizing resource orchestration directly affects tokens per kWh.
- Build a load-testing loop: calibrate throughput, energy, and cost models with real load-test data rather than relying only on paper assumptions.
When deploying on the cloud, this kind of inference service can usually rely on a general-purpose container platform for elastic scaling, use object storage for models and data, and use a monitoring and alerting system to track throughput, latency, and unit cost. This way, “how many tokens one kWh can produce” is no longer just an estimate, but an operational metric that can be continuously measured and optimized.
As gaps in model capability narrow, real competitiveness is not just benchmark scores, but unit token cost, energy efficiency, and engineering delivery capability. Using this reproducible framework for capacity planning and cost optimization has more long-term value than simply comparing benchmarks.
