A Practical Guide to Measuring LLM Inference Energy Consumption and Cost

    This guide walks through a modeling approach for estimating how many tokens a large language model can produce per kilowatt-hour, and what that implies for cost. It covers building an energy baseline from card power and PUE, separating decode from prefill throughput, converting energy into dollar figures, and ranking the assumptions by sensitivity. All numbers are illustrative assumptions used to demonstrate the method, not real specifications or billing rules.

    1. Why “Tokens per kWh” Is Worth Calculating

    Beyond model capability leaderboards, engineering teams care about a simpler question: how much useful output does a unit of energy buy? Putting electricity cost, GPU-hours, and selling price on the same scale is what makes capacity planning, pricing, and gross margin answerable. The original estimate lands at roughly four million output tokens per kWh. That figure is not a physical constant; it is the product of several stacked assumptions, which is why the derivation itself is the more valuable part.

    One caveat up front: every number below is an illustrative assumption used to demonstrate the modeling method. None of them represent the real specifications or billing rules of any specific hardware, platform, or service.

    2. Step 1: Establish the Energy Baseline

    Effective power = per-card power × (1 + non-compute overhead factor). Taking about 700W per card and folding in cooling, networking, and CPU overhead at PUE ≈ 1.3 gives roughly 900W of effective power.

    1. P_eff = 700W * 1.3 ≈ 900W
    2. E_per_token = P_eff / throughput

    The critical detail is the definition of PUE: it is the ratio of total facility energy to IT equipment energy, and closer to 1 is better. Measured values vary widely across data centers, and they directly determine whether the baseline is trustworthy.

    3. Step 2: Separate Decode from Prefill

    LLM inference has two phases with completely different energy profiles:

    • Decode: token-by-token autoregressive generation, constrained by memory bandwidth. Aggregate single-card output is taken as 1000 token/s (conservative range 500–3000), which corresponds to 0.9 joules/token.
    • Prefill: parallel computation on the input side, with throughput an order of magnitude higher, taken as 10,000 token/s per card, corresponding to 0.09 joules/token.
    1. decode: 900 J/s ÷ 1000 token/s = 0.9 J/token
    2. prefill: 900 J/s ÷ 10000 token/s = 0.09 J/token
    3. 1 kWh = 3.6e6 J
    4. output side: 3.6e6 / 0.9 ≈ 4 million tokens/kWh
    5. input side: 3.6e6 / 0.09 ≈ 40 million tokens/kWh

    The engineering implication is direct: with long contexts and insufficient cache reuse in multi-turn conversations, prefill becomes the main source of both cost and latency, while output length inflation directly amplifies decode-side overhead.

    4. Step 3: Convert to Dollars and a Sensitivity Range

    Using illustrative prices (output at $50 per million tokens, input at $10 per million tokens): the output side works out to about $200/kWh and the input side to about $400/kWh. At a 3:1 input-to-output ratio, the blended figure is roughly $250–300/kWh. Because the throughput assumptions span a wide range, a reasonable band is 100–800 $/kWh.

    Sensitivity ranking, from largest to smallest impact on the result: aggregate throughput > PUE > input-to-output ratio > unit price. So for capacity and pricing decisions, benchmark real throughput first rather than agonizing over decimal points.

    5. How to Use the Conclusion Correctly

    Claims like “the closed-source route is unsustainable” only hold if selling prices stay above cost long term and the efficiency gap cannot converge. A more defensible statement: inference cost is trending down by orders of magnitude, and unit economics will drive route selection. Three things engineering teams can act on: benchmark real throughput, optimize caching and batching strategies, and turn energy and cost into observable metrics using object storage, logging services, and monitoring and alerting. General-purpose container platforms and monitoring capabilities from cloud providers such as Baidu AI Cloud can serve as the foundation for this kind of benchmarking and observability.