Why Output Tokens Cost More: Decoding Economics and Pricing Logic
Output tokens are typically priced higher than input tokens because decoding is sequential, memory-bandwidth intensive, and increasingly expensive as the KV cache grows. This article explains the cost differences between prefill and decode, why output costs can scale beyond simple linear growth, how caching affects pricing, and which engineering strategies can reduce token expenses.
Why Output Tokens Cost More: Decoding Economics and Pricing Logic
In large language model inference services, input and output tokens are often priced differently. Output tokens are typically more expensive, commonly costing three to five times as much as input tokens, although the exact ratio varies by model architecture and pricing strategy.
This difference is not simply a commercial markup. It reflects the different computational characteristics of the two inference stages, memory-bandwidth constraints, KV-cache growth, hardware utilization, and capacity-planning requirements. Understanding these factors helps developers make better decisions about application design, context management, cache reuse, and cost forecasting.
1. Inference Has Two Stages: Prefill and Decode
Autoregressive LLM inference is generally divided into two stages.
The first stage is prefill. The system processes the entire user-provided context, computes representations across the model layers in parallel, and generates the KV cache required for subsequent decoding. This stage is dominated by large matrix-matrix operations. Its high degree of parallelism allows GPUs to keep their compute units relatively well utilized.
The second stage is decode. The model generates one token at a time, appends it to the end of the sequence, and then runs another forward pass. The computation is closer to matrix-vector multiplication: each step involves less arithmetic, but every step still needs to read the model weights and the continuously growing KV cache.
Because autoregressive generation is sequential, decoding cannot fill the available compute as efficiently as prefill. Its bottlenecks are more likely to be memory bandwidth, cache access, and scheduling latency.
In other words, the same token can be processed in bulk during prefill but must be generated one by one during decoding. This is the first technical reason input and output tokens have different costs.
2. The Cost of Each Token Is Not Constant
Assume the model context length is N, the system has generated the t-th output token, α represents the marginal cost of attention, and C represents the fixed cost of traversing the model weights once. The approximate cost of generating token t can be expressed as:
Cost per token(t) ≈ C + α(N + t)
Here, C represents the recurring cost of reading or traversing the model weights. The term α(N + t) represents the marginal attention cost as the context grows. N is the input-context length, and t is the number of output tokens generated so far.
If the output length is M, the total cost can be approximated as:
Total cost ≈ Σ_{t=0}^{M-1} [C + α(N+t)]= C·M + α·N·M + α·M(M-1)/2
This expression includes terms that grow linearly with M as well as a term that grows with M². The quadratic term explains why each additional output token can make subsequent tokens slightly more expensive: every newly generated token adds another position to the KV cache, increasing the attention cost of later decoding steps. Accumulated over the entire output, this produces quadratic growth.
This does not mean that costs will explode in every practical scenario. Model architecture, attention mechanisms, batching strategies, and KV-cache management all affect the coefficient of the quadratic term. However, the general trend remains: as the output becomes longer, the marginal cost of decoding each token tends to increase. Pricing must account for this physical cost.
3. Why KV-Cache Growth Is a Core Bottleneck
During decoding, every newly generated token requires attention over the historical keys and values stored in the KV cache. The cache grows approximately linearly with sequence length, and every decoding step must read from it.
This creates a fundamental tension:
- The arithmetic workload of a single step may appear relatively small, with limited matrix-vector computation.
- Attention still requires reading an increasingly large KV cache from GPU memory.
- Memory bandwidth becomes a limiting factor, leaving compute units waiting for data.
The cost structure of the decoding loop can be illustrated with simplified pseudocode:
# Simplified example: token-by-token decodingkv_cache = prefill(input_tokens) # Prefill: parallel computation that creates the KV cachefor t in range(max_output_tokens):# Read the model weights and the current KV cache at each steplogits = decode_step(last_token, kv_cache)next_token = sample(logits)kv_cache.append(compute_kv(next_token)) # The KV cache continues to growlast_token = next_token
The kv_cache.append(...) operation is not free. It means that later steps must access a larger cache. As the output grows, cache-read pressure increases and effective throughput per step can decline.
Continuous batching can improve concurrency and hardware utilization, but the KV cache consumes GPU memory and limits the number of sequences that can run simultaneously. Once memory capacity and bandwidth become constraints, the marginal cost still rises.
4. Hardware Utilization: Decoding Is More Bandwidth-Intensive
During prefill, the system can process an entire input sequence in parallel. Matrix-matrix operations expose substantial parallelism, making it easier to achieve high compute utilization.
Decoding is constrained by autoregressive dependencies. Each step produces only one token, so there is less parallelism within an individual sequence. More time is spent reading model weights, accessing the KV cache, and handling scheduling overhead.
Put differently, prefill is generally more compute-intensive, while decoding is more memory-bandwidth-intensive. For the same amount of GPU time, decoding often produces fewer effective tokens than prefill. When costs are converted into GPU time per generated token, decoding can be several times more expensive than prefill.
This is a major physical reason output tokens are priced higher than input tokens.
Output generation is also more sensitive to latency. Users expect tokens to be streamed progressively, so providers must reserve capacity, control queueing, and maintain both time-to-first-token and inter-token latency. This latency-sensitive workload cannot always rely on large offline batches to spread costs, which further increases the cost of serving output tokens.
5. From Physical Cost to Pricing Ratios: Why Three to Five Times Is Common
The common three-to-five-times difference between input and output pricing can be understood as the combined effect of several factors:
- Different computation patterns: Prefill has high parallelism, while decoding is highly sequential. The GPU time required per token is therefore different.
- KV-cache growth: As the output gets longer, the marginal cost of later tokens increases. Pricing must cover the risk of long generations.
- Memory-bandwidth bottlenecks: Decoding is constrained by memory access, so hardware utilization is often lower than during prefill.
- Capacity and SLA requirements: Output services must provide predictable latency and stability, requiring additional reserved capacity.
- Different batching opportunities: Inputs are easier to process in batches, while outputs are generated token by token, leaving less room for amortization.
- Business and architectural differences: Model architecture, cache optimizations, and pricing strategy can all change the final ratio.
The three-to-five-times range is therefore not an arbitrary number. It is an approximate reflection of the higher physical and service-assurance costs associated with decoding.
A lower ratio may indicate that an architecture handles decoding bottlenecks particularly well or that the pricing model places more of the cost on the input side. A higher ratio may reflect longer outputs, stricter latency guarantees, or greater capacity reserves.
6. Cache-Hit Pricing: Separating Compute Cost from Storage Cost
The number of input tokens can be identical for a cache hit and a cache miss, while their costs may differ by orders of magnitude.
With a cache miss, the system must run prefill again over the entire input context and generate the corresponding KV cache. With a cache hit, the previously computed KV cache can be reused from memory or storage, avoiding the repeated prefill computation.
This illustrates an important principle: the computational cost of input tokens can be separated from their storage and retrieval cost.
Cache-hit pricing effectively rewards reusability. When the same prefix, system prompt, or document context is used repeatedly, the provider does not need to spend the same compute resources on prefill each time and can offer a substantially lower unit price.
For developers, designing stable prompt prefixes, keeping reusable content consistent, and avoiding unnecessary context changes can reduce costs more effectively than simply removing a few tokens.
7. Engineering and Cost-Management Implications
Once the reasons behind higher output-token costs are clear, several optimization strategies become available:
- Control output length: Use clear output constraints, structured responses, and explicit stopping conditions to reduce unnecessary generation while preserving task quality.
- Reuse stable prefixes: Place system prompts, fixed knowledge, and tool instructions in stable prefixes to improve cache-hit rates.
- Manage context growth: Summarize, trim, or retrieve parts of long conversations instead of allowing the KV cache to grow indefinitely.
- Use continuous batching and paged KV-cache management: Improve decoding concurrency and reduce GPU-memory fragmentation.
- Consider KV-cache quantization and shared prefixes: When the accuracy trade-off is acceptable, reduce cache usage and memory-bandwidth pressure.
- Separate interactive and offline workloads: Interactive applications should prioritize latency, while offline batch jobs can use batching to spread costs.
- Choose models and output strategies based on business value: Short-output, high-concurrency workloads should pay close attention to decoding efficiency, while long-form generation requires budgeting for the quadratic cost component.
Conclusion
Output tokens cost more not because an output character is inherently more valuable, but because decoding combines sequential computation, KV-cache growth, and GPU memory-bandwidth bottlenecks. The cost of each generated token tends to rise as the output grows, and these marginal increases accumulate into a quadratic component. Lower hardware utilization during decoding further increases GPU time per token.
The pricing gap between cache hits and cache misses also shows that reusable prefill computation can be saved substantially. For developers, long-term cost control requires treating output length, cache reuse, context management, and batching strategy as core parts of application design.
