Paper · 2022-01-28 · cs.CL, cs.AI
Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Prompts a language model with few-shot exemplars whose answers include a written chain of intermediate reasoning steps, with no finetuning. Above roughly 100B parameters this lifts arithmetic, commonsense and symbolic reasoning accuracy; PaLM 540B reaches 56.9% on GSM8K (standard prompting 17.9%), author-reported.
Chain-of-thought promptingIn-context learningEmergent abilitiespromptingreasoningfew-shotevaluation
arXivPDFCodeMarkdown8 min read
AI-compiled by claude-haiku-5-5 on 2026-10-19, not yet reviewed by a human. Every claim cites its source; check it when a detail matters.
In plain words
Large language models can answer a question straight away, but they often get multi-step problems wrong that way. This paper shows that if you show the model a few worked examples in which the answer comes after a short written explanation of the steps, the model starts writing its own explanations for new questions and gets more of them right. Nothing is retrained: the examples go into the prompt, and the model continues the pattern.
The effect depends on size. Small models write fluent but muddled steps and do no better, or worse, than when asked for the answer directly. Only the largest models in the study gained clearly. The paper tests math word problems, common-sense questions and simple symbol tasks.
TL;DR
- Few-shot prompts whose exemplars contain a natural-language chain of thought before the answer; the model is not finetuned §2 app. E.2.
- Gains appear only at about 100B parameters and above; smaller models often do not benefit §3.2 app. A.
- PaLM 540B with 8 exemplars reaches 56.9% on GSM8K against 17.9% for standard prompting, author-reported app. B.
- Results are sensitive to exemplar wording and annotator; the authors say prompt engineering still matters app. A.
- Implement the prompt format exactly, use greedy decoding, and budget for the output tokens: the chains are long §3.1 app. G.
Problem
Standard few-shot prompting, which shows input-output pairs with no reasoning, works poorly on multi-step reasoning and often does not improve much with model scale §1. Rationale-based training or finetuning needs many expensive human-written rationales §1 §6.
Method
Chain-of-thought prompting augments each few-shot exemplar with a chain of thought: a short sequence of intermediate natural-language reasoning steps that leads to the answer. The exemplar is an input, a chain and an output §2 fig. 1. The prompt is the list of exemplars followed by the test input, and the model writes the chain and the answer for the test input §3.1.
The baseline, standard prompting, uses the same exemplars with the answer only §3.1 fig. 1.
For math word problems the paper uses eight hand-written exemplars for every dataset except AQuA, which uses four exemplars from the training set §3.1 app. G. Each chain is written in the exemplar text and ends with the phrase "The answer is N." app. G. The exact exemplar texts are in app. G.
Decoding is greedy, so each test question gets one completion §3.1.
The paper describes three ablations of the chain for math problems. Equation-only asks for just the equation. Variable compute asks for a string of dots as long as the equation. Chain-after-answer places the chain after the answer §3.3. The first is the hypothesis that the equation alone explains the gain.
# Chain-of-thought prompting [§2] [§3.1] [app. G]
# Input: exemplars: list of (question, chain, answer) triples
# test_question: string
# Output: predicted answer (string)
def chain_of_thought_predict(model, exemplars, test_question):
# Concatenate each exemplar as question, then chain, then answer [app. G]
prompt = ""
for question, chain, answer in exemplars:
prompt += "Q: " + question + "\n"
prompt += "A: " + chain + " The answer is " + answer + ".\n"
# Append the test question; the model writes the chain and answer [§3.1]
prompt += "Q: " + test_question + "\n"
prompt += "A:"
# Decoding is greedy: one completion, no sampling [§3.1]
completion = model.generate(prompt, decoding="greedy")
# Extracting the final answer from the completion is not stated in the
# paper; a parser must be written. [§3.1]
return parse_final_answer(completion)Hyperparameters
| Name | Value | Where | Notes |
|---|---|---|---|
| Exemplars, math (except AQuA) | 8, hand-written | §3.1 app. G | Same set used for GSM8K, SVAMP, ASDiv and MAWPS |
| Exemplars, AQuA | 4, from training set | §3.1 app. G | Multiple choice |
| Exemplars, CSQA | 7 | app. G | Randomly chosen training items, hand-written chains §4 |
| Exemplars, StrategyQA | 6 | app. G | Randomly chosen training items, hand-written chains §4 |
| Exemplars, Date and Sports (BIG-bench) | Date: 6 in prompt file; Sports: 8 | §4 app. G | Text says "the first ten examples" of the evaluation set; see Pitfalls |
| Exemplars, SayCan | 6 from the SayCan training set | §4 | Chains hand-written §4 |
| Exemplars, last-letter concatenation | 4 two-word names | §5 app. G | Test on 3 and 4 words |
| Exemplars, coin flip | 8 | §5 app. G | Test on 3 and 4 flips |
| Decoding | greedy | §3.1 | No sampling; max output length not stated |
| Temperature, top-p, max tokens | not stated | §3.1 | |
| Exemplar orders | LaMDA: 5 random shuffles (seeds); other models: one order | §3.1 | Std. dev. reported for LaMDA 137B app. B |
| LaMDA sizes | 422M, 2B, 8B, 68B, 137B | §3.1 | |
| PaLM sizes | 8B, 62B, 540B | §3.1 | |
| GPT-3 models | four API models, one per size tier: the ada, babbage, curie and davinci-002 variants | §3.1 | Presumed InstructGPT 350M, 1.3B, 6.7B, 175B ("presumably", not confirmed) |
| Other models | UL2 20B; Codex (code-davinci-002) | §3.1 | Added in version 5 app. E |
| Hardware | LaMDA: TPU v3 (8x8); PaLM: TPU v4 (4x4x12); GPT-3: public API | app. E.2 | Inference only |
| Finetuning | none | §6 app. E.2 | Only prompting |
Results
Author-reported. Setup: greedy decoding, the exemplar sets in Hyperparameters, and the models listed there. Accuracy in percent. Standard prompting and chain-of-thought (CoT) are compared at the same model size.
Arithmetic, PaLM 540B app. B:
| Setting | Metric | Baseline | This paper | Source |
|---|---|---|---|---|
| GSM8K | accuracy | 17.9 | 56.9 | app. B |
| SVAMP | accuracy | 69.4 | 79.0 | app. B |
| ASDiv | accuracy | 72.1 | 73.9 | app. B |
| AQuA | accuracy | 25.2 | 35.8 | app. B |
| MAWPS | accuracy | 79.2 | 93.3 | app. B |
Arithmetic, other models on GSM8K app. B:
| Model | Baseline | This paper | Source |
|---|---|---|---|
| GPT-3 175B | 15.6 | 46.9 | app. B |
| Codex | 19.7 | 63.1 | app. B |
| LaMDA 137B (mean of 5 seeds) | 6.5 | 14.3 | app. B |
Headline on GSM8K: PaLM 540B with CoT is reported as new state of the art, above a finetuned GPT-3 with a verifier [abstract] §3.2. Prior-best numbers are given in the caption of fig. 4, which cites Cobbe et al. (2021) and Jie et al. (2022); the values are not transcribed in this card.
Commonsense, PaLM 540B app. B:
| Task | Baseline | This paper | Source |
|---|---|---|---|
| CSQA | 78.1 | 79.9 | app. B |
| StrategyQA | 68.6 | 77.8 | app. B; text gives 75.6 §4 |
| Date understanding | 49.0 | 65.3 | app. B |
| Sports understanding | 80.5 | 95.4 | app. B; unaided sports enthusiast 84% §4 |
| SayCan | 80.8 | 91.7 | app. B |
Symbolic, PaLM 540B app. B:
| Task | Baseline | This paper | Source |
|---|---|---|---|
| Last-letter, 2 words (in-domain) | 7.6 | 99.4 | app. B |
| Last-letter, 3 words (OOD) | 0.2 | 94.8 | app. B |
| Last-letter, 4 words (OOD) | 0.0 | 63.0 | app. B |
| Coin flip, 2 flips (in-domain) | 98.1 | 100.0 | app. B |
| Coin flip, 3 flips (OOD) | 49.3 | 98.6 | app. B |
| Coin flip, 4 flips (OOD) | 54.8 | 90.2 | app. B |
Ablations, LaMDA 137B on GSM8K app. B (CoT 14.3; standard 6.5):
| Variant | GSM8K | Source |
|---|---|---|
| Equation only | 5.4 | app. B |
| Variable compute only (dots) | 6.4 | app. B |
| Chain after answer | 6.1 | app. B |
Scale: CoT does not help most models below about 10B parameters app. A. Its gains show up at about 100B §3.2. The text says that for GSM8K performance more than doubled for the largest GPT and PaLM models §3.2; the per-size numbers are in app. B.
Paper vs code
The official repository is jasonwei20/chain-of-thought-prompting, owned by
author Jason Wei README.md. The README.md is a
single heading. The repository has a license file that covers only the coin-flip
and last-letter datasets, and a zip archive LICENSE_COINFLIP_LAST_LETTER. The archive was not opened in this compilation.
The repository contains no prompting, decoding or evaluation code. The prompts and the procedure are in the paper, so no discrepancy with code can be checked. The paper says PaLM and LaMDA are not public and LaMDA inputs, targets and predictions are in the supplement app. E.1.
Pitfalls
- Text and table disagree on StrategyQA. The text reports 75.6% for PaLM 540B with CoT §4; the table reports 77.8% app. B. Use the table, and check the PDF.
- Text and table disagree on LaMDA 137B SVAMP with CoT. The main table gives 37.5 app. B; the ablation table gives 36.7 app. B.
- Date understanding exemplars. The text says the first ten evaluation items are the exemplars §4; the prompt file has six exemplars app. G. Confirm the count before reusing the prompt.
- The final-answer parser is not described. The exemplars end with "The answer is N." app. G, but the extraction rule, the handling of unparsable output and the answer-matching rule are not stated.
- Exact prompt formatting is not stated. The paper does not give the separator between exemplars, the trailing whitespace or whether the test prompt ends with "A:". The pseudocode above is a sketch of the layout shown in app. G.
- Output cost. Chains add many output tokens per query. Serving cost is raised as a limitation §6. The paper gives no token counts.
- Small models get worse. Below about 10B parameters, the paper finds CoT often hurts app. A. Do not turn on CoT for small models without measuring.
- Chains can be wrong and still give the right answer. Two of 50 correct LaMDA 137B GSM8K chains were right by coincidence; 46% of 50 wrong chains were almost correct §3.2.
- Sensitivity to exemplar wording. Coin-flip accuracy for LaMDA 137B ranges from 99.6 (annotator A) to 71.4 (annotator C) app. B app. A. Prompt engineering still matters app. A. The authors could not write a working chain for a 5-item list reversal task with two annotators; a third succeeded app. A.
- Exemplar order matters for coin flip. Standard deviations are small for arithmetic, but high for coin flip app. A app. B.
- Evaluation sets used as exemplars. BIG-bench Date and Sports have no training split, so exemplars come from the evaluation set and results are reported on the remainder §4.
- Single-run results for most models. Only LaMDA is averaged over five orders; other models use one order §3.1.
- Models are not all reproducible. PaLM and LaMDA are not public; GPT-3 results can be reproduced through the public API app. E.1.
- Figure numbers are inferred. Figure numbers here follow the order of the LaTeX source. The published PDF may number them differently; check before citing a figure by number.
- Version. This card follows arXiv version 6 [raw/arxiv/2201.11903.json]. Version history lists Codex and UL2 added in version 5 and a typo fix in Figure 3 in version 6 app. E.
- Commonsense gains are small for CSQA. The paper notes that gain is minimal on CSQA §4.
Lineage
- Builds on: few-shot prompting as popularised by GPT-3 (Brown et al., 2020) §3.1; natural-language rationales for math word problems (Ling et al., 2017; Cobbe et al., 2021) §1 §7.
- Compared against: standard few-shot prompting §3.1; prior finetuned state of the art on each benchmark fig. 4.
- Follow-up named in the paper: majority vote over sampled chains (self-consistency, Wang et al., 2022) §3.1.
- Superseded by: not stated in this card's sources.
Source and license
Adapted from “Chain-of-Thought Prompting Elicits Reasoning in Large Language Models” by Jason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, Denny Zhou (arXiv:2201.11903), used under CC BY 4.0. Changes: condensed and restructured for implementation, with tables, equations and algorithms taken from the paper and its code, each cited to its source. Not affiliated with or endorsed by the authors. Code citations refer to https://github.com/jasonwei20/chain-of-thought-prompting at commit 737688c376b1 (not stated (no LICENSE at repository root; MIT for the coin-flip and last-letter datasets only)). Any quoted code is shown under that license.