liveBook · Manning

Chain-of-thought prompting

As explained in Introduction to Generative AI, Second Edition

Chain-of-thought prompting is a technique that elicits intermediate reasoning steps before a model produces its final answer.

If a model rushes to answer a word problem, asking it to work step by step may help. Chain-of-thought prompting encourages a model to produce intermediate reasoning before its final answer, rather than jumping straight to a conclusion. A simple prompt is “Let’s think step by step.” This has improved performance on some reasoning problems, including math and logic tasks, but it is not a universal fix. section 7.4 section 2.14

A word problem

Asked how many apples someone has after starting with three and buying five more, a prompted model might state the starting amount, add five, and then answer eight. The intermediate steps make the route to the answer explicit; the answer still needs checking. section 7.4

This is a change to the prompt, not a fine-tuning step. It can be useful with models that do not already reason internally, or when an answer is prematurely shortened or oversimplified. Modern reasoning models may instead generate extended chains of thought as part of answering a question, without needing the same nudge. Their internal reasoning should not be confused with steps a model displays to a user. section 2.14 section 7.4 section 2.7

Table 7.3 Common advanced prompting techniques

Technique

Description

Example prompt

Chain-of-thought

Generate step-by-step reasoning before answering

“Let’s think step by step. John has 3 apples . . .”

Tree-of-thought

Explore multiple reasoning paths in parallel

“List three strategies, evaluate each, then choose the best.”

Self-consistency

Generate multiple reasoning chains and aggregate

“Generate five solutions, then select the most common answer.”

Reflexion

Critique and revise output iteratively

“Review your answer for errors and revise if needed.”

Verification

Add a final self-check before finalizing the response

“Double-check your answer for accuracy before submitting.”

Decomposition

Break the problem into subtasks executed sequentially

“Step 1: Extract metrics. Step 2: Summarize trends. Step 3: Write summary.”

Least-to-most

Solve easier subproblems first, then build up

“First, list known variables. Then calculate step by step.”

Pyramid priming

Build knowledge gradually in layers

“Step 1: Define carbon neutrality. Step 2: List targets. Step 3: Analyze impact.”

Generated knowledge

Surface key facts before answering

“List key concepts related to quantum entanglement before answering.”

Role-based prompting

Assign a role or persona to guide behavior

“You are an experienced employment lawyer advising a client.”

Prompt chaining

Connect multiple prompts into a pipeline

“Extract relevant quotes → Summarize → Generate final answer.”

Conversational context

Summarize prior dialogue to preserve coherence

“Summarize the student’s understanding before proceeding.”

Compare a single step-by-step chain with techniques that explore multiple paths, revise an answer, or add a final check. section 7.4

How Introduction to Generative AI, Second Edition covers it

How deep it goes
Defines the prompting move and works through a simple example, while leaving reasoning-model internals undisclosed.
Examples
Uses an apple-addition word problem and a four-line rhyming poem to contrast prompted steps with extended model reasoning.
What it assumes
Introduces the technique through an everyday arithmetic question without requiring an explanation of model internals.
What you can do after
Practice/perform step-by-step prompting when an answer is rushed or oversimplified, while checking whether it actually helps.
How it connects
Connects chain-of-thought prompting to zero-shot prompting, few-shot prompting, tree-of-thought prompting, self-consistency prompting, and reasoning models.

Also explained in

Compare how 18 books explain chain-of-thought prompting →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Introduction to Generative AI, Second Edition. The section links point to the parts of the book it draws on.