1.13.6
Chain-of-Thought Prompting
What is it?
Chain-of-Thought (CoT) prompting encourages a model to handle a problem through multiple reasoning steps instead of jumping directly to an answer. It is useful for tasks involving calculations, logic and multi-step problem solving.
Key points
Zero-shot CoT adds a reasoning instruction such as Think step by step. Few-shot CoT provides examples with reasoning steps. Self-consistency samples multiple reasoning paths and compares final answers. Tree of Thoughts explores multiple reasoning branches. Plan-and-Solve separates planning from execution. ReAct combines reasoning with actions and tool use. CoT can add unnecessary tokens and latency for simple tasks.
Solving a Multi-Step Calculation
Question: A shop has 45 apples. It sells 3/5 in the morning and 1/3 of the remaining apples in the afternoon. A stepwise solution calculates 27 sold in the morning, 18 remaining, 6 sold in the afternoon and 12 apples left.
Real-world application
Use multi-step reasoning approaches for mathematical problems, planning, complex analysis and tasks that require several dependent decisions. Use them selectively rather than for simple formatting or classification.
Key takeaway
Chain-of-Thought techniques break complex problems into steps, but they are not necessary for every task.