Chain-of-thought
In one sentence Chain-of-thought prompting asks the model to write out its reasoning steps before the answer, sharply improving accuracy on multi-step problems.
Updated
Chain-of-thought means having the model write out intermediate reasoning steps before giving its final answer, instead of answering in one leap.
Every maths teacher enforces this: "show your working." Not for the teacher's benefit — for the student's. Working line by line catches errors mid-way and breaks a hard leap into easy steps. The same trick, applied to LLMs, was one of the highest-impact discoveries in prompting (Wei et al., 2022): on a maths word problem, "answer directly" fails where "reason step by step, then answer" succeeds.
Why it works comes from how generation happens. A model produces one token at a time, with a fixed amount of computation per token. Demanding an instant answer forces the entire problem through that fixed budget. Letting the model write steps gives it more sequential computation — and each written step becomes context the next step conditions on. The page functions as working memory.
Q: A shop sells pens at ₹12 each, or ₹100 for a box of 10. What do 24 pens cost at minimum?
Direct answer : "₹288" ✗
Step by step : "Two boxes = 20 pens = ₹200. Four loose = ₹48. Total ₹248." ✓The magic phrase "let's think step by step" works even zero-shot. Cautions: written reasoning is not guaranteed to be the real cause of the answer, and confident-looking steps can still rest on a wrong fact. The idea's descendants are reasoning-models — trained to generate long internal chains automatically — which is why explicit CoT prompting matters less on them.
Where to go next
- Full lesson: Prompt engineering
- Related terms: prompt, few-shot, reasoning-model, hallucination