LLM Kitchen
Explanations

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 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 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:

Try it

Thinking off, thinking on

Recorded · Qwen3-0.6B

A bat and a ball cost $1.10 in total. The bat costs $1.00 more than the ball. How much does the ball cost? (Right answer: 5 cents.)

Thinking off

Answered 0.05, right · 132 tokens

Let the cost of the ball be $ x $. Then the cost of the bat is $ x + 1 $. The total cost is: $$ x + (x + 1) = 1.10 $$ Simplify: $$ 2x + 1 = 1.10 $$ Subtract 1 from both sides: $$ 2x = 0.10 $$ Divide by 2: $$ x = 0.05 $$ So, the ball costs **$0.05**. $$ \boxed{0.05} $$

Thinking on

Answered 0.05, right · 4,887 tokens

Scratch work: 4,637 tokens, hidden from the chat bubble

To solve the problem, let's define the price of the ball as $ B $, and since the bat costs $1.00 more than the ball, the price of the bat is $ B + 1 $. The total cost of the bat and the ball is given as $1.10. Therefore, we can write the equation: $$ B + (B + 1) = 1.10 $$ Simplifying the left-hand side: $$ 2B + 1 = 1.10 $$ Subtracting 1 from both sides: $$ 2B = 0.10 $$ Dividing both sides by 2: $$ B = 0.05 $$ Thus, the ball costs **$0.05**. --- **Verification:** - Ball cost: $0.05 - Bat cost: $0.05 + 1 = 1.05 - Total cost: $0.05 + 1.05 = 1.10$, which matches the given total. --- **Final Answer:** $$ \boxed{0.05} $$
All 6 puzzles
ThinkingRight answersTokens written (average)
Thinking off4 of 6131
Thinking on4 of 63,195

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 G answers to the same problem and scores each with simple rules: a reward ri 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:

Ai=ri−mean⁡(r1,…,rG)std⁡(r1,…,rG)

where Ai is answer i’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 by copying a big one instead, through distillation (Ch 15).[5]

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

  1. Jason Wei et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS 2022.
  2. An Yang et al. (2025). Qwen3 Technical Report. arXiv.
  3. Anthropic (2026). Extended thinking. Claude Developer Platform documentation. Accessed October 25, 2026.
  4. Anthropic (2026). Pricing. Claude Developer Platform documentation. Accessed October 25, 2026.
  5. DeepSeek-AI (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv.

Sources

  1. Jason Wei et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS 2022.
  2. An Yang et al. (2025). Qwen3 Technical Report. arXiv.
  3. Anthropic (2026). Extended thinking. Claude Developer Platform documentation. Accessed October 25, 2026.
  4. Anthropic (2026). Pricing. Claude Developer Platform documentation. Accessed October 25, 2026.
  5. DeepSeek-AI (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv.
  6. Qwen Team (2025). Qwen3-0.6B model card. Hugging Face. Accessed October 23, 2026.

Sources

  1. Jason Wei et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. NeurIPS 2022.
  2. An Yang et al. (2025). Qwen3 Technical Report. arXiv.
  3. Anthropic (2026). Extended thinking. Claude Developer Platform documentation. Accessed October 25, 2026.
  4. Anthropic (2026). Pricing. Claude Developer Platform documentation. Accessed October 25, 2026.
  5. DeepSeek-AI (2025). DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning. arXiv.
  6. Qwen Team (2025). Qwen3-0.6B model card. Hugging Face. Accessed October 23, 2026.