Give the Model Room to Think

How asking a model to write out its working before the answer improves multi-step results, how to structure and extract that working, and when to skip it.

13 minLesson 4 of 8
On this page
  1. Why written working changes the answer
  2. Answer first compared with working first
  3. Ways to give the model room to think
  4. When to skip it
  5. Pitfalls when asking for working
  6. What this changes in practice
  7. Check yourself
  8. What to practise next

A language model produces its reply one token at a time, and the only place it can keep intermediate results is the text it has already written. If you ask for working before the answer, the model can use each step it writes as input for the next one, and multi-step problems such as arithmetic, comparing options and checking rules become much more reliable. If you force the answer to come first, the model has to produce it with no working on the page.

The practical consequence is that the order and length of the reply are part of the prompt. A prompt that says "reply with the answer only" on a problem with several steps removes the one thing that helps the model get it right.

Why written working changes the answer

For every token, the model runs a fixed amount of computation over the prompt and everything it has written so far. That amount does not grow because the question is harder. A problem that needs five dependent steps therefore cannot be solved in the single token that carries a one-word answer, unless the model has memorised the result.

When the reply starts with working, each step is written down and becomes part of the text that later tokens read. The final answer then only has to pick out a result that is already on the page. This is the same reason you get a better result from a calculation done on paper than from one done in your head.

Answer first compared with working first

The question is: pens cost $9 for a pack of 12 or $1 each, and you need exactly 30 pens, so what is the cheapest way to buy them? The tracer below shows two illustrative replies, one that is told to give only the price and one that is told to work step by step.

Answer first compared with working firstUse the arrows or ← → keys
repeat:  look at the prompt and everything written so far  write the next piece
  1. reply A, written so far
    (empty)
    steps on the page
    0

    1Prompt A says "Reply with the price only." The model has to start with the answer, and the only text it can read is the problem itself.

  2. reply A, written so far
    $22.50
    steps on the page
    0

    2The model writes a plausible number: $9 divided by 12 is $0.75 a pen, and 30 pens at $0.75 is $22.50. That price is not possible, because you cannot buy half a pack.

  3. reply A, written so far
    $22.50
    Each pen costs $0.75 in packs,
    and 30 × $0.75 = $22.50.
    steps on the page
    0

    3If you now ask for an explanation, the model explains $22.50, because the explanation is written to be consistent with the answer already on the page. Working that comes after the answer cannot change it.

  4. reply B, written so far
    Options: 0, 1, 2 or 3 packs of 12
    steps on the page
    1

    4Prompt B says "Work it out step by step, then give the price on the last line." The model first lists the options. Three packs is 36 pens, so buying more than three packs is never needed.

  5. reply B, written so far
    Options: 0, 1, 2 or 3 packs of 12
    3 packs = $27 (6 spare)
    steps on the page
    2

    5It prices the first option. Three packs cost $27 and leave 6 pens spare.

  6. reply B, written so far
    Options: 0, 1, 2 or 3 packs of 12
    3 packs = $27 (6 spare)
    2 packs + 6 singles = $18 + $6 = $24
    steps on the page
    3

    6Two packs give 24 pens, which is 6 short, so the cost is $18 for the packs plus $6 for singles, or $24.

  7. reply B, written so far
    Options: 0, 1, 2 or 3 packs of 12
    3 packs = $27 (6 spare)
    2 packs + 6 singles = $18 + $6 = $24
    1 pack + 18 singles = $9 + $18 = $27
    steps on the page
    4

    7One pack gives 12 pens, which is 18 short, so the cost is $9 plus $18, or $27.

  8. reply B, written so far
    Options: 0, 1, 2 or 3 packs of 12
    3 packs = $27 (6 spare)
    2 packs + 6 singles = $18 + $6 = $24
    1 pack + 18 singles = $9 + $18 = $27
    0 packs: 30 singles = $30
    steps on the page
    5

    8With no packs, 30 singles cost $30. All four options are now written in the text the model reads.

  9. reply B, written so far
    Options: 0, 1, 2 or 3 packs of 12
    3 packs = $27 (6 spare)
    2 packs + 6 singles = $18 + $6 = $24
    1 pack + 18 singles = $9 + $18 = $27
    0 packs: 30 singles = $30
    Answer: $24
    steps on the page
    5

    9The last line only has to choose the smallest of four numbers that are already written, which is $24.

1 / 9

Reply A had to commit to a number first, so it gave the first plausible one. Reply B turned a tricky question into a series of small ones. The steps can still contain mistakes, but a wrong step on the page can be found and corrected, whereas a wrong one-word answer gives you nothing to check.

Ways to give the model room to think

Asking for step-by-step reasoning

The simplest form is a sentence in the prompt, such as "Work through this step by step, then give the final answer." It needs no format and works in any chat. It is the right choice for a one-off question where you will read the whole reply yourself.

Its weakness is that the working and the answer arrive mixed together. A program that reads the reply has to guess where the answer is, and a person has to scan a long reply for it. Free-form working also varies in length and style between runs.

Separating the working from the answer

When another system will use the result, ask for the working and the answer in separate marked sections. The example below shows what goes wrong without room to think, and then the same task with the sections.

