Back

Takeaways: Chain-of-Thought Prompting Elicits Reasoning in Large Language Models

Story · 7 cards

There'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.

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary1/17

From the paperStory 1/7

A problem for a child. The AI failed it.

"The cafeteria had 23 apples. If they used 20 to make lunch and bought 6 more, how many apples do they have?" The model replied confidently: 27. Not because it can't count. Because its example showed only a bare answer.

Source: Fig. 1

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary2/17

From the paperStory 2/7

Same model. One change to the example.

Instead of "The answer is 11" the authors wrote: "Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11." The model picked up the pattern: 23 − 20 = 3, 3 + 6 = 9. The answer is 9. Correct.

Source: Fig. 1

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary3/17

From the paperStory 3/7

A record fell without a single hour of training.

On a math word-problem test the score jumped from 17.9% to 56.9%. The previous record, 55%, required finetuning a model. Here, eight examples with reasoning were enough. The authors stress it: no model was finetuned.

Source: Table 1, abstract, discussion

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary4/17

From the paperStory 4/7

This trick has a catch. It doesn't work on small models.

The gains appear only around 100B parameters. Smaller models write fluently but make no sense — and do worse than without the trick. If you run a small model locally, "think step by step" can hurt you.

Source: Sec. 3.2, appendix

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary5/17

From the paperStory 5/7

Giving the model more time isn't enough. Order is what matters.

The authors tested substitutes. An equation alone — didn't help. Dots instead of thinking — nothing. A justification written after the answer — nothing either. Only one thing works: reasoning first, answer second.

Source: Sec. 3.3, Fig. 5

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary6/17

From the paperStory 6/7

It beat a sports fan. On their home turf.

Does a sentence about sports make sense? The model with reasoning got it right 95.4% of the time. An unaided sports enthusiast — 84%. The same method also set a record on questions that need a strategy: 75.6% vs 69.4%.

Source: Sec. 4

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary7/17

ImagineStory 7/7

You don't need perfect examples. You need to show the way.

Imagine asking an AI about your household budget. Before your question, paste one example worked out step by step. The style doesn't matter: three of the authors wrote examples their own way and every version clearly beat the standard prompt.

Source: Based on Sec. 3.4

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary8/17

Strategy

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.

"Task: If I have 5 apples and I eat 2, and then buy 3 more, how many do I have? Describe your decision process step by step before finally stating the result (e.g. 'At first: 5. After eating 2: 5-2=3. After buying 3: 3+3=6')."

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary9/17

Strategy

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".

"Question: John has 3 cats. He buys 2 more. How many cats does he have? Reasoning: John started with 3 cats. Adding 2, he has 3+2=5. Answer: 5. Question: Anna has 10 dogs. She gave away 3. How many dogs does she have left? Reasoning:"

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary10/17

Strategy

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.

"Solve this company's complex financial equation. Don't give the final result right away. Write out each stage of your mathematical calculations on a separate line of text."

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary11/17

Good practice

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).

Choose the most powerful paid base models for hard engineering tasks instead of smaller free alternatives, if you care about using CoT reasoning.

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary12/17

Good practice

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.

Writing out every analytical step in a legal process. If the conclusion is wrong, reading the prompt makes it easy to point to the legal article where the AI made an interpretation error.

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary13/17

Good practice

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.

If you ask the model to solve a complicated sorting algorithm, put in the prompt an example of solving a different algorithm step by step, and not, say, an example from analytical chemistry.

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary14/17

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.

Firing off an elaborate prompt demanding in-depth analysis on a very lean model running locally on a phone.

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary15/17

Avoid

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.

"Sum up the revenues from all quarters, subtract the 19% tax and labor costs and give me here only the final payout amount, immediately."

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary16/17

Avoid

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.

Sending data to an expensive fine-tuning process, when a plain chat message: "Solve a similar task based on these 5 described steps of the procedure" would have delivered 90% accuracy at no extra cost.

Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
Summary17/17