Last updated:
Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Jason Wei et al.
In collections: Reasoning AI at work
Story · 7 cardsThere's a way to stop AI making mistakes in simple math. And it isn't retraining the model.It's one example in your prompt that shows the reasoning. Once the model sees how you reach an answer, it does the same.See the story →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, in which a few chain-of-thought demonstrations are provided as examples in the prompt.
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 example, prompting a language model with 540 billion parameters with just eight chain-of-thought examples achieves state-of-the-art accuracy on the GSM8K benchmark of math word problems, surpassing even a fine-tuned GPT-3 model with a verifier.
Strategies from the report
Applying Chain-of-Thought (CoT): This strategy consists of using a suitably constructed prompt to make the model generate a whole sequence of logical steps before giving the final answer. It imitates the human way of systematically analyzing complicated "System 2" problems.
Learning from a few examples with reasoning (Few-Shot CoT): Instead of providing only pairs of questions and answers (Q&A), the query itself supplies the model with full examples of reasoning processes. The AI then learns to copy the format of the "path to the goal".
Allocating computing power in tokens: By getting the model to generate intermediate computational steps, we in practice force it to devote more resources (generated "tokens") to untangling a given problem. As a result, the model copes better with math and logic.
Good practices
Using the largest available models: The CoT technique gives excellent, even striking results, but it depends mainly on the scale of the model. These abilities become very pronounced in huge LLM networks (e.g. above 100 billion parameters).
Preserving the interpretability of the path (Debugging AI): Generating intermediate steps gives insight into why the model gave exactly that answer. Use this practice as a tool for auditing results and making quick corrections.
Substantive consistency of examples inside the prompt: Tasks used as demonstrations (in the few-shot method) must match the type of the target problem. For a logic task show logic, for arithmetic – arithmetic equations.
What to avoid?
Using CoT in small, basic language models: When told to "think step by step", smaller models more often produce very smooth and convincing, yet completely logically incorrect reasoning, which further lowers the correctness of the results.
Using "Standard Prompting" for complex problems: Never expect the model to give, right away and in the first line of text, a flawless result of a difficult multi-step calculation while skipping the path of computation.
Jumping into expensive model fine-tuning (Fine-Tuning): Before incurring the cost of preparing thousands of training examples for a task, always avoid skipping the test phase, in which you check whether adding just 8 "chain-of-thought" examples to the prompt wouldn't solve the problem just as well.
Support this project by buying me a coffee ;)