Step 15 · Reasoning models
The newest chapter. Instead of buying capability with a bigger model, buy it with more thinking at the moment of answering.
In 60 seconds
Step 15 · Reasoning models
The newest chapter. Instead of buying capability with a bigger model, buy it with more thinking at the moment of answering.
- 1
Idea 1 · Thinking is just more tokens
A model that writes out its working before answering does better. Chain-of-thought started as a prompting trick and became a training target. - 2
Idea 2 · Some answers can be checked by a machine
Maths has a right answer. Code either passes the tests or does not. That means you can score a reasoning attempt without any human, and score millions of them. - 3
Put them together
Sample many reasoning attempts per problem, keep what verifiably works, train on it, repeat. This is reinforcement learning from verifiable rewards. - 4
The surprise
Models trained this way develop behaviours nobody wrote down: checking their own work, backtracking after a wrong turn, trying a second method. Those emerged from the optimisation, not from demonstration data.
def grpo_step(model, ref_model, prompts, verify_fn, group=8, beta=0.04):
losses = []
for prompt in prompts:
# 1. sample a group of independent attempts
completions = [model.generate(prompt, temperature=1.0)
for _ in range(group)]
# 2. score each one objectively -- no reward model needed
rewards = torch.tensor([verify_fn(prompt, c) for c in completions])
# 3. advantage = how much better than the group average
adv = (rewards - rewards.mean()) / (rewards.std() + 1e-6)
# 4. push probability toward above-average attempts,
# with a KL leash back to the reference model
for c, a in zip(completions, adv):
logp = model.logprob(prompt, c)
ref_logp = ref_model.logprob(prompt, c)
losses.append(-(a * logp) + beta * (logp - ref_logp))
return torch.stack(losses).mean()
def verify_fn(prompt, completion):
"""1.0 if the final answer is provably correct, else 0.0."""
return float(extract_answer(completion) == known_answer(prompt))verify_fn. Where you can write an honest checker, you can generate unlimited training signal. Where you cannot, this whole approach does not apply — which is exactly why reasoning models are strongest in maths, code and formal logic, and much less transformed in domains where correctness is a matter of judgement.Test-time compute: a second scaling axis
| Method | How it works | Cost |
|---|---|---|
| Longer chain of thought | Simply think for more tokens | Linear in thinking length |
| Self-consistency | Sample N answers, take the majority | N times the cost |
| Best-of-N with a verifier | Sample N, a checker picks the winner | N times, plus verification |
| Search over steps | Explore a tree of partial solutions | Much more, and much better on hard problems |
Watch and read more
Lab
A reasoning model trained with a verifier you wrote.
The problem
def verify(problem, completion):
return float(extract_final_answer(completion) == problem["answer"])
adv = (rewards - rewards.mean()) / (rewards.std() + 1e-6)You are done when
Hard questions
Try to answer before you reveal. If you can answer these, you understood the lesson.
Q1Accuracy rose and answers got three times longer. Two interpretations — how do you tell which?Reveal
Questions people ask
Is this just chain-of-thought prompting?
It started there. The difference is that the behaviour is now trained in with a real optimisation signal rather than requested in the prompt, which makes it far more reliable and lets it develop strategies no one demonstrated.
Can I train a reasoning model myself?
At small scale, yes, and it is a great project. Take an open base model, a maths dataset with checkable answers, and a GRPO implementation from an open RL library. You will see measurable improvement on a single GPU with LoRA.
Does it help outside maths and code?
Some transfer to general reasoning has been reported. But the training signal comes from verifiable domains, so gains are strongest there. Anywhere correctness is contested, there is no reward to optimise.
Should I always use a reasoning model?
No. For summarising, extraction, formatting and chat, a standard model is faster and much cheaper, and often just as good. Route hard problems to the reasoning model and everything else to a small one.
Lesson test
5 questions. Get 3 right (60%) to pass and complete this lesson.
Sign in with your phone number to take the test and save your progress