AI Learning Hub
advanced

Reasoning / thinking models

A 2024–2026 inflection point. Models trained with reinforcement learning to think before answering — producing long internal scratchpads — score dramatically higher on math, code, and multi-step problems.

What reasoning models actually do

Reasoning models think out loud (well, in tokens) before answering. Where a standard model fires off the first answer that comes to mind, a reasoning model first generates a long internal scratchpad — sometimes thousands of tokens of "let me try this... no, that's wrong... what if..." — and only then produces its final reply.

The clever part is how they're trained. Standard chain-of-thought prompting is imitation: the model writes reasoning-shaped prose because it's seen lots of it. Reasoning models are trained with reinforcement learning on tasks where you can verify the answer — math problems with known solutions, code that either passes tests or doesn't. The model is rewarded for thinking that actually leads to right answers, regardless of how the thinking looks. Different mechanism, same visible behaviour, much stronger results on hard problems.

That's the whole concept. Below: the major reasoning models, when to use them (and when not to), and code for accessing them.

When you'd reach for it

Reasoning models earn their cost on hard, verifiable problems:

  • Competition math, physics, hard scientific calculations.
  • Algorithm puzzles, complex code generation, debugging gnarly logic.
  • Multi-step planning under constraints — scheduling, optimisation, structured decisions.
  • Code review at high quality — catching subtle bugs, security issues.
  • Anything where you'd ask a senior engineer to "stop and think."

You wouldn't reach for a reasoning model on summarising email, casual chat, simple extraction, or anything streaming-UX-sensitive. The 5–50× token cost and the long pause before the visible answer are real downsides.

How they actually work

Three things make reasoning models different from regular chat models:

1. They're trained on reasoning traces, not just final answers

Standard LLMs are trained to predict text — including text that looks like reasoning, but they never had to actually be correct. Reasoning models are trained with RL on tasks where correctness is verifiable (math problems with known answers, code with passing tests, logic puzzles). The model is rewarded for finding the right answer through its own chain-of-thought, even via a long, winding path. Wrong reasoning → no reward, regardless of how nice the prose was.

2. They generate hidden scratchpads

When you ask a reasoning model a hard question, it produces a long thinking phase before its visible answer. Sometimes thousands of tokens of internal monologue, retries, contradictions, self-correction. Then a final, polished answer.

You can usually choose whether to see the thinking or just the answer. You always pay for the thinking tokens, though.

3. They scale "thinking" with problem difficulty

A trivial question gets a short answer. A hard question gets a long internal monologue. The model learned, during training, that hard problems benefit from more thinking, and budgets accordingly. Some products expose a slider: "low / medium / high reasoning effort."

Where it bites in real life

When they shine

Problems with a verifiable answer where standard models fail: competition-grade maths and physics, algorithm puzzles, multi-step planning under constraints, hard logic, code-review-style critique. For everyday writing, summarising, casual chat, even most coding — a regular model is faster, cheaper, and good enough.

CoT prompting vs. reasoning models

Plain "think step by step" (covered in Prompt engineering) is imitation — the model generates reasoning-shaped text because that's what it was trained on. No guarantee the reasoning helps. Reasoning models are trained end-to-end with RL on whether the reasoning led to a correct answer; the chain-of-thought stops being cosmetic and actually moves the answer toward correct. Different mechanism, similar visible output, much stronger results on hard problems.

Where products expose a thinking budget (low/medium/high), remember: you pay for those tokens even when they're hidden. A hard math problem at "high effort" can cost dollars per answer at frontier prices.

Under the hood (optional)

Using Claude with extended thinking via the API: enable thinking, set a budget, then iterate over response blocks separating thinking (the scratchpad) from text (the final answer). Skip if you don't code.

Show example code (Python, ~15 lines)click to expand
response = client.messages.create(
    model="claude-opus-4-7",
    max_tokens=8192,
    thinking={"type": "enabled", "budget_tokens": 4096},
    messages=[{"role": "user",
               "content": "Prove that there are infinitely many primes p such that p+2 is also prime, or explain why the question is open."}],
)
 
# Inspect the thinking trace and final answer separately
for block in response.content:
    if block.type == "thinking":
        print(f"[thinking]\n{block.thinking}\n")
    elif block.type == "text":
        print(f"[answer]\n{block.text}\n")

Try it yourself (~5 minutes)

  1. In Claude.ai: enable extended thinking in settings (where available). Ask: "Solve: a knight starts at corner a1 of a chessboard. Can it visit every square exactly once and return to a1? Prove your answer."
  2. In ChatGPT (with an o-series model selected): same prompt.
  3. In any standard model (e.g., regular Sonnet without thinking): same prompt.

Notice: timing differences (reasoning models pause, then dump). Quality differences on the correctness of the proof. Cost differences (visible in API; in chat products you don't see them, but they're real).

Check your understanding

  1. 1. What's the key training difference between a reasoning model and a standard chat model?
  2. 2. When is a reasoning model NOT the right choice?
  3. 3. Why does a reasoning model produce a long pause before its visible answer?

Found this useful? Share it with someone learning AI.

Further reading

Related lessons in this track