Papers · arXiv 2201.11903
Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary in three lines
- 🎯 Standard few-shot prompting fails to perform complex multi-step reasoning (arithmetic, commonsense, symbolic) and exhibits flat scaling curves.
- 🔧 Augmenting few-shot exemplars with a chain of thought—a natural language sequence of intermediate reasoning steps—before predicting the final answer.
- 📈 PaLM 540B with 8 chain-of-thought exemplars reached 56.9% accuracy on GSM8K (58.6% with an external calculator), outperforming finetuned GPT-3 with a verifier.
Abstract
We explore how generating a chain of thought -- a series of intermediate reasoning steps -- significantly improves the ability of large language models to perform complex reasoning. In particular, we show how such reasoning abilities emerge naturally in sufficiently large language models via a simple method called chain of thought prompting, where a few chain of thought demonstrations are provided as exemplars in prompting. Experiments on three large language models show that chain of thought prompting improves performance on a range of arithmetic, commonsense, and symbolic reasoning tasks. The empirical gains can be striking. For instance, prompting a 540B-parameter language model with just eight chain of thought exemplars achieves state of the art accuracy on the GSM8K benchmark of math word problems, surpassing even finetuned GPT-3 with a verifier.
Reading guide
Problem and motivation
Standard few-shot prompting gives language models input–output exemplars, enabling strong performance on many direct question-answering tasks. However, on multi-step reasoning tasks—such as grade school arithmetic, multi-hop commonsense questions, and symbolic manipulations—simply scaling model size under standard prompting often yields flat scaling curves and poor performance. Prior approaches that attempted to solve multi-step problems relied either on training/fine-tuning specialized rationale models (which require large amounts of expensive supervised rationale data) or formal neuro-symbolic representations. The paper investigates whether general-purpose language models can execute multi-step reasoning entirely in-context without any parameter updates.
Key ideas
- Chain-of-Thought Decomposition: Humans decompose complex problems into sequential reasoning steps before stating an answer. Language models can mimic this behavior when guided by in-context demonstrations structured as triples: .
- Emergence at Scale: Chain-of-thought (CoT) prompting does not provide meaningful improvements—and often degrades performance—for small models ( parameters). It emerges as an effective capability only in models with parameters or more.
- Variable Intermediate Computation: Generating natural language tokens allows the model to dynamically allocate additional compute (via autoregressive token generation) to harder multi-step problems, which direct answer prediction cannot do.
Method (with the key equations)
The method modifies the few-shot prompting paradigm. Rather than prompting with input–output pairs :
where the model directly computes , chain-of-thought prompting inserts a natural language reasoning chain before the final answer:
At inference time for a test input , the model autoregressively generates both the reasoning chain and the answer:
For arithmetic benchmarks, the authors also evaluate a post-hoc external calculator extension: mathematical equations generated within are evaluated using Python's eval, propagating results forward via string matching to prevent arithmetic calculation slips.
Results (with the most important numbers)
- Arithmetic Reasoning (GSM8K): On GSM8K, standard prompting on PaLM 540B achieves 17.9%, whereas 8-shot CoT prompting achieves 56.9% (and 58.6% with an external calculator), surpassing the prior supervised best of 55% from finetuned GPT-3 175B with a verifier. Codex achieves 63.1% (65.4% with calculator).
- Other Math Benchmarks: PaLM 540B reaches 79.0% on SVAMP (vs. 69.4% standard), 73.9% on ASDiv (vs. 72.1% standard), 35.8% on AQuA (vs. 25.2% standard), and 93.3% on MAWPS (vs. 79.2% standard).
- Commonsense Reasoning: PaLM 540B CoT establishes a new state of the art on StrategyQA at 75.6% (vs. 68.6% standard and 69.4% prior supervised best) and outperforms human sports enthusiasts on Sports Understanding (95.4% vs. 84.0%).
- Symbolic Manipulation & Length Generalization: On last-letter concatenation, PaLM 540B moves from 7.6% (standard) to 99.4% (CoT) in-domain (2 words). When tested out-of-domain on 4 words, standard prompting drops to 0.0%, while CoT retains 63.0% accuracy.
- Ablations: Ablations on LaMDA 137B confirm that "equation only" prompting (5.4% on GSM8K), "variable compute only" via dots (6.4%), and "reasoning after answer" (6.1%) fail to match standard CoT prompting (14.3%), demonstrating that intermediate natural language steps prior to the answer are essential.
Limitations and open questions
- Not Guaranteed to Reason Factually: Generated chains can be unfaithful, semantically flawed, or hallucinated, sometimes arriving at the right answer by coincidence (especially in binary or multiple-choice formats).
- Model Scale Constraint: The technique is expensive to serve in production environments because it requires models with parameters to work reliably.
- Open Question of True Reasoning: The paper notes that imitating human rationales does not prove that underlying neural representations execute formal reasoning.
Key terms
- chain of thought
- A coherent series of intermediate natural language reasoning steps generated prior to predicting the final answer to a problem.
- chain-of-thought prompting
- A prompting strategy where few-shot exemplars are formatted as input, intermediate reasoning chain, and output triples without updating model weights.
- emergent ability
- A capability that is absent or detrimental in smaller language models and only appears when model scale surpasses a threshold (around 100B parameters).
- GSM8K
- A benchmark of 1,319 high-quality, multi-step grade school math word problems requiring 2 to 8 arithmetic steps to solve.
- standard prompting
- The standard few-shot in-context learning setup where demonstrations consist solely of input and final output pairs.
- length generalization
- The ability of a model to succeed at test time on reasoning chains that contain more steps or larger sequence lengths than demonstrated in the few-shot exemplars.
- external calculator
- A post-hoc evaluation mechanism that extracts equations from the generated chain of thought, executes them with Python's eval, and updates downstream text.
- variable compute
- The allocation of variable numbers of intermediate generation tokens to allow more computation on harder problems.
Questions
Why does chain-of-thought prompting fail for small language models?
Models below ~10B parameters typically generate fluent but illogical or repetitive chains of thought and struggle with basic symbol mapping and arithmetic, leading to lower performance than direct answering.
How sensitive is chain-of-thought prompting to prompt wording and annotators?
While exact accuracy varies across annotators and prompt styles, experiments across three independent annotators and random samples from GSM8K show that all CoT variants consistently outperform standard prompting by large margins.
Does generating an equation directly provide the same benefit as natural language reasoning?
No. On complex datasets like GSM8K, equation-only prompting achieves only 5.4% accuracy on LaMDA 137B compared to 14.3% with CoT, because the semantic translation into a single equation is too challenging without intermediate natural language steps.
Can chain of thought help language models generalize to longer inputs than seen in prompts?
Yes. On symbolic tasks like last-letter concatenation and coin flip, CoT enables models like PaLM 540B to generalize to 3-step and 4-step out-of-domain inputs when prompts only demonstrate 2-step sequences.
The overview on this page was written by AI from the paper and may contain mistakes. Read the paper for the details.