How Many Tokens per Kilowatt-Hour? Estimating LLM Inference Costs

    This article explores a common question in LLM inference economics: if tokens are treated as a measurable commodity, how many tokens can one kilowatt-hour of electricity produce, and does that define the cost floor of inference? It builds the energy-to-token conversion formula step by step, works through example assumptions, and estimates revenue per kWh. A key finding is that prefill (input) and decode (output) phases differ significantly in energy cost per token, with prefill being roughly ten times cheaper in the given example. All figures are estimates based on explicit assumptions, not measurements of any real product.

    1. Starting with a Question

    Inference services are typically priced as “dollars per million tokens,” while electricity is one of the most intuitive inputs to reason about. This leads to a natural idea: if tokens are a measurable commodity, then the number of tokens produced per kilowatt-hour (kWh) should determine the cost floor of that commodity.

    The idea is reasonable, but the conclusion needs to be validated step by step. This article follows that question: first establishing the conversion between energy consumption and token output, then estimating the revenue side, and finally testing whether the premise “electricity is the dominant cost” actually holds. All figures in this article are estimates based on explicit assumptions and do not represent the measured performance of any real product.

    2. Converting Energy Consumption to Token Output

    2.1 The Basic Formula

    The energy consumed per output token can be expressed as:

    Energy per token (joules/token) = Effective power (watts) ÷ Tokens generated per second (tokens/second)

    Since 1 watt equals 1 joule per second, the units are consistent. One kWh equals 3.6×10^6 joules, so:

    Tokens per kWh = 3.6×10^6 ÷ Energy per token

    Effective power should include the accelerator card itself plus supporting overhead such as cooling, networking, and CPUs. This overhead is usually accounted for through Power Usage Effectiveness (PUE).

    2.2 A Set of Example Assumptions

    Assume a single card’s effective power draw is 900 watts, and the aggregated output speed under large-batch inference is 1,000 tokens per second. Then:

    • Energy per token = 900 ÷ 1000 = 0.9 joules
    • Tokens per kWh = 3.6×10^6 ÷ 0.9 ≈ 4 million

    This number is a theoretical upper bound, built on two implicit premises: the device runs at full utilization at all times, and the throughput comes from a large-batch concurrent workload. In practice, throughput is highly sensitive to model size, batching strategy, context length, and scheduling. If throughput fluctuates between 500 and 3,000 tokens per second, the result varies by roughly a factor of six.

    The following code illustrates this calculation:

    1. def tokens_per_kwh(effective_watts: float, tokens_per_second: float) -> float:
    2. """Theoretical tokens produced per kWh, assuming full utilization"""
    3. joules_per_token = effective_watts / tokens_per_second
    4. return 3.6e6 / joules_per_token
    5. def revenue_usd(tokens: float, price_per_million: float) -> float:
    6. """Convert tokens to revenue in USD at a given price per million tokens"""
    7. return tokens / 1e6 * price_per_million
    8. out_tokens = tokens_per_kwh(900, 1000) # ~4M output tokens
    9. in_tokens = tokens_per_kwh(900, 10000) # ~40M input tokens
    10. print(revenue_usd(out_tokens, 50)) # ~200 USD
    11. print(revenue_usd(in_tokens, 10)) # ~400 USD

    2.3 The Energy Difference Between Input and Output

    Input (prefill) and output (decode) involve fundamentally different computation patterns, so their energy costs differ substantially.

    During prefill, the entire prompt can be processed in parallel, yielding high throughput. During decode, only one token is generated per step, each step depends on the previous one, and the process is primarily limited by memory bandwidth. Under the assumptions above, prefill throughput is estimated at 10,000 tokens per second, giving an energy cost of 0.09 joules per token—roughly one-tenth that of decode.

    This means the same kilowatt-hour processes far more input tokens than output tokens. When designing a system, if the workload is dominated by long prompts and short answers, the input-side share of cost will be noticeably lower than intuition suggests.

    3. From Energy