The AI Handbook Open in the app →

Chain-of-Thought Prompting

Inference & Prompting · Intermediate · 4 min read

What is it?

Chain-of-thought prompting asks a model to reason step by step before answering, which improves accuracy on problems that need multiple steps.

Explain like I'm 5

It's like asking someone to show their work instead of blurting an answer. Working through the steps out loud leads to fewer mistakes.

Why was it created?

Models often rushed to a final answer and got multi-step problems wrong. Prompting them to lay out intermediate steps was found to unlock much better reasoning.

Where is it used?

  • Math and logic problems
  • Multi-step planning
  • Data extraction with reasoning
  • Agent decision-making

Why should developers care?

It's one of the simplest, most effective prompting techniques — a few extra words can noticeably improve results on math, logic, and planning tasks.

How does it work?

Instead of asking only for the answer, the prompt invites the model to produce intermediate reasoning steps (e.g. 'think step by step'). Generating those steps conditions the final answer on its own worked-out reasoning, reducing shortcut errors.

Real-world example

For a word problem, 'Let's think step by step' makes the model lay out each calculation, arriving at the correct total instead of guessing.

Common use cases

  • Arithmetic and word problems
  • Logical deduction
  • Breaking a task into sub-steps
  • Explaining a decision

Advantages

  • Big accuracy gains on multi-step tasks
  • Simple to apply — just prompt for it
  • Makes reasoning inspectable
  • Works with most capable models

Disadvantages

  • Longer, costlier outputs
  • Reasoning shown may not be the true cause
  • Can expose or invent flawed logic
  • Less helpful on simple lookups

When should you use it?

For problems that need several steps — math, logic, planning, or careful extraction.

When should you avoid it?

For simple factual lookups or latency-sensitive calls where the extra reasoning isn't worth the cost.

Alternatives

Direct (answer-only) promptingFew-shot examplesSelf-consistency (sampling multiple chains)

Related terms

Prompt EngineeringLarge Language ModelInferenceAI Agent

Interview questions

Beginner

  • What does chain-of-thought prompting ask the model to do?
  • Give a phrase that triggers step-by-step reasoning.

Intermediate

  • Why does showing steps improve multi-step accuracy?
  • What is the cost trade-off of CoT?

Senior

  • How does self-consistency build on chain-of-thought?
  • Why might a model's stated reasoning not reflect its actual computation?

Common misconceptions

  • "The shown steps are the model's real internal reasoning" — they're generated text and can be post-hoc.
  • "CoT helps every task" — it mainly helps multi-step problems, not simple lookups.

Fun facts

  • Just adding 'let's think step by step' measurably boosted reasoning in early studies (zero-shot CoT).
  • Sampling several chains and voting (self-consistency) improves results further.

Timeline

  • 2022 — Chain-of-thought prompting formalized
  • 2022 — Self-consistency and zero-shot CoT follow

Learning resources

Quick summary

Chain-of-thought prompting has a model reason step by step before answering, sharply improving accuracy on multi-step problems.

Cheat sheet

  • Ask the model to show its steps
  • Big gains on math/logic/planning
  • Longer, costlier answers
  • Shown steps aren't always the real reason

If you remember only one thing

Ask a model to 'think step by step' and it makes far fewer mistakes on problems that need more than one step.

Further reading