Chain-of-thought prompting
Prompting a model to work through intermediate steps before giving its answer, especially for problems where each step depends on the last.
See it
What it is
Chain-of-thought prompting asks a model to produce intermediate reasoning before its final answer. The name took off with the 2022 paper 'Chain-of-Thought Prompting Elicits Reasoning in Large Language Models', which showed that worked, step-by-step examples could improve answers on multi-step arithmetic and commonsense tasks. A companion 2022 paper, 'Large Language Models are Zero-Shot Reasoners', found that the bare instruction 'Let's think step by step' bought a good share of the same gain with no examples at all.
Reach for it with a general model when the job has dependent steps: calculations, logic puzzles, planning, or applying several rules in order. A few-shot prompt that demonstrates the reasoning shape is more controlled than adding 'think step by step' and hoping for the best. For production work, ask for a concise rationale and checkable calculations rather than pages of internal monologue.
Gotcha: a plausible chain is not proof. Models can write convincing steps after landing on a wrong answer, and many reasoning models already do private reasoning that they do not expose. Score the final result against known answers, and do not treat generated reasoning as an audit log of what actually happened inside the model.
Ask AI for it
Build a benchmark in Python with Hugging Face Transformers that compares three prompt styles on the GSM8K test set: direct answer, zero-shot 'think step by step', and two worked chain-of-thought examples. Keep the model and decoding settings identical, extract each final numeric answer into a separate field, score exact-match accuracy, and print accuracy, average output tokens, and latency for all three styles. Save ten wrong examples per style with the prompt, reasoning text, predicted answer, and correct answer so the failure modes can be inspected.