Chain-of-Thought Prompting
Chain-of-thought prompting has a model write out intermediate reasoning steps before its final answer, improving accuracy on multi-step problems.
Chain-of-thought prompting is a technique where a model is instructed, or shown examples, to write out intermediate reasoning steps before producing a final answer, instead of jumping straight to a conclusion, which measurably improves accuracy on problems that require several dependent steps.
A transformer performs a fixed amount of computation per generated token, conditioned on everything generated so far. Ask for a final answer directly, and the model has only that fixed, single-token budget of computation to arrive at something that may genuinely require several chained steps of arithmetic or logic. Ask it to think step by step first, and each intermediate token it writes becomes part of the input to the next one — the model is, in effect, using its own output as extra working memory and extra computation it would not otherwise have.
How it works
In practice, chain-of-thought is invoked either by a direct instruction to think through the problem step by step, or by demonstration — few-shot examples that show the reasoning steps, not just the final answers, so the model continues the pattern of showing its work. The mechanism is not that the model becomes smarter; it is that breaking a problem into steps written in sequence lets errors get caught partway through, and lets each step condition on a clearly stated previous result rather than requiring the whole derivation to happen invisibly in one pass.
This is also chain-of-thought's known failure mode: the steps are still generated token by token, so an early mistake propagates forward with just as much apparent confidence as a correct step. A fluent, wrong intermediate step produces a fluent, wrong final answer — chain-of-thought reduces one class of error while doing nothing to prevent a model from hallucinating a wrong fact mid-chain and reasoning flawlessly from there.
Why it matters
Chain-of-thought is the default technique for arithmetic, logic puzzles, multi-step planning, and code reasoning, anywhere a direct answer requires composing several intermediate facts. It is also largely unnecessary overhead for tasks with no real intermediate steps — classification, short factual lookups, simple rewrites — where it mostly adds latency and token cost without improving anything, since there is no chain to walk.
A worked example
Problem: a cafe orders 18 boxes of coffee cups, 150 cups per box, at $0.04 per cup, plus a flat $35 delivery fee, split evenly across 4 stores.
Asked directly for just the final number, a model skipping the arithmetic entirely in its "head" has a real chance of dropping a step — for instance computing 18 times 150 times $0.04 as $108, dividing by 4 to get $27, and forgetting to add the delivery fee before splitting it, landing on a plausible-looking but wrong $27.
Prompted to show its work: 18 boxes times 150 cups is 2,700 cups; 2,700 times $0.04 is $108 in cup cost; $108 plus the $35 delivery fee is $143 total; $143 divided by 4 stores is $35.75 per store. Each number is now explicit and checkable, the delivery fee is added before the final split rather than forgotten, and the answer, $35.75, is correct, verifiably, since every intermediate quantity is stated in the open rather than computed silently.
How Miatz teaches it
Chain-of-thought is taught as a diagnostic tool as much as a prompting technique: learners deliberately compare a model's direct answer against its shown-work answer on the same multi-step problem, and when the two disagree, the visible chain is what lets them find exactly which step broke — a habit that carries directly into debugging an agent's tool-call sequence later in the curriculum.