Answer onlyIllustrative example. Real replies vary.
You
Our team needs a meeting slot. Ana can't do mornings. Ben is out Tuesday and Wednesday. Chloe only works Monday to Wednesday. Slots: Mon 10:00, Tue 14:00, Wed 15:00, Thu 11:00. Which slot works for everyone? One word.
Model
Wednesday

Wednesday is wrong because Ben is out that day. Checking every person against every slot takes several steps, and the prompt left no room for them.

Working, then answerIllustrative example. Real replies vary.
You
Our team needs a meeting slot. Ana can't do mornings. Ben is out Tuesday and Wednesday. Chloe only works Monday to Wednesday. Slots: Mon 10:00, Tue 14:00, Wed 15:00, Thu 11:00. Check each slot against each constraint inside <thinking> tags. Then give the slot that works for everyone inside <answer> tags, or "none" if no slot works.
Model
<thinking> Mon 10:00: morning, so Ana can't. Out. Tue 14:00: Ben is out Tuesday. Out. Wed 15:00: Ben is out Wednesday. Out. Thu 11:00: morning for Ana, and Chloe doesn't work Thursday. Out. </thinking> <answer>none</answer>

The correct answer is "none". The one-word prompt made that answer unlikely, because it implied that some slot must work. The second prompt allows for it explicitly, which is the habit from Be Clear and Specific of saying what the model should do when the task has no answer. Because the answer is inside tags, a program can ignore the working and read only the result.

function extractAnswer(reply) {
  const match = reply.match(/<answer>([\s\S]*?)<\/answer>/);
  return match ? match[1].trim() : null; // null: the tag was missing
}
 
const reply = "<thinking>Mon 10:00 ... Out.</thinking>\n<answer>none</answer>";
console.log(extractAnswer(reply)); // "none"
import re
 
def extract_answer(reply):
    match = re.search(r"<answer>(.*?)</answer>", reply, re.DOTALL)
    return match.group(1).strip() if match else None  # None: the tag was missing
 
reply = "<thinking>Mon 10:00 ... Out.</thinking>\n<answer>none</answer>"
print(extract_answer(reply))  # none

The code returns nothing when the tag is missing, and your program has to handle that case. Models follow a requested format most of the time but not always, and a reply that was cut off before the closing tag will not match.

Telling the model what the working should contain

"Think step by step" leaves the model to choose its own steps, and it may skip the one that matters. If you know what a good solution has to check, say so. In the meeting example the prompt asked for each slot to be checked against each constraint, and in the try-it exercise below the prompt asks for weekly commuting hours before any comparison. Naming the steps works best when the task has a known method, and it also makes the working easier to review, because you can see whether each requested step was done.

The risk is that you prescribe the wrong method. If the steps you list are not the right ones for the problem, the model will follow them anyway, so keep the instructions to checks you are sure are needed.

Built-in thinking settings

Some models and tools have a setting that makes the model write working before its reply, and that working may or may not be shown to you. With it turned on, adding "think step by step" to the prompt usually adds little, because the model is already doing it. A structured request for the working can still help when you want to review the steps yourself or extract only the answer, since the built-in working may be hidden or summarised, and it does not give you a section that a program can parse.

Splitting a large task into several prompts

One reply can only hold so much working before it becomes hard to follow or drifts. For a large job, such as reviewing a long document against twenty rules, run one prompt for each part and pass each result into the next prompt. This gives every part its own room to think, and it lets you check the intermediate results.

When to skip it

Written working helps when the answer depends on several steps: arithmetic, comparing options, checking a list of rules, debugging, and planning. It adds little to a lookup, a translation of a short phrase or a short creative task, and it costs extra tokens and waiting time on every call. For a high-volume task that does not need reasoning, asking for working is a cost with no benefit.

Pitfalls when asking for working

What this changes in practice

When a task has more than one step, write the prompt so that the working comes first and the answer last, and say where each part goes. Tag the answer whenever a program reads the result. Look at the working when the answer matters, because a wrong step is the quickest way to find out why a result is wrong. For simple lookups, leave the working out and keep the reply short.

Try it: Let it compare before choosing

This prompt gets a one-word pick that often ignores the commute. Rewrite it so that the model compares the offers on what matters before it chooses, and so that the choice is easy to find.

Show a sample answer
Rewritten promptIllustrative example. Real replies vary.
You
Help me pick a job offer. I care most about time with my family, then pay. A: $62k, 70-minute commute each way, 5 days a week. B: $58k, fully remote. C: $60k, 20-minute commute each way, 4-day week. Inside <thinking> tags: work out the weekly hours spent commuting for each, then compare the offers on free time first and pay second. Then give your pick inside <answer> tags as one letter, followed by one sentence explaining why.

This version works because the model writes the numbers before it decides: A is about 11.7 hours of commuting a week, C is about 2.7, and B has none. Your stated priorities tell it how to weigh them, and the tag makes the choice easy to find.

Check yourself

Quick check

Why does writing the working first help a model on multi-step problems?

A prompt says "Give your answer, then explain your reasoning." What is the problem?

A program reads the model's reply and needs only the final result. What is the best way to ask for it?

For which request is asking for step-by-step working least useful?

What to practise next

Structured Output extends the tag approach to JSON that a program can parse and validate, and Verifying AI Output covers how to check the working the model gives you.