Reasoning models & test-time compute

In one sentence

LLMs trained with RL to think at length before answering. You buy accuracy on hard problems by spending more thinking tokens, billed as output and paid for in seconds of latency.

Analogy: A chess player in blitz vs. with ten minutes per move: same brain, better moves when it can calculate, but the clock runs on every move, even the obvious ones.

Training teaches the model to think; at inference you choose how much thinking to buy per call.

How it works

  • RL on checkable tasks rewards only the final answer, yet the model learns to plan, backtrack and double-check.
  • Test-time compute becomes a second scaling axis: accuracy rises with thinking tokens, not only model size.
  • Set the thinking budget per call: OpenAI reasoning.effort, Anthropic effort, Gemini thinking_budget.
  • A hard prompt can burn ~5–20k thinking tokens, even hidden ones, and take tens of seconds.
  • Route only hard math, code and planning to them; on extraction or classification they add cost and can overthink.

Check yourself

Answer to mark it learned; your answers aren't scored.

Your planning feature calls a reasoning model with max_output_tokens=2000. On hard prompts, responses come back with status: "incomplete" and an empty answer. Most likely cause and fix?

Go deeper

Full explanation

A reasoning model is an LLM trained to write a long chain of thought before answering, and to use it well. OpenAI's o-series (o1, o3, o4-mini), DeepSeek-R1 and Claude/Gemini "extended thinking" all work this way.

How they're made. Take a strong base model and run reinforcement learning on tasks with checkable answers: math with known results, code with unit tests (RL with verifiable rewards (GRPO)). Only the final answer is rewarded, yet the model learns to plan, backtrack and double-check on its own. DeepSeek-R1-Zero's responses grew steadily longer during training without anyone asking for it.

Test-time compute. This opens a second scaling axis: accuracy rises with the thinking tokens spent per query, not only with model size. You set it per call: OpenAI reasoning.effort (e.g., low/medium/high), Anthropic effort with adaptive thinking (older models: budget_tokens), Gemini thinking_budget or thinking level.

The bill. Thinking tokens are billed as output tokens even when you never see them (OpenAI hides them; Claude 4 returns a summary). A hard prompt can burn ~5–20k of them and take tens of seconds.

They shine on math, code, multi-step planning and dense analysis. On extraction, classification or small talk they mostly add cost and latency, and can overthink their way out of a right answer.

Code Set reasoning effort per task and watch hidden tokens
pythonSet reasoning effort per task and watch hidden tokens
from openai import OpenAI

client = OpenAI()
MODEL = "o4-mini"  # any reasoning model that accepts reasoning effort

# Spend thinking only where it buys accuracy (tune per task with evals)
EFFORT = {"extract": "low", "classify": "low", "code": "medium", "plan": "high"}

def ask(task: str, prompt: str) -> str:
    resp = client.responses.create(
        model=MODEL,
        reasoning={"effort": EFFORT.get(task, "medium")},
        max_output_tokens=25_000,  # this cap includes the hidden reasoning tokens
        input=prompt,
    )
    u = resp.usage
    hidden = u.output_tokens_details.reasoning_tokens
    # Billed as output tokens, but never returned to you
    print(f"{task}: reasoning={hidden} visible={u.output_tokens - hidden}")
    if resp.status == "incomplete":  # ran out of budget mid-thought
        raise RuntimeError("raise max_output_tokens or lower the effort")
    return resp.output_text
Real example

A text-to-SQL assistant gets ~30% of multi-join questions wrong on a fast standard model. A cheap router sends only those (~10% of traffic) to a reasoning model at medium effort: most now pass the eval, but each burns ~4k hidden reasoning tokens and takes ~15 s instead of ~2 s. Simple lookups like "revenue last month" stay on the fast model. Accuracy on the hard tail jumps, while average cost per query rises only modestly because the expensive path is rare.

Trade-offs +3 · −4

+ You gain

  • Large accuracy jumps on math, code, planning and multi-constraint problems, with no fine-tuning.
  • One dial (effort or budget) trades cost and latency for accuracy on each call.
  • Less prompt engineering: no hand-written "think step by step" scaffolding needed.

− You pay

  • Hidden thinking tokens are billed as output, often several times the visible answer.
  • Latency of seconds to minutes; painful in interactive UX unless effort is low.
  • Overthinking: thousands of tokens on trivial questions, sometimes talking itself out of a right answer.
  • Raw reasoning is hidden or summarized, so debugging is harder, and it is not a faithful explanation.

Use it when

Math, code generation and repair, multi-step planning, agent orchestration, analysis with many constraints: where a wrong answer costs more than ~10–30 s and a few cents.

Avoid it when

High-volume extraction, classification, routing, short chat or sub-second paths. Use a fast non-reasoning model, or the lowest effort setting.

Numbers to know 4
  • o1 on AIME 2024: 74% pass@1 vs 12% for GPT-4o; 83% with 64-sample consensus.
  • DeepSeek-R1-Zero, pure RL: AIME 2024 pass@1 from 15.6% to 71.0%; R1 reached 79.8%.
  • Anthropic manual extended thinking: minimum budget_tokens is 1,024 (Claude 4.7+ uses adaptive thinking + effort instead).
  • OpenAI suggests reserving ≥25,000 output tokens for reasoning + answer when you start.
Common pitfalls 4
  • Output cap too low: thinking eats the budget and you get an empty or truncated answer.
  • Adding "think step by step" or long CoT few-shots: redundant, and OpenAI advises against it.
  • Defaulting to high effort everywhere, then discovering the bill. Measure accuracy per effort level.
  • Treating the reasoning summary as a faithful audit trail, or showing raw thoughts to end users.
Interview questions 3

Answer out loud first, then reveal.

When would you choose a reasoning model over a standard one?Show answer

I decide per task with evals, not per product. Reasoning models pay off when the answer needs multi-step search, like math, code changes checked by tests or planning across constraints, and when errors are expensive. For extraction, classification or routing they mostly add latency and hidden output tokens. So I run the same eval set with no reasoning, low and high effort, plot accuracy against cost and p95 latency, and pick the knee. Often the answer is a router: fast model for the easy majority, reasoning for the hard tail.

What does test-time compute scaling mean, and why does it matter for architecture?Show answer

It means you can buy accuracy at inference, not only at training. Two ways: let one model think longer, which is sequential, or sample several answers and pick with voting or a verifier, which is parallel. OpenAI showed o1's AIME accuracy rising smoothly with thinking time, and from 74% to 83% with 64-sample consensus. The architectural consequence is that quality becomes a per-request dial: I can spend heavy compute on the hard 5% of queries instead of paying for a bigger model on 100% of them.

Your reasoning-model bill tripled but accuracy didn't move. What do you check?Show answer

First the usage data: reasoning tokens versus visible output per route. The usual causes are high effort as a default on easy tasks, prompts that invite overthinking, or a cap so low that calls truncate and get retried, so we pay for the thinking twice. Fixes: lower effort or budget per route, send easy traffic to a non-reasoning model, cache the stable prompt prefix. Then I rerun evals to confirm accuracy held before calling it done.