Skip to content
AI & Machine Learning

Chain-of-Thought Prompting

Definition

Chain-of-thought prompting asks a model to work through intermediate reasoning steps before giving its answer, which improves accuracy on multi-step problems such as math, logic and planning.

Diagram

Question: A team buys 3 boxes of 12 pens, hands out 7, then splits the rest equally between 2 offices. How many pens does each office get?

Answer directly

Each office gets 18 pens.

Wrong: a plausible-looking guess with no working.

Think step by step

  1. 3 boxes × 12 = 36 pens
  2. 36 − 7 handed out = 29 pens
  3. 29 ÷ 2 = 14.5, so 14 each, with 1 left over

Right, and the steps show its working.

Writing out intermediate steps gives the model room to work through the problem before committing to an answer, and lets you see where it went wrong when it does. It costs more tokens and time, so use it for multi-step problems, not simple lookups. The answers here are illustrative.

Case study

Worked example