Lesson 4 of 11 · Inside an LLM
Reasoning Models
What reasoning models are, how reinforcement learning teaches them to think step by step, why extra compute at answer time helps, and when to use one.
- 6 min read
- Intermediate
- Reviewed
- What makes a reasoning model different from a standard chat model
- How reasoning models are trained
- Why spending more computation at answer time can improve results
- The costs and when a reasoning model is worth it
Thinking before answering
A standard chat model starts writing its answer immediately. A reasoning model first produces a long stretch of thinking: working through the problem, trying approaches, checking intermediate results and backtracking from mistakes. Only then does it write the answer.
OpenAI's o1 (September 2024) brought the idea into the mainstream, and DeepSeek's R1 (January 2025) showed it with openly released weights. Today most major model families offer reasoning or "extended thinking" modes, often with a setting for how much effort to spend.
How they are trained
The key ingredient is reinforcement learning on problems with checkable answers.
- Give the model a problem whose answer can be verified automatically: a maths question with a known answer, or a coding task with tests.
- Let it think and answer, many times, in different ways.
- Reward the attempts that reach a correct, verified answer.
- Train the model to make the reasoning that led to rewards more likely.
Over many rounds, the model discovers useful habits on its own: breaking problems down, checking work, noticing contradictions and trying another approach. Nobody writes these habits as rules; they emerge because they lead to correct answers.
More thinking, better answers
Reasoning models showed that you can improve answers by spending more computation at answer time (called test-time or inference-time compute), not only during training.
A simple way to see why extra computation at answer time helps: let a model attempt a problem several times and take the majority answer. If each attempt is right 60% of the time, independently:
from math import comb
p = 0.6 # chance that one attempt at a hard problem reaches the right answer
def majority_right(n, p):
# Probability that more than half of n independent attempts are right
total = 0
for k in range(n // 2 + 1, n + 1):
total += comb(n, k) * p**k * (1 - p)**(n - k)
return total
for n in [1, 3, 5, 11, 21, 51]:
print(f"{n:2} attempts, majority vote: right {majority_right(n, p):.1%} of the time")More attempts, more compute, more accuracy. Reasoning models do something smarter than voting, exploring and checking within one long chain of thought, but the principle is the same: thinking longer can buy accuracy.
The trade-offs
| Standard model | Reasoning model | |
|---|---|---|
| Speed | Starts answering at once | Can think for seconds to minutes |
| Cost per answer | Lower | Higher: thinking tokens are billed |
| Maths, logic, code, planning | Good | Much better |
| Simple questions, chat, rewriting | Ideal | Overkill: slower for no gain |
Using reasoning models well
- Use them for hard, multi-step problems: maths, debugging, analysis with many constraints, planning.
- Give the goal and constraints, not a rigid recipe. "Find the bug; consider edge cases" usually works better than prescribing each step, because the model's own approach is often better.
- Choose the effort level where you can: low for routine questions, high for difficult ones.
- Don't treat the thinking as proof. Visible reasoning helps you check the answer, but it is not a guarantee of correctness.
Common mistakes
Work out how much extra a reasoning model's thinking costs for one answer.
price = 10.00 # dollars per million output tokens answer_tokens = 300 thinking_tokens = 4000 # thinking is usually billed as output too # Print the cost of one answer without and with thinking, with 4 decimals: # Without thinking: $0.0030 # With thinking: $0.0430
What is the main way reasoning models are trained to think well?
Summary
- Reasoning models think in thinking tokens before answering, and excel at maths, code and planning.
- They are trained with reinforcement learning on checkable problems, rewarding correct answers.
- Spending more compute at answer time can improve accuracy, much as majority voting does.
- They are slower and costlier; use them for hard problems and choose the effort level.
Next: the sampling settings that control how a model picks each token.
Finished reading? Tick it off to track your progress.