Lesson 9.1 · 23 min · video lesson
Chain-of-Thought Prompting: Making Models Reason Step by Step
Why does adding one sentence, “Let's think step by step”, make a language model noticeably better at word problems?
In short: Chain-of-Thought (CoT) prompting asks a language model to write out its intermediate reasoning before giving the final answer. Because every generated token is extra computation the model can build on, writing the steps down turns one hard leap into many small, easier steps. We can trigger it with a short instruction (zero-shot) or with worked examples (few-shot), and we can make it more reliable by sampling several chains and taking a vote.
What you will learn
- What is a prompt?
- What is an LLM?
- The problem: when the model jumps straight to the answer
- What is Chain-of-Thought (CoT) Prompting?
- A simple example without CoT and with CoT
- Zero-shot CoT vs Few-shot CoT
- A step-by-step walkthrough of a reasoning chain
- Why does Chain-of-Thought Prompting work?
- Where Chain-of-Thought Prompting is useful
- Things to keep in mind
In this lesson
- First, what is a prompt and what is an LLM?
- The problem: when the model jumps straight to the answer
- What is Chain-of-Thought prompting?
- Zero-shot CoT vs Few-shot CoT
- A step-by-step walkthrough of a reasoning chain
- Why does Chain-of-Thought prompting work?
- Code you can run: building CoT prompts and voting
- Where Chain-of-Thought prompting is useful
- Things to keep in mind
- Common mistakes and how to spot them
- Practice: try it yourself
Key terms in this lesson
- Prompt
- The text we give an LLM as its starting point: instructions, examples, data and the question.
- Chain-of-Thought (CoT)
- A prompting technique where the model writes intermediate reasoning steps before its final answer.
- Zero-shot CoT
- Triggering reasoning with an instruction such as “Let's think step by step”, without examples.
- Few-shot CoT
- Triggering reasoning by including worked examples that show the reasoning format.
- Self-consistency
- Sampling several reasoning chains and returning the most common final answer.
- Faithfulness
- Whether a model's written reasoning truly reflects the process that produced its answer.
This lesson is part of the Generative AI Engineering and Complete AI Engineer tracks. See plans and pricing to open the full lesson, its video, labs and quiz, or try the free lesson first (free account needed).
← 8.11 GRPO: Group-Based Preference Optimization Explained · 9.2 Prompt Chaining: Decomposing Complex Tasks into Steps →