Skip to content

The Reasoning Core

Reasoning and test-time compute

CoT, reasoning models, thinking budgets

Some problems cannot be solved in a single shot - the model has to think first. This lesson shows you the mechanism behind reasoning models, why spending more tokens at inference buys accuracy on hard tasks, and when that trade is worth it for the agents you build.

Why one token at a time is a bottleneck

From the last lesson: an LLM is a next-token predictor. It commits to one token at a time, and the compute it spends per token is roughly fixed - about twice the model's parameter count in FLOPs for each token generated.[1] That has a sharp consequence.

The core idea in one line

A model cannot think harder on a single token - it can only think longer by emitting more tokens. So more tokens = more serial computation. Every technique in this lesson is a way to buy the model more thinking steps before it has to answer.

There is no hidden plan the model executes silently. Anything that looks like deliberation has to be written down as tokens in the context - a scratchpad the model reads back to itself. The scratchpad is the computation.

Chain of thought: thinking out loud

The seed of everything here is (CoT) prompting. Wei et al. (2022) showed that simply asking a model to produce intermediate reasoning steps - or just appending "Let's think step by step" - sharply improves arithmetic, commonsense, and symbolic reasoning. Two details matter: it worked on an off-the-shelf model with no fine-tuning, and the benefit emerges only at scale (roughly 100B-parameter models; smaller ones barely budge).[2]

The classic worked example is "How many r's in strawberry?". The model sees tokens like ["str","aw","berry"], not letters, so it guesses. A model that first spells the word out token-by-token in its scratchpad turns a character task into a sequence it can actually process - and gets it right. That is the whole value of thinking tokens in miniature.

Tap a node to see what it does.

Chain of thought spreads the work across intermediate tokens the answer can attend to.

Reasoning models: the 2024 to 2026 shift

Chain of thought put the burden on you to prompt for steps. The leap of 2024 to 2026 was to train the model to generate a long internal chain of thought automatically, then let it spend a variable - often large - number of tokens deliberating before it answers. These are . The current families are OpenAI o1 and o3, Claude extended and adaptive thinking, DeepSeek-R1, and Gemini thinking.

OpenAI's o1 is trained with large-scale reinforcement learning to produce a productive private chain of thought - breaking problems into steps, catching its own mistakes, and trying alternative strategies. The raw reasoning is hidden: you see the final answer plus a count of "reasoning tokens," not their contents.[3] Anthropic instead makes thinking visible (as summarized thinking blocks), trading a little competitive secrecy for transparency and debuggability.[5]

Tap a node to see what it does.

Inside the thinking tokens (you may never see this): a reasoning model decomposes, attempts, self-checks, backtracks, then converges. You pay for every one of these tokens, even when the API only returns a summary.

DeepSeek-R1 proved the punchline openly: reasoning can emerge from pure RL with no supervised reasoning traces. The reward was just rule-based - is the final answer verifiably correct, and did it wrap its reasoning in <think>...</think>? Self-reflection, verification, and spontaneous "aha moments" appeared on their own, and AIME accuracy climbed from 15.6% to 71.0% as the model taught itself to think longer.[4]

An aha moment, learned on its own

"Wait, wait. Wait. That's an aha moment I can flag here. Let's reevaluate this step-by-step..." - an intermediate DeepSeek-R1-Zero checkpoint, backtracking without ever being taught to.[4]

Where the thinking comes from

Reasoning behaviour is trained in, largely with reinforcement learning - the same machinery that turns a base model into an agent that plans and self-corrects. We open that black box in the lesson on training agents and agentic RL.
FamilyReasoning visibilityHeadline result
OpenAI o1 / o3Hidden (token count + summary)o1 AIME 74.3% pass@1[3]; o3 ARC-AGI 87.5%[6]
Claude extended / adaptiveVisible, summarized; billed in fullDeveloper sets a budget, or the model self-allocates effort[7]
DeepSeek-R1 (open weights)Full <think> trace exposedAIME 79.8%, MATH-500 97.3%; pure-RL recipe published[4]
Gemini thinkingThinking mode variantsTest-time thinking shipped as a mainstream feature
Four reasoning families and how much of the reasoning they let you see.

Test-time compute: a new scaling axis

The headline empirical result from o1 is the reason this matters: accuracy improves smoothly (roughly log-linear) with both train-time RL compute and test-time thinking compute.[3] For decades the only way to make a model smarter was to make it bigger and pre-train it longer. is a genuinely new lever: you can buy accuracy at inference by letting the model think longer, without retraining anything.

The curve rises, but with plainly diminishing returns. o3 on ARC-AGI goes from 75.7% to 87.5% by spending about 170 times more per task - real gains, at real cost.[6] There are two knobs for spending that compute.[1]

Sequential scaling

Make the single chain of thought longer: more deliberation, self-correction, and backtracking within one answer.[1]

Parallel scaling

Sample many independent solutions and pick the best via majority vote (self-consistency), best-of-N, or a verifier. o3's headline ARC-AGI run used 1,024 samples per task.[6]

o3 crossed a threshold, but it is not AGI

o3 scored 87.5% on ARC-AGI (vs about 5% for GPT-4o), yet its own benchmark author stresses this is not AGI: it still fails some very easy tasks, and the top score cost roughly $4,560 per task.[6] Test-time compute buys accuracy; it does not buy general intelligence.

Thinking budgets: the engineer's dial

Because thinking costs tokens, most reasoning APIs let you cap it. With Claude's extended thinking you set a (which must be less than max_tokens). The model emits thinking blocks before the final text, and - this is the gotcha - you are billed for every thinking token it generates, even though the API may return only a shorter summary of them.[7]

