A prompting technique that improves AI reasoning by asking the model to work through problems step by step before giving an answer.
Chain-of-thought is a prompting technique where you ask the AI to think through a problem step by step rather than jumping to an answer. Adding a simple phrase like 'Let's think step by step' often dramatically improves accuracy on math, logic, and reasoning tasks. It works because writing out reasoning helps the model catch its own errors and maintain consistency.
Imagine solving a word problem in your head versus writing out each step. Most people make more mistakes doing mental math than when they show their work. LLMs are similar — when they try to jump straight to an answer, they often skip crucial steps. Chain-of-thought is the AI equivalent of 'show your work' — and it dramatically reduces errors.
Chain-of-Thought (CoT) prompting, introduced in Wei et al. (2022), encourages LLMs to decompose complex problems into intermediate reasoning steps before producing a final answer. Variants include: zero-shot CoT ('let's think step by step'), few-shot CoT (providing examples with explicit reasoning), and self-consistency (sampling multiple reasoning chains and taking the majority answer). CoT is particularly effective for mathematical, logical, and multi-step reasoning tasks. Its effectiveness scales with model size — smaller models may not benefit as much. Modern 'reasoning models' like OpenAI's o1 and o3 integrate CoT into their training, eliminating the need for explicit prompting.
Instead of just asking 'What's 23% of 847?', prompt 'Calculate 23% of 847. Show your work step by step.' The intermediate steps catch errors.
'Alice, Bob, and Charlie are in a line. Given [constraints], determine the order. Think through each constraint's implications step by step.'
'Should we launch feature X? Consider the pros, cons, risks, and alternatives in sequence, then conclude.'
'Walk through this function step by step for the given input. Note any unexpected behavior, then identify the bug.'
It works best with large, capable models (GPT-4, Claude 3/4, Gemini Ultra, Llama 3 70B+). Smaller models see less benefit and sometimes produce reasoning that's consistent but wrong. Reasoning-focused models (o1, o3, Claude 3.7 Sonnet Thinking) have CoT baked in, so explicit prompting for it is less needed.
For simple factual questions or tasks where the answer is a single known fact, CoT adds length without benefit. It's also counterproductive when you need fast, low-latency responses — CoT triples or more the output tokens. For conversational or creative tasks, explicit CoT can feel stilted. Use it for complex reasoning, not quick lookups.
Yes, surprisingly. Zero-shot CoT works remarkably well just by adding that phrase. For even better results, combine with: (1) few-shot examples showing the reasoning style you want, (2) specific prompts like 'first identify X, then consider Y, then...', (3) requesting the answer in a structured format after reasoning. But the simple trigger phrase alone often gets 80% of the benefit.
The skill of writing instructions to AI models to get the best possible output.
📚A neural network trained on massive text data to understand and generate human-like language.
🎓A technique where you give the AI a few examples of the task you want it to perform, improving accuracy without any training.
🔍A technique that lets AI models look up information before answering, improving accuracy and reducing hallucinations.
Our free AI course teaches you to use these ideas in real projects.
Start Free AI Course →