Skip to content
atlas

Chain-of-thought (CoT)

Also known as: CoT, chain-of-thought prompting

Getting a language model to write out its steps before the final answer, which tends to help on sums, logic and planning.

Draft - this entry has not been reviewed yet.

Formal

A prompting method in which a large language model is led - by worked examples or an instruction such as “think step by step” - to produce steps in between before its answer; because each written step becomes input for the next, harder problems can be broken down.

In plain English

Like a teacher who makes pupils show their working on a maths test - writing each step down makes fewer slips and lets you see where one went wrong.

In practice

A planner at a water utility asks an assistant how many pipe inspections two crews can manage in a week; told to work step by step, it lists hours, driving time and time per job before giving the total.

Why it matters

It often makes answers to multi-step problems better, but the written steps cost time and money and are not a faithful record of how the model really reached its answer.

Technical deep dive

Wei et al. (2022) introduced chain-of-thought prompting as few-shot prompting in which each exemplar's answer is preceded by a worked rationale. With eight such exemplars, PaLM 540B reached state-of-the-art accuracy on the GSM8K grade-school maths benchmark at the time, and the paper reported that the benefit appeared only in sufficiently large models (on the order of 100 billion parameters), while smaller models produced fluent but illogical chains that could hurt accuracy. Kojima et al. (2022) then showed the zero-shot variant: appending "Let's think step by step" raised text-davinci-002's accuracy on MultiArith from 17.7% to 78.7% and on GSM8K from 10.4% to 40.7%, typically with a second call to extract the final answer from the generated reasoning.

The mechanism is computational rather than mystical. A transformer performs a bounded amount of computation per generated token; writing intermediate results into the context lets later tokens attend to them, effectively giving the model a scratchpad and more serial steps for problems that need them. This explains where CoT helps (multi-step arithmetic, symbolic manipulation, logic puzzles, planning) and where it adds little (factual recall, simple classification, tasks already solvable in one step), and why it costs more output tokens and latency.

Several extensions build on the same idea. Self-consistency (Wang et al., 2022) samples multiple chains at non-zero temperature and takes a majority vote over final answers. Least-to-most prompting decomposes a problem into sub-questions solved in order; Tree of Thoughts (Yao et al., 2023) searches over branching partial solutions with explicit evaluation; program-aided approaches have the model write code whose execution produces the answer, moving arithmetic out of the model. Reasoning models internalise long chains of thought through reinforcement learning, so explicit "think step by step" instructions add little to them and some providers advise against prescribing the steps.

The written chain is not a faithful account of the computation. Turpin et al. (2023) showed that when few-shot prompts were biased - for example by always placing the correct answer in position A - models followed the bias and then produced plausible rationales that never mentioned it. Later work on reasoning models found the same pattern with hidden hints. Consequently CoT output can be used for debugging, for spotting some errors and as a monitoring signal, but not as an explanation of a decision or as evidence that the answer is correct. In production, also decide whether the chain is shown to users: it may contain intermediate statements that are wrong, off-policy or that quote sensitive context.

What to learn first

Everything this builds on, foundations first.

  1. Inference
  2. →Token
  3. →Next-token prediction
  4. →Chain-of-thought (CoT)

Relationships

Sources & further reading

Where this data comes from

This entry was drafted by an AI from the sources above and has not yet been checked by a person. Treat it as a starting point, and check anything important against the sources.

See the review queueSuggest a correction on GitHubThis term as JSON

Check yourself

Loading…

Atlas is in beta.