# Standard model: answer appears immediately, low latency
resp = model.generate(prompt, temperature=0.7, top_p=0.9)

# Reasoning model: private thinking first, then the answer
resp = client.messages.create(
    model="claude-...",
    max_tokens=16000,
    thinking={"type": "enabled", "budget_tokens": 10000},  # < max_tokens
    messages=[{"role": "user", "content": "Prove ..."}],
)
# resp.content = [ {type:"thinking", ...}, {type:"text", ...} ]
# Billed for ALL thinking tokens, even if 'thinking' is only summarized.
A standard call versus a reasoning call with an explicit thinking budget

Match the budget to difficulty: small budgets for easy questions, large for genuinely hard ones. The budget is a cap, not a target - Claude often will not use the whole thing (especially above about 32k tokens), and newer models expose an adaptive effort control that lets the model decide how much to think for you.[7] For agents that call tools, interleaved thinking lets the model reason between tool calls and over their results - keep its thinking blocks in the loop so the reasoning stays continuous.

  1. Set a floor by task. Give hard, multi-step requests a generous budget and easy ones little or none. Route by request type rather than using one setting for all.
  2. Watch the curve. Measure accuracy as you raise the budget on your own evals. Stop near where the gains flatten instead of maxing it out by default.
  3. Cap for safety. A hard ceiling stops a pathological input from spending an unbounded pile of tokens on a single question.

When reasoning helps, and when it hurts

Reasoning models are not a free upgrade. More thinking means more latency (seconds to minutes), more cost, and a new failure mode: overthinking trivial questions or underthinking hard ones. Choosing the right tool per task is the actual engineering skill here.

Reach for reasoning

Hard, multi-step problems; competition math and proofs; algorithmic or debugging coding; planning and decomposition; anything with a verifiable answer.

Use a fast model

Latency-sensitive interactions; high-volume, cheap requests; simple lookups or formatting; extraction and classification; work better handed to tools.

Prompt reasoning models the opposite way

Standard models get better when you add few-shot examples and "think step by step." Reasoning models already do CoT internally, so stacking manual chains of thought can hurt. As Simon Willison put it for o1: give it the most relevant context, not the most context - which inverts the usual "stuff everything in" RAG instinct.[8] More on this in the next lesson on prompting for agents.

Two traps that catch engineers

Self-correction without a verifier can backfire. Ask a model to "revise" with no external check (unit tests, ground truth, a checker) and it may talk itself out of a correct answer - we return to this in the reflection and self-correction lesson. The visible chain of thought is not a trustworthy audit log. A model's stated reasoning does not always reflect the true cause of its answer; it can rationalize after the fact.[1] Treat thinking traces as a helpful signal, not proof.

And the limits are genuinely contested. Apple's "Illusion of Thinking" (June 2025) reported that reasoning models hit a complexity threshold beyond which accuracy collapses and the models paradoxically think less.[9] A rebuttal showed much of that "collapse" was an experimental artifact - puzzles that exceeded output-token limits or were mathematically unsolvable.[10] The honest takeaway: real limits exist, and benchmark design is treacherous. Hold both.

What this means for agents

An agent runs the model in a loop, so every reasoning choice multiplies. A reasoning model deciding which tool to call next is often worth it, because a bad tool choice wastes a whole loop iteration and its observed result. But turning maximum thinking on for every step of a long trajectory is how cost and latency quietly explode. The lever you actually pull in production is per-step: cheap fast passes for routine steps, and a deep reasoning pass reserved for the genuinely hard decisions.

Match each term to what it actually controls.

drop here

emitting intermediate steps before the answer

drop here

trained to reason internally without being asked

drop here

a cap on reasoning tokens before answering

drop here

accuracy bought at inference, not training

Check yourself

Why does letting a reasoning model emit more thinking tokens raise its accuracy on hard problems?

You give a reasoning model a 10k-token thinking budget on an easy question. What happens to those tokens and your bill?

Is the budget a target or a ceiling? Try to state it, then check.

Lock it in

  • Compute per token is fixed, so a model thinks longer, not harder: more tokens = more serial computation.
  • Reasoning models (o1/o3, Claude, DeepSeek-R1, Gemini) are trained, mostly via RL, to emit a long internal chain of thought before answering.
  • Test-time compute is a new scaling axis: accuracy rises roughly log-linearly with thinking tokens and with parallel samples, at diminishing returns.
  • Set a thinking budget that matches difficulty; you pay for thinking tokens even when they are hidden or summarized.
  • Use reasoning for hard, verifiable, multi-step work; use a fast model for simple, latency- or cost-sensitive tasks.

Primary source

Lilian Weng, "Why We Think"

The definitive survey of test-time compute: sequential vs parallel scaling, the latent-variable view, reward hacking, and faithfulness, all in one place.

Sources

  1. 1.Lilian Weng, "Why We Think" (2025)
  2. 2.Wei et al., Chain-of-Thought Prompting Elicits Reasoning in LLMs (2022)
  3. 3.OpenAI, Learning to Reason with LLMs
  4. 4.DeepSeek-AI, DeepSeek-R1: Incentivizing Reasoning via RL (2025)
  5. 5.Anthropic, Visible Extended Thinking
  6. 6.ARC Prize, OpenAI o3 Breakthrough on ARC-AGI
  7. 7.Anthropic, Extended Thinking documentation
  8. 8.Simon Willison, Notes on OpenAI o1
  9. 9.Apple, The Illusion of Thinking (2025)
  10. 10.Opus et al., The Illusion of the Illusion of Thinking (2025)