# Chain-of-Thought Prompting

> Why asking for the steps makes hard answers better, with the real numbers. When to vote across runs or branch, and when it is all a waste.

**Course:** [Prompt Engineering](https://learn.benibix.com/learn/ai-working-with-ai)  
**Time:** 12 min

**After this lesson you can:**

- Explain why written steps help a hard answer
- Hide the working inside tags
- Choose between one chain, a vote and a tree

## Why asking for the steps makes answers better

Chain-of-thought prompting asks a model to work through the steps before it answers. In the 2022 paper that named it, a large model solved 17.9 in 100 school maths problems with a plain prompt. Shown worked steps, it solved 56.9 in 100. Writing steps gives the model more to build on.

The reason is how a model writes. Each word it writes becomes part of what it reads next. A model that has written step one has a better start for step two. A model that jumps straight to the answer gets one pass at the whole problem and no second look.

It pays on sums, on logic and on tasks with several parts. It costs on everything else. The steps are output tokens, which are the slow kind and the dear kind. For a simple question, asking for steps just makes the answer longer and the bill bigger.

Self-consistency is the heavier version. You ask the same question several times with some randomness on, and each run works it out its own way. Then you keep the answer that comes up most often. In the 2022 paper that named it, the vote added 17.9 points on the same maths test.

Tree of thoughts goes further. The model writes a few possible next steps, judges which look good and drops the weak ones. It can back up and try another branch. On a number puzzle in the 2023 paper, GPT-4 solved 4 in 100 with a chain of thought and 74 in 100 with a tree.

Both cost far more. Self-consistency with five runs costs five times as much. A tree can cost many more calls, and it needs a program around the model to run it. Save them for questions where a wrong answer is costly and a right one can be checked.

Two cautions. The steps a model writes are not a true record of how it got the answer, so do not read them as proof. And reasoning models now think before they answer on their own. Asking one to think step by step again adds cost and little gain.

## Chain of thought, self-consistency and tree of thoughts

| Method | How it works | What it costs |
| --- | --- | --- |
| Chain of thought | One line of written steps, then the answer | One call, with a longer answer |
| Self-consistency | Several runs, then a vote on the answer | One call per run |
| Tree of thoughts | Branches of steps, judged and pruned | Many calls, plus a program to run them |

## Which one to pick

1. **Chain of thought.** Pick it for sums, logic and many-part questions. Skip it on a model that thinks first by itself.
2. **Self-consistency.** Pick it when one answer must be right and you can pay for five runs.
3. **Tree of thoughts.** Pick it for puzzles where you must try a path, back up and try another.

```text
A pack of 3 pens costs $2. How much do 12 pens cost?
Work it out step by step inside <working> tags.
Then give only the final amount inside <answer> tags.
```
The steps go in one tag and the answer in the other. The reader only ever sees the answer.

![Three panels. Chain of thought: one line of steps from the question to one answer. Self-consistency: five lines from the question that land on 8, 8, 6, 8 and 9, with a vote that picks 8. Tree of thoughts: a question that branches into three steps, two crossed out, and the third branching again to reach the answer.](https://learn.benibix.com/diagrams/ai3-reasoning-paths.svg)

### Example: Jack's bot works out delivery fees

Jack's shop bot works out delivery fees from the weight and the distance. Asked for the fee alone, it gets 6 of 25 test orders wrong.

With the working inside tags first, it gets 1 wrong. Each answer costs about 150 more output tokens, and he decides the fix is worth it.

**Words in this lesson:** [Chain-of-Thought Prompting](https://learn.benibix.com/term/ai/chain-of-thought-prompting), [Self-Consistency (Prompting)](https://learn.benibix.com/term/ai/self-consistency), [Tree of Thoughts (ToT)](https://learn.benibix.com/term/ai/tree-of-thoughts), [Reasoning Model](https://learn.benibix.com/term/ai/reasoning-model)

> **The one thing to remember.** Written steps help because each step becomes part of what the model reads next. They cost output tokens, so spend them only on hard questions.

**Question:** Why does asking an AI to think step by step help on hard questions?

**Answer:** Each written step becomes part of what the model reads next. Nothing extra happens inside the model. Once step one is written, the model is reading a better prompt when it writes step two.

---

Source: https://learn.benibix.com/learn/ai-working-with-ai/chain-of-thought-prompting
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-20
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
