Chain-of-thought (CoT) prompting is a technique that asks an AI model to write out intermediate reasoning steps before giving its final answer. Instead of jumping straight to a conclusion, the model works through the problem one step at a time. This often improves accuracy on maths, logic, planning and other multi-step tasks.
This page covers CoT as a prompting technique. For how AI systems reason more broadly, including reasoning models, see What is AI Reasoning?
Key takeaways
- CoT was described in a 2022 Google research paper by Jason Wei and colleagues.
- Few-shot CoT shows worked examples with reasoning; zero-shot CoT simply asks the model to think step by step.
- Self-consistency samples several reasoning paths and picks the most common answer.
- Many modern reasoning models perform step-by-step thinking automatically.
- Written reasoning can still contain errors, and may not fully reflect how the model reached its answer.
Chain-of-thought explained in simple terms
A teacher asks students to “show your working” in maths exams. Writing each step makes mistakes less likely and easier to spot. Chain-of-thought prompting asks an AI to show its working too. Because language models generate text one token at a time, writing intermediate steps gives the model more room to compute before committing to an answer.
A worked example
Without CoT:
“A shop sells notebooks at ₹45 each. Priya buys 6 notebooks and pays with a ₹500 note. She also uses a ₹30 discount coupon. How much change does she get?”
A model answering directly might make a quick arithmetic slip.
With CoT:
Add: “Work through this step by step, then give the final answer on its own line.”
The model writes:
- Cost of notebooks: 6 × 45 = ₹270.
- After coupon: 270 − 30 = ₹240.
- Change: 500 − 240 = ₹260.
- Final answer: ₹260.
Each step is simple, so the chance of error falls, and a reader can check every line.
Types of chain-of-thought prompting
| Variant | How it works | Source |
|---|---|---|
| Few-shot CoT | Include examples that show reasoning steps and answers | Wei et al., 2022 |
| Zero-shot CoT | Add a phrase like “Let’s think step by step” | Kojima et al., 2022 |
| Self-consistency | Generate several reasoning paths; take the majority answer | Wang et al., 2022 |
| Least-to-most | Break a problem into sub-problems solved in order | Zhou et al., 2022 |
| Tree of thoughts | Explore and evaluate multiple branches of reasoning | Yao et al., 2023 |
When chain-of-thought helps
- Arithmetic and word problems.
- Logic puzzles and rule application.
- Multi-step planning and scheduling.
- Analysing a document against criteria.
- Debugging code or tracing causes of a problem.
It helps less for simple lookups, short factual questions or creative writing, where it mainly adds length and cost.
CoT and reasoning models
Newer “reasoning models” are trained to think step by step before answering, often using reinforcement learning, and may do this internally without being asked. With these models, explicit CoT instructions matter less, and some providers advise against over-prescribing the reasoning steps. For standard models, CoT prompting remains a useful tool.
Practical tips
- Ask for reasoning, then a clearly separated final answer, so software can extract it.
- For customer-facing apps, you may keep reasoning hidden and show only the answer.
- Combine with few-shot examples for specialised tasks.
- Use tools, such as a calculator or code, for precise computation instead of relying on text reasoning.
- Verify important conclusions; convincing steps can still hide an error.
Limitations
- Longer outputs increase cost and latency.
- Reasoning can look logical but contain a wrong step.
- The written chain may not faithfully reflect the model’s actual internal process.
- Gains are larger for bigger, more capable models; small models may produce muddled reasoning.
- Reasoning can include hallucinated facts used as premises.
