← Papers
5 min read

Chain-of-Thought, in five pictures

The 2022 paper that showed models answer better when the examples show their working, in five short animations.

PapersPrompting
Watch it in about a minute

In 2022, nine researchers at Google found that a model gets much better at multi-step problems if the examples in the prompt show their working. Nothing about the model changes. Only the prompt does.

1. The idea: show the working in the example

Same model, same question
Answer only
  1. ExampleRoger has 5 tennis balls. He buys 2 more cans of tennis balls. Each can has 3 tennis balls. How many tennis balls does he have now? A: The answer is 11.
  2. QuestionThe cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
  3. ModelThe answer is 27.
Show the working
  1. ExampleRoger has 5 tennis balls... A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11. The answer is 11.
  2. QuestionThe cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?
  3. ModelThe cafeteria had 23 apples originally. They used 20 to make lunch. So they had 23 - 20 = 3. They bought 6 more apples, so they have 3 + 6 = 9. The answer is 9.
This is the paper's opening example. The only difference is that the worked example spells out its steps, and the model copies the habit.

2. The result: three times as many right answers

Maths word problems solved (higher is better)
  • Answer-only examples 17.9%
  • Best specially trained system 55%
  • Worked examples 56.9%
Google's PaLM model, given just eight worked examples.

3. It works beyond maths

Other kinds of reasoning, with worked examples
  • Yes/no questions needing several facts: earlier best 69.4%
  • Same test, with worked examples 75.6%
  • Sports questions: a sports fan 84%
  • Same test, with worked examples 95.4%

4. Is it really the reasoning that helps?

The authors tried three cheaper versions
  • Only write the equationDid not help much on hard problems
  • Only give the model extra room (dots)About the same as no working
  • Give the reasoning after the answerAbout the same as no working
  • Reasoning in words, before the answerThe only one that worked

5. When it is wrong, it is often close

50 wrong answers, read one by one
  • Nearly right: a slip in arithmetic or one missed step 46%
  • A real misunderstanding 54%
And of 50 right answers, all but two were right for the right reasons.

Why it matters today

What came next
  1. 01Worked examples in prompts
  2. 02"Think step by step"
  3. 03Models that reason before answering

It is why “explain your reasoning first” is common advice for writing a prompt, and it is half of the idea behind the ReAct paper.

Where you see it today

In September 2024 OpenAI released o1, a model trained to work through a long chain of thought before it answers. Many assistants now have a “thinking” mode built on the same idea.

The details, if you want them

Who wrote it, and where to read it

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models by Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed H. Chi, Quoc V. Le and Denny Zhou at Google Research. Presented at the NeurIPS 2022 conference.

The definition

The paper defines a chain of thought as “a series of intermediate natural language reasoning steps that lead to the final output”. Each example in the prompt has three parts: the question, the chain of thought, and the answer.

The authors list four things they like about it:

  • It lets the model break a problem into steps.
  • It gives a window into how the model reached its answer.
  • It works for maths, common sense and symbol puzzles alike.
  • It needs no retraining, only examples in the prompt.
How it was tested
  • The authors wrote eight worked examples by hand and reused the same eight across almost all the maths tests.
  • No model was retrained at any point.
  • They tested several model families, including GPT-3 and Google’s PaLM, in sizes from 350 million to 540 billion parameters.
It only works on big models
  • The paper calls the effect “an emergent ability of model scale”. It helped only on models of roughly 100 billion parameters or more.
  • Smaller models wrote working that sounded fluent but did not make sense, and sometimes scored worse than with no working at all.
  • The gains were largest on the hardest problems. On the easiest one-step problems there was little or no gain.
The limits the authors list
  • In their words, this “does not answer whether the neural network is actually reasoning”. They leave that as an open question.
  • There is no guarantee the working is correct, and wrong working can still land on a right answer.
  • Because it needs very large models, it is expensive to use in real products.
Words the paper uses
  • Prompting: steering a model with the text you give it, not by retraining it.
  • Few-shot exemplars: the handful of examples placed in the prompt. See the GPT-3 paper.
  • Standard prompting: examples that show only the question and the answer.
  • Emergent ability: something that appears only once models are large enough.

Next paper: InstructGPT