Skip to content

Chain-of-Thought

Summary

Chain-of-Thought — a prompting technique where the model is asked to reason step-by-step. It first writes intermediate steps and then provides the final answer.

What it is

Usually, the model tries to give an immediate answer. Chain-of-Thought (CoT) changes this behavior: the model first explains how it thinks and then answers.

This helps with tasks that require several logical steps: math, analysis, comparison, programming.

How it works

Instead of:

What is 15% of 240?

You ask:

What is 15% of 240?
Reason step by step and explain each step.

The model responds:

1. 1% of 240 is 2.4.
2. 15% is 15 × 2.4.
3. 15 × 2.4 = 36.
Answer: 36.

Types of Chain-of-Thought

Zero-shot CoT

We simply add the phrase:

Think step by step.

The model builds the chain of reasoning on its own.

Few-shot CoT

We show an example problem with a detailed solution, and then give our own task. The model repeats the format of reasoning.

When CoT helps

  • mathematical problems;
  • comparing several options;
  • text analysis;
  • writing code;
  • tasks where sequence matters.

Limitations

  • the answers get longer;
  • every step spends tokens;
  • the model may reason confidently and incorrectly;
  • for simple tasks CoT can be excessive.

See also