Chain-of-thought (CoT) prompting decomposes a complex task into intermediate natural-language reasoning steps before producing an answer. Each prompt and response builds on the previous one, helping a language model refine its approach instead of responding in one pass. section 6.4.5
Use CoT prompting to:
- Break complex questions into smaller, manageable steps. section 6.4.5
- Improve accuracy and reliability for question answering, translation, and code generation. section 6.4.5
- Inspect intermediate responses to understand an approach or help debug mistakes. section 6.4.5
- Choose between zero-shot CoT and few-shot CoT depending on whether worked examples are supplied. section 6.4.5
Worked proportional-reasoning prompt
Ask: “Solve this problem and think it through step by step. If x = 80 and y = 60, what is x when y = 30?” The response establishes a proportion, substitutes the known values, calculates x = 40, and states the result. A few-shot prompt can instead demonstrate this reasoning format with solved arithmetic examples before presenting a new question. section 1.3.5 section 6.4.5
Listing 6.4 Few-shot CoT prompt example
... Q: There were nine computers in the server room. Five more computers were installed each day, from monday to thursday. How many computers are now in the server room? A: There are 4 days from monday to thursday. 5 computers were added each day. That means in total 4 * 5 = 20 computers were added. There were 9 computers initially, so now there are 9 + 20 = 29 computers. The answer is 29. Q: Michael had 58 golf balls. On tuesday, he lost 23 golf balls. On wednesday, he lost 2 more. How many golf balls did he have at the end of wednesday? A: Michael initially had 58 balls. He lost 23 on Tuesday, so after that he has 58 - 23 = 35 balls. On Wednesday he lost 2 more so now he has 35 - 2 = 33 balls. The answer is 33. Q: Olivia has $23. She bought five bagels for $3 each. How much money does she have left? A: She bought 5 bagels for $3 each. This means she spent $15. She has $8 left. Q: When I was 6 my sister was half my age. Now I'm 70 how old is my sister? A:
Inspect a few-shot CoT prompt that demonstrates intermediate arithmetic reasoning before asking the model to solve a new problem. section 6.4.5
Treat CoT as an iterative prompt-engineering technique rather than a guarantee of correctness. Responses may be inconsistent, prompts may overfit examples, and quality can be difficult to quantify. Production use should also account for prompt injection and other model limitations. section 6.9 section 6.9

















