- Blog
- Chain of Thought (CoT) Prompting
Chain of Thought (CoT) Prompting
Chain of Thought (CoT) Prompting
Enables complex reasoning through intermediate inference steps and can be combined with few-shot prompting.Examples:
Plaintext
`Are the sums of odd numbers in this group even: 4, 8, 9, 15, 12, 2, 1.
A: Sum all odd numbers (9, 15, 1) to get 25. Answer: False.
Are the sums of odd numbers in this group even: 15, 32, 5, 13, 82, 7, 1.
A: Sum all odd numbers (15, 5, 13, 7, 1) to get 41. Answer: False.`
Conclusion: Providing reasoning steps improves accuracy, and even a single example may suffice for large language models (an emergent capability).
Zero-Shot CoT Prompting
Guides models to reason step-by-step by adding "Let's think step by step."Example:Original Prompt:
Plaintext
I went to the market and bought 10 apples. I gave 2 apples to my neighbor and 2 apples to the repairman. Then I bought 5 more apples and ate 1. How many apples do I have left?
Output (Incorrect):
Plaintext
11 apples
Prompt with Cue:
Plaintext
`I went to the market and bought 10 apples. I gave 2 apples to my neighbor and 2 apples to the repairman. Then I bought 5 more apples and ate 1. How many apples do I have left?
Let's think step by step.`
Output (Correct):
Plaintext
First, you start with 10 apples. You gave 2 apples to your neighbor and 2 to the repairman, leaving 6 apples. Then you bought 5 apples, so now you have 11 apples. Finally, you ate 1 apple, leaving 10 apples.
Advantage: Effective without examples, suitable for scenarios with scarce demonstrations.
Automatic Chain of Thought (Auto-CoT)
Goal: Eliminate manual example creation by using LLMs to generate diverse reasoning chains automatically.Core Stages:
- Problem Clustering: Divide given problems into several clusters.
- Demonstration Sampling: Select representative problems from each cluster and generate reasoning chains using Zero-Shot CoT with simple heuristics (e.g., problem length ≤ 60 tokens, ≤ 5 reasoning steps).
Features: Builds high-quality demonstration sets through diverse problem sampling and chain generation to mitigate errors.
Code Resource: Github (functional description only, author info removed).