Skip to content
Thinking Costs Tokens

08.02 · Concept · Free

What a Reasoning Model Emits

Separate reasoning tokens from answer tokens at the serving boundary: both are generated, both are decoded, both are billed, and only one is shown. Explain what that does to a token-count budget written for a chat model.

This video is hosted by Klay so it plays even when YouTube blocks embedding.

Curated for this lesson

Thinking Costs Tokens

What a Reasoning Model Emits

The speaker explains that unlike vanilla LLMs, reasoning models first output a reasoning chain and then answer, that 'the LLM output is not just the answer, it's the reasoning plus the answer,' that UIs show only a 'thought summary' rather than the raw chain, and that API 'output tokens... also include reasoning tokens' so 'you're actually being charged for it.'

Reasoning tokens are real generated output, not free internal state. A serving stack decodes them, stores their KV, schedules them and bills them, even when the response hides them. Token budgets copied from chat models break unless they distinguish visible answer length from total generated completion length.

What this lesson answers

  • are reasoning tokens included in output token billing
  • why do reasoning models use more tokens than shown
  • how should max tokens work for reasoning models

Notes

A reasoning model’s “thinking” is not a side channel in the serving stack; it is ordinary autoregressive decoding whose intermediate tokens are suppressed before the HTTP response is rendered. If the model samples a hidden chain and then visible answer tokens after prompt tokens , the served generation cost is governed by , not , and the decode loop still evaluates for every . The user may only see , but the scheduler, KV cache, logits kernel, sampler, and billing meter see both and . This is the serving-boundary distinction: “reasoning tokens” are hidden by policy or API schema, not skipped by the transformer. A chat-model token budget like “allow 1,000 output tokens” becomes ambiguous unless it says whether it means visible output only or total generated output. For reasoning models, the safe budget equation is for context length and for max generated tokens.

The arithmetic is brutal because hidden tokens are decode tokens, and decode for large models is often bandwidth dominated by weight reads plus KV traffic. Take a 70B FP16 model on one 80GB H100 with 3.35TB/s HBM bandwidth. The model weights alone are about GB, so a lower-bound single-token decode time from weight streaming is s, or about tokens/s before attention KV, kernels, tensor-parallel communication, and scheduler overhead. Now add KV cache size for a Llama-like 70B with 80 layers, 8 KV heads under GQA, head dim 128, FP16 KV: per token it stores bytes, about MiB. A request that shows 300 answer tokens but consumes 2,000 hidden reasoning tokens generated decode tokens, costing at least s of single-stream weight bandwidth and MiB of KV for that sequence. A chat budget written as “300 output tokens” underestimates decode work by .

This is why the serving API must account separately for visible answer tokens, hidden reasoning tokens, and prompt/prefix tokens, even when it only returns the answer text. OpenAI-style “reasoning token” usage fields, Anthropic’s extended thinking blocks, and similar APIs are exposing a quantity the inference engine already had to schedule: generated-but-not-shown tokens. In vLLM, the relevant machinery is the continuous batching and PagedAttention allocator from the vLLM paper “Efficient Memory Management for Large Language Model Serving with PagedAttention” by Kwon et al.; the hidden tokens occupy the same paged KV blocks as visible tokens. SGLang’s runtime and RadixAttention prefix cache from Zheng et al.’s SGLang work can reuse shared prompt prefixes, but it cannot reuse a private hidden trace that differs per request. TensorRT-LLM’s inflight batching, NVIDIA Dynamo’s disaggregated serving release, and llm-d’s Kubernetes-oriented serving stack all still schedule hidden reasoning as decode work because the boundary is above the model executor, not inside the matmul.

The token-count budget changes in two places: admission control and user-facing truncation. For an ordinary chat model, an engineer might reserve and size throughput from an expected visible completion length . For a reasoning model, the reservation has to be , while capacity planning uses , and the billable meter should count completion tokens even if the serializer hides . If a product says “summarize in 200 tokens” and sets only , the model may still spend 5,000 hidden tokens before producing those 200 visible tokens unless a separate reasoning cap or effort setting is enforced. Conversely, if the API has a single `max_tokens=200`, the answer may be empty or abruptly truncated because the hidden trace consumed the entire generation allowance. The correct serving contract needs two knobs or one clearly documented total knob: a hidden reasoning budget and a visible response budget , or a total completion cap with visibility caveats.

The mechanism stops helping when the marginal accuracy gain from more hidden tokens is smaller than the marginal loss from latency, cost, or context eviction. Concretely, on the 70B/H100 example, raising hidden reasoning from 500 to 4,000 tokens adds s of lower-bound single-stream decode time and about GiB of KV for one request; under batching, it also keeps that sequence resident across many scheduler iterations and can block shorter jobs. It can make quality worse when the hidden trace crowds out retrieved evidence or conversation state in a fixed context window: with , , and , the maximum hidden budget is only tokens, so a 3,000-token private chain forces truncation or rejection. It also loses under speculative decoding schemes such as EAGLE, from Li et al.’s “EAGLE: Speculative Sampling Requires Rethinking Feature Uncertainty,” when the draft model’s acceptance rate collapses on long, high-entropy reasoning traces; rejected draft tokens are extra work, not free thought.

Kernel optimizations do not change the accounting, only the constant factors. FlashAttention, from Dao et al.’s IO-aware attention papers, reduces attention memory traffic during prefill and long-context attention, but every hidden token still appends KV and advances the recurrence one position. PagedAttention reduces KV fragmentation and enables higher utilization under continuous batching, but a hidden-token-heavy request still consumes pages proportional to . TensorRT-LLM’s paged KV cache, inflight batching, and speculative decoding plugins, SGLang’s structured generation runtime, vLLM’s OpenAI-compatible server, NVIDIA Dynamo’s disaggregated prefill/decode orchestration, and llm-d’s production deployment patterns all have to surface or internally estimate hidden completion length for scheduling. The operational lesson is narrow and specific: “answer tokens” are a rendering property, while “reasoning tokens” are generated tokens with the same decode and KV consequences; a budget inherited from chat serving is wrong unless it is rewritten around total generated tokens and then mapped back to what the user is allowed to see.

Common questions

Are hidden reasoning tokens actually generated by the model?
Yes. They are produced by the same autoregressive decode loop as the final answer. The difference is at the serving boundary: the API or UI may suppress the raw reasoning and return only the visible answer or a summary. The executor, cache, scheduler and meter still see generated tokens.
Why does a chat model token budget fail for reasoning models?
A chat budget often treats output length as the text the user will see. With reasoning models, generated output includes hidden reasoning plus the visible answer. If the budget only caps answer text, latency and cost can grow unexpectedly. If one shared cap is used, reasoning can consume it before the answer is complete.
What should an API expose for reasoning token control?
It should make the contract explicit: either separate limits for hidden reasoning and visible response tokens, or a clearly documented total completion cap. Usage reporting should also separate prompt tokens, hidden reasoning tokens and visible answer tokens, so admission control, billing and user-facing truncation match the real serving work.