Chain-of-thought (CoT) prompting asks an AI model to write out its reasoning step by step before giving the final answer. The written steps act as working memory, so the model makes fewer jumps to a wrong conclusion.
It helps on maths, logic puzzles, planning and any question with several steps. On simple fact questions it adds length without adding accuracy.
An example
The classic test is the bat and ball puzzle. The quick answer is wrong, and models fall for it the same way people do.
Two ways to use it
Few-shot CoT shows worked examples with their reasoning, then asks the new question. This is the method from the Google paper Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. With eight worked examples, a 540B-parameter model reached a then state-of-the-art score on GSM8K, a set of grade-school maths problems.
Zero-shot CoT skips the examples and adds one line such as “Let’s think step by step” to the prompt. A second 2022 paper, Large Language Models are Zero-Shot Reasoners, found this line raised GSM8K accuracy from 10.4% to 40.7% on text-davinci-002.
| Zero-shot CoT | Few-shot CoT | |
|---|---|---|
| What you add | One instruction | Two or more worked examples |
| Effort | Lowest | Higher |
| Control over the steps | Low | High |
Chain of thought and reasoning models
Newer reasoning models do this on their own. They are trained to think through a problem before they answer, often in a hidden reasoning step.
With these models you rarely need to write “think step by step”. Clear goals and constraints matter more. Chain-of-thought prompting still helps with faster, non-reasoning models when a task has several steps.
Tips
- Ask for the steps, then the answer. End with a clear line such as “Final answer” so it is easy to find.
- A wrong step is easier to spot than a wrong number.
- Skip it for simple tasks. Extra steps cost tokens and time.
- A model can write tidy reasoning and still reach a wrong answer.
