Chain-of-thought prompting guides a language model through a sequence of natural reasoning steps before it produces a final answer. It decomposes complex problems into intermediate steps, helping the model connect a question’s semantics to its conclusion rather than mapping the input directly to one answer. section 4.2.3
Use the technique when:
- Provide a few worked reasoning demonstrations for multistep tasks such as text-based arithmetic and commonsense reasoning. section 4.2.3
- Prefer intermediate reasoning over showing only a correct answer when the model must translate several semantic relationships into an equation or conclusion. section 4.2.3
- Separate reasoning from the conclusion when downstream systems need controlled, machine-readable output for verification, grading, or refinement. section 4.2.4
- Improve robustness by sampling multiple reasoning paths and selecting the most frequent final result through self-consistency. section 4.2.4
Arithmetic commonsense reasoning
For a question about Roger starting with 5 balls and receiving two cans of 3 tennis balls, a direct answer says “The answer is 11.” A CoT demonstration instead states: “Roger started with 5 balls, 2 cans of 3 tennis balls each is 6 tennis balls. 5 + 6 = 11.” The intermediate calculation links the wording to the result. section 4.2.3
Structured chain of thought
Define a Pydantic schema with separate `chain_of_thought` and `final_answer` fields, then use Instructor with an OpenAI client to request a response matching that schema. Printing the two fields keeps reasoning and conclusion distinct and auditable. section 4.2.4
Figure 4.7 How CoT prompting enables LLMs to tackle complex tasks such as arithmetic commonsense reasoning. The processes for CoT are highlighted. Image is taken from [1].
Compare standard prompting with CoT prompting as the reasoning path transforms a complex arithmetic or commonsense task into intermediate steps and a final answer. section 4.2.3

















