Part V · Putting it together
Ch 17. Thinking before answering
Scratch paper made of tokens
Several quirks come from answering straight away. Ask someone for 17 × 24 and they’ll reach for paper. A model’s paper is its own output: every token it writes becomes context for the next one, so writing out the steps gives later tokens something to build on. Just asking big models to show their working helped them with math problems.[1]
Several of the quirks in Ch 16, like miscounted letters, come from answering straight away: the first token of the answer has to be right with no working before it. Ask someone for 17 × 24 and they’ll reach for paper. A language model’s paper is its own output: every token it writes goes back in as context for the next one (Ch 11), so writing out the steps gives later tokens something to build on. Simply asking large models to show their working step by step, called chain of thought, made them better at math word problems.[1][1]
A reasoning modelreasoning model: A language model trained to write out its working before it answers, spending more tokens to get more right. Ch 17 does this every time: it writes scratch work before its answer. Here is Qwen3-0.6B, a small model whose thinking can be switched off, on six puzzles:[2]
A reasoning modelreasoning model: A language model trained to write out its working before it answers, spending more tokens to get more right. Ch 17 does this every time. Before its answer it writes a stretch of scratch work, which chat apps usually hide or fold away. Here is Qwen3-0.6B, a small open model whose thinking can be switched off,[2][2] on six puzzles, recorded with thinking off and on:
What the recordings show
Thinking can fix a mistake. With thinking off, the model says strawberry has 2 r’s. With thinking on, it spells the word out letter by letter, S-T-R-A-W-B-E-R-R-Y, counts 3, and checks again. Spelling the word out turns tokens it can’t see inside (Ch 4) into letters it can count.
It costs many more tokens. With thinking on, the model wrote about 24 times as many tokens on average, mostly scratch work that you never see in the reply. Hosted models bill that scratch work as output, the expensive kind of token: Anthropic counts thinking tokens among the output tokens you pay for, and on its newer models earlier turns’ thinking stays in the prompt and is billed again as input.[3][3][3] On its price list, an output token costs five times as much as an input token.[4][4][4]
It isn’t magic, especially in a small model. Both ways, it got 4 of the 6 right. On two puzzles the thinking went around in circles, full of “Wait, …”, until it hit the limit of 6,000 tokens without ever answering.
Trained to think
Models are also trained to think. Give them problems whose answers can be checked, and reward whatever they wrote when the answer is right. DeepSeek’s model, trained this way, started writing longer answers and re-checking its steps on its own.[5]
Models aren’t only asked to think; they are trained to. One recipe: give the model problems whose answers can be checked automatically, like math with a single number as the answer, and reward whatever it wrote when the final answer is right. DeepSeek trained a large model this way. Over training, its answers grew longer on their own, it began to re-check its steps, and its score on a hard math competition rose from 15.6% to 71.0%.[5][5] The model is still predicting one token at a time. What changed is that it learned which kinds of scratch work tend to lead to right answers.
Rewarding the group
DeepSeek’s method, GRPO, samples a group of answers to the same problem and scores each with simple rules: a reward for a right final answer, plus one for putting the scratch work inside the expected tags. Each answer is then judged against its own group:
where is answer ’s advantage: positive if it did better than the group’s average, in units of how much the group’s rewards spread out. Training raises the probability of every token in answers with a positive advantage and lowers it for the rest, with a limit on how far one step can move and a penalty for drifting from the starting model, as in Ch 15.[5] Comparing within the group means no separate model is needed to say how good an average answer is.
Small reasoning models usually learn from a big one instead, by distillation (Ch 15).
DeepSeek tuned small Qwen and Llama models on 800,000 examples made with its big model, and
released them with names like DeepSeek-R1-Distill-Qwen-1.5B. For a 32-billion-weight Qwen model,
this worked much better than training it with rewards directly.[5][5] Qwen3-0.6B,
the model above, was also tuned to copy the probabilities of larger Qwen3 models.[2][2]
Thinking is bought with tokens, and tokens take time and money.
The recommended settings for Qwen3’s thinking mode leave room for up to 32,768 tokens of output, and warn against always picking the most likely token, which can make it repeat itself endlessly.[6][6] Thinking is bought with tokens, and tokens take time and money.
Qwen3 writes its scratch work between <think> and </think> tags, so a chat app can find it and
fold it away; with thinking switched off, the model skips it.[6]
Recipe card
Recap
- A reasoning model writes scratch work before its answer; every token it writes becomes context for the next.
- Writing the steps out can fix mistakes, like counting letters by spelling the word first.
- It costs many more tokens, and it can still go in circles or get the answer wrong.
- Reasoning is trained with rewards for checkable answers; GRPO scores each answer against the others for the same problem.
Next question: knowing how the model works, how do you write prompts that work with it?
Sources
- Jason Wei et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS 2022.
- An Yang et al. (2025). Qwen3 Technical Report. arXiv.
- Anthropic (2026). Extended thinking. Claude Developer Platform documentation. Accessed October 25, 2026.
- Anthropic (2026). Pricing. Claude Developer Platform documentation. Accessed October 25, 2026.
- DeepSeek-AI (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv.
Sources
- Jason Wei et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS 2022.
- An Yang et al. (2025). Qwen3 Technical Report. arXiv.
- Anthropic (2026). Extended thinking. Claude Developer Platform documentation. Accessed October 25, 2026.
- Anthropic (2026). Pricing. Claude Developer Platform documentation. Accessed October 25, 2026.
- DeepSeek-AI (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv.
- Qwen Team (2025). Qwen3-0.6B model card. Hugging Face. Accessed October 23, 2026.
Sources
- Jason Wei et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS 2022.
- An Yang et al. (2025). Qwen3 Technical Report. arXiv.
- Anthropic (2026). Extended thinking. Claude Developer Platform documentation. Accessed October 25, 2026.
- Anthropic (2026). Pricing. Claude Developer Platform documentation. Accessed October 25, 2026.
- DeepSeek-AI (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv.
- Qwen Team (2025). Qwen3-0.6B model card. Hugging Face. Accessed October 23, 2026.