Chain of thought
Letting an AI model write out its reasoning step by step before it answers.
Chain of thought is the intermediate reasoning a language model writes before giving its final answer. Instead of jumping from "a store had 23 apples, used 20 and bought 6 more, how many now?" straight to a number, the model writes "23 minus 20 is 3, plus 6 is 9" and only then answers 9.
It works because a model produces text one token at a time, and each new token can build on everything written before. Writing the steps gives the model room to work: partial results end up on the page instead of having to be held "in its head". A 2022 Google paper showed that just including worked examples like this in the prompt made large models much better at math and logic puzzles; soon after, people found that adding "let's think step by step" helped too.
Today this is often built in. Reasoning models are trained to produce a long chain of thought before answering, and many apps let you see it, or a summary of it. Two cautions: thinking costs time and tokens, so it is not worth it for simple questions; and the written chain is not guaranteed to be the real reason behind the answer. It is useful for checking work, but it is not a perfect window into the model.
Keep in mind
- The model writes intermediate steps before the final answer.
- It helps most on math, logic and multi-step problems.
- Reasoning models are trained to do it on their own.
- The written steps may not fully reflect how the answer was really reached.
Go deeper
- Let Claude think: chain-of-thought prompting (Claude docs)
- Chain-of-Thought Prompting Elicits Reasoning in Large Language Models (Wei et al., 2022)
- Chain-of-thought prompting on Wikipedia