LLM Inference Cost Analysis at Thousand-GPU Scale: What Actually Drives Cost Per Token

    API prices can drop overnight, but cost is a physical constraint. This article breaks down what a GPU actually does to generate one token, why prefill and decode compete for the same hardware, and how KV Cache and context length determine batch capacity. It also provides a practical cost formula, reference throughput and cost figures, seven levers for reducing inference cost, and a three-part breakdown for measuring weight bandwidth, KV bandwidth, and idle overhead.

    1. Prices Are Subsidized; Costs Are Not

    The list price of an LLM API can be cut to a quarter of its previous level overnight, and a cache-hit input price can be pushed down to a few cents per million tokens. But list price is a business decision; cost is a physical constraint. The only reliable way to judge whether an inference service is sustainable is to break down the resources consumed to generate a single token.

    The conclusion up front: at thousand-GPU scale, cost per token is not a division of “GPU price ÷ throughput.” It is a range determined jointly by four variables — memory bandwidth, compute, KV Cache capacity, and scheduling efficiency. On identical hardware, different engineering implementations can differ in cost by several times.

    2. What the GPU Actually Does to Generate One Token

    Take a dense model with 70 billion parameters. At half precision, the weights are roughly 140GB. In the decode phase, every new token requires moving all 140GB from HBM into the compute units for a matrix-vector multiplication. At a single-GPU HBM bandwidth of 3.35TB/s, the theoretical ceiling is about 42 moves per second, or roughly 42 tokens/s per request — and that is already an ideal figure that ignores KV Cache reads.

    The key point: the decode phase is bandwidth-bound, not compute-bound. No amount of compute throughput buys faster token-by-token generation.

    3. Prefill and Decode: Two Workloads Fighting Over One GPU

    Phase Bottleneck resource Characteristics How they interfere
    prefill Compute (low-precision TFLOPS) One forward pass consumes the entire prompt and saturates compute Long-sequence computation blocks decode’s token-by-token output
    decode Memory bandwidth Every step reads the full KV history Continuously occupies bandwidth and raises prefill queueing latency

    Put both on the same GPU and the result is predictable: as soon as a long prompt arrives, requests that are streaming output start to stutter; meanwhile a resident decode workload makes time-to-first-token jitter. This is the root cause of unstable latency metrics in inference services, and it is also where cost gets quietly inflated — compute that is blocked is compute you paid for and got nothing from.

    4. The Underrated Memory Bill: KV Cache

    Take a common attention configuration from industry practice: 8 KV heads, head_dim 128, 80 layers, which works out to roughly 320KB of KV Cache per token.

    • 32K context: about 10GB per request;
    • batch size 32: about 328GB, not yet counting the 140GB of weights;
    • context growing from 8K to 128K: KV usage multiplies by 16, and the number of concurrent requests falls off a cliff.

    In other words, context length directly determines batch capacity, and batch capacity directly determines unit cost. Long context is not a free feature toggle; it is the most expensive line on the memory budget sheet.

    5. Cost Formula and Reference Tiers

    A practical estimation formula:

    1. cost per million tokens = GPU price (CNY/GPU-hour) × GPU count ÷ (total system throughput tokens/s × 3600) × 1e6

    Where total system throughput = effective per-GPU throughput × GPU count × effective utilization. Effective utilization typically falls between 0.5 and 0.8, depending on batch scheduling, sequence length distribution, and whether phase disaggregation is in place.

    An order of magnitude observable in public benchmarks (8 GPUs in a single node, dense 70B model, half precision, continuous batching, batch 256): throughput of about 2800 tokens/s, roughly $19 per GPU-hour on cloud, which corresponds to about $1.9 per million tokens. Switching to low-precision weights and KV, raising batch capacity, and adding phase disaggregation typically moves this figure into a lower tier; conversely, with long context and low concurrency, cost can rise several times over. A range is more meaningful than a point value.

    6. Seven Levers for Cutting Cost

    1. Quantization: dropping weights and KV Cache to 8 bits roughly halves bandwidth demand and raises batch capacity accordingly.
    2. Phase disaggregation: deploy prefill and decode in separate pools, each with GPUs chosen for its bottleneck resource, avoiding mutual blocking.
    3. Continuous batching: replace whole-batch waiting with iteration-level scheduling, spreading the cost of weight movement across more tokens.
    4. KV reuse: skip repeated prefill when a prefix cache hits — the single biggest saving for long system prompt scenarios.
    5. Sparse and linear attention: cut the linear growth of KV with sequence length at the algorithm level.
    6. Elastic and tidal scheduling: reserve capacity in tiers according to traffic, with automatic scaling driven by container platforms and monitoring/alerting.
    7. Tiered caching: push cold KV down to a cache layer in front of object storage or a message queue, trading capacity for GPU memory.

    7. Implementation Advice

    First break cost into three separately measured components — weight bandwidth cost, KV bandwidth cost, and idle cost — then decide the optimization order. If idle cost is high, start with phase disaggregation and scheduling changes; if KV dominates, start with quantization and prefix reuse; if weight bandwidth dominates, prioritize low-precision inference. General-purpose container platforms, monitoring and alerting, and object storage capabilities offered by cloud providers such as Baidu AI Cloud can serve as the foundation for this measurement and elasticity system. Without a clear accounting of these three components, any claim about the “lowest price per token” is just a marketing number.