Token budget thinking
All articles

Token budget thinking: how to reason about generation cost when token count is the variable

Your inference bill is a function of tokens generated per request, requests per second, and the per-token cost of your model. Most teams optimize the wrong variable. They spend engineering time on prompt compression and input token reduction while output tokens, which in most generation workloads are the dominant cost driver, receive less attention. This post is a direct treatment of why output token count matters more than it typically gets credit for, and how to reason about it as a first-class variable.

The three-variable cost model

Total inference cost at a given traffic level decomposes into three terms: output tokens per request, request rate, and per-token cost. The product of these three terms gives you your total generation cost. If you want to reduce your bill, you need to move at least one of these terms. Request rate is typically determined by product success and is not a sensible variable to optimize downward. Per-token cost is determined by your model size and serving infrastructure, and reducing it involves tradeoffs in output quality or serving setup.

Output tokens per request is the variable most directly in your control at the product design level. Every decision about what your model should generate, how much context to include, how complete to make responses, is a decision about output token volume. A response that is twice as long costs roughly twice as much to generate and takes roughly twice as long in an autoregressive serving setup. That relationship is direct and linear.

Teams often treat output token count as an outcome of prompt design rather than as a budget variable to optimize. The distinction matters. Treating it as an outcome means you accept whatever length the model produces. Treating it as a budget variable means you establish a target range and design prompts, model behavior through instruction tuning if available, and post-processing to operate within that range.

Input vs output: where cost actually lives

The billing structure of most hosted model APIs distinguishes between input tokens and output tokens, with output tokens typically costing more per unit. This is because output tokens cost more to generate: each output token requires a decoding step, while input tokens are processed in a single prefill pass that is substantially cheaper per token than the decode phase.

In practice, this means that a workload with a long prompt and a short completion is substantially cheaper than a workload with a short prompt and a long completion, even if the total token count is similar. The asymmetry is architectural. Prefill is compute-bound and highly parallelizable. Decode is memory-bandwidth bound and sequential. You pay a different price per token depending on which phase produced it.

The operational implication: when evaluating cost optimization options, look at your output token distribution first. A prompt-compression effort that reduces input tokens by a significant fraction may save less than a response-length calibration effort that reduces output tokens by a much smaller fraction, if output tokens are the dominant cost term. Measure both, compare the cost impact, and prioritize accordingly.

Length distribution matters more than average length

Averages can mislead when you are trying to control costs. A workload with an average output length of 200 tokens could be a tightly clustered distribution centered near 200, or a bimodal distribution with many very short completions and a long tail of much longer ones. The cost implications are different. A long tail of very long completions can dominate total cost even if they represent a small fraction of requests.

For most generation workloads, the output length distribution has some tail. Responses to complex requests, code generation tasks for large functions, and document-length outputs all contribute to the tail. The tail is worth characterizing explicitly during benchmarking. Specifically, your p95 and p99 output lengths tell you what the expensive requests look like and how much they are contributing to total cost.

If your p99 output length is much larger than your p50, you have a tail-heavy distribution. The cost and latency properties of the tail requests will dominate your worst-case performance metrics and will have outsized influence on your infrastructure dimensioning decisions. Addressing the tail separately from the bulk of your traffic, whether through output length caps for certain request types or through routing long requests to cheaper serving options, is often more impactful than trying to reduce average length.

Setting length budgets without degrading quality

The concern teams raise most often when discussing output length constraints is that trimming responses reduces quality. That concern is legitimate in some cases and a rationalization in others. It depends entirely on whether the additional length in current responses is load-bearing for the task.

For many generative tasks, the relationship between response length and response quality is not monotone. Responses can be too short to be useful, but they can also be longer than necessary without adding information the user needs. Padding, reiteration, and verbose hedging all add tokens without adding value. The question is not whether shorter is always better, but whether the current response length has been deliberately calibrated or simply accepted as the default output of whatever prompt you are running.

A straightforward diagnostic: take a sample of your production responses and have the relevant people assess them for quality. Then take a sample of the same responses truncated at 80 percent of their original length and assess again. If quality degrades substantially, your responses are length-efficient and trimming is not the right lever. If quality is roughly similar, you have room to tighten your length budget. This is empirical work, not theoretical, and it is worth doing before assuming that length and quality are tightly coupled.

How the generation mechanism changes the cost calculation

One important dimension of token budget thinking is that different generation mechanisms have different relationships between output length and generation cost. Autoregressive generation has a strictly linear relationship: N output tokens require N decoding steps. The cost per request scales directly with output length, with no diminishing returns.

Diffusion-style parallel decoding breaks this linearity. When the refinement schedule K is smaller than the output length N, the cost per request does not scale proportionally with N in the same way. The forward pass count is K, not N. Each pass is more expensive per pass because it touches all N positions, but the total pass count is bounded by K rather than growing with N. The cost curve as a function of output length is different: it grows more slowly past the K-N crossover point.

This has direct implications for token budget thinking. If you are using an autoregressive serving system, the case for tightening output length budgets is strong: every token you save is a decoding step you eliminate. If you are using a parallel refinement system where K does not scale with N, the marginal cost of additional output tokens beyond the crossover is lower. The tradeoff between length and cost is a function of your serving architecture, not just your prompt design.

Practical instrumentation

None of this analysis is useful without measurements. The things worth instrumenting directly are: output token count per request as a distribution (p50, p95, p99, max), request rate over time, and total inference cost broken out by input and output token contribution. These three data streams, logged continuously, give you the information you need to make token budget decisions with actual numbers rather than intuitions.

Teams who do not instrument output token distributions often discover their cost structure only when bills arrive. At that point, making sense of what happened requires reconstructing the token count data from logs, which is slower and more error-prone than having the data available in real time. Instrumenting token counts at the application layer rather than relying on inference API billing data alone is worth the small setup cost: you get the data faster, you can associate token counts with specific request types or users, and you can set alerts before costs become problems.

We spend time thinking about this at Inception not just as a business model question but as a product design question. The teams we work with are building products where output length is a first-class variable in their product quality and economics. Understanding how the generation mechanism affects the output-length cost curve is a prerequisite for making good architecture decisions. The shift from a linear cost-per-token model to a schedule-bounded model changes which optimizations are worth pursuing. Getting that right is one of the things we think about most carefully when teams are evaluating whether parallel diffusion decoding addresses their actual constraint.