Chain-of-thought prompting
Chain-of-thought prompting is a technique that elicits or supplies intermediate reasoning steps to guide a model toward a final answer.
Build an Advanced RAG Application (From Scratch)
Chain-of-thought prompting is a prompting technique that encourages a language model to produce intermediate reasoning steps before an answer.
- How it is used
- Transforms retrieved hotel results into comparative, evidence-based recommendations for a travel search workflow.
- How deep it goes
- Explains CoT through step-by-step word-problem reasoning and a Python hotel-analysis prompt, without detailing model internals.
- Examples
- Uses word problems and Louvre-area hotel reviews to contrast explained reasoning with direct answers.
- What you can do after
- Apply it via an OpenAI API prompt to compare search results, identify review patterns, and produce a recommendation.
Read how Build an Advanced RAG Application (From Scratch) explains chain-of-thought prompting →
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.
- How it is used
- Guides language models through challenging problems rather than asking them to jump directly to answers.
- How deep it goes
- Defines the technique and illustrates a reasoning sequence, while noting that its usefulness varies across models.
- Examples
- Uses an apple-counting word problem and the instruction “Let’s think step by step.”
- What you can do after
- Practice prompting a language model to work through a problem before answering.
Read how Introduction to Generative AI, Second Edition explains chain-of-thought prompting →
Coding with AI
Chain-of-thought prompting is a prompting technique that guides an AI model through a problem using a sequence of intermediate reasoning steps.
- How it is used
- Uses step-by-step prompts to tackle complex development and design problems.
- How deep it goes
- Explains sequential reasoning, contextual awareness, and iterative refinement through a diagnostic prompt.
- Examples
- Uses a failing Python Docker container and an authentication architecture decision as prompting examples.
- What you can do after
- Diagnose problems with AI assistance by structuring checks and refining questions as findings emerge.
Read how Coding with AI explains chain-of-thought prompting →
AI Agents in Action, Second Edition
- How it is used
- Structures an agent’s intermediate reasoning for multistep problems and planning.
- How deep it goes
- Explains simple step-by-step instructions and a reusable problem-specific strategy, then implements them in an agent.
- Examples
- Uses time-travel calculations, a simple agent, and an exercise requiring numbered reasoning steps.
- What you can do after
- Apply chain-of-thought prompting in an agent and inspect its intermediate steps and final answer.
Read how AI Agents in Action, Second Edition explains chain-of-thought prompting →
LLM Evaluation and Alignment, The Foundational Ideas
Chain-of-thought is a model behavior and prompting technique in which intermediate reasoning steps are generated before a final answer or score.
- How it is used
- Guides complex answers and LLM-as-a-judge evaluations through intermediate reasoning before an answer or score.
- How deep it goes
- Defines the technique and illustrates evaluation steps, structured output, answer extraction, and an ablation across evaluation dimensions.
- Examples
- Uses a multiplication response and a news-summary coherence evaluation to illustrate reasoning before an answer or score.
- What you can do after
- Evaluate and understand when reasoning steps may help and why extracting the final answer requires care.
Read how LLM Evaluation and Alignment, The Foundational Ideas explains chain-of-thought prompting →
The Art of AI Product Development
Chain-of-thought is a prompting technique that elicits an intermediate sequence of reasoning steps before a model produces a final answer.
- How it is used
- Guides language models through multistep content generation and agent task planning.
- How deep it goes
- Explains decomposition and partial-solution generation, with a structured writing prompt and an agent-planning sequence.
- Examples
- Uses a tennis-ball calculation, a blog-writing prompt, a technical report, and a roadmap-planning agent.
- What you can do after
- Apply it by writing step-by-step prompts for complex content and agent planning.
Read how The Art of AI Product Development explains chain-of-thought prompting →
LLMs in Production
Chain-of-thought prompting encourages a language model to produce or use intermediate reasoning steps before giving a final answer.
- How it is used
- Uses intermediate reasoning to improve language-model performance on multistep questions, especially mathematical tasks.
- How deep it goes
- Explains zero-shot prompting, response trade-offs, evaluation, and DSPy optimization, but does not detail model-internal reasoning.
- Examples
- Demonstrates “think step by step,” GSM8K math questions, a DSPy QASignature, and optimized Llama 3 results.
- What you can do after
- Apply it via DSPy to construct, evaluate, and optimize reasoning prompts for mathematical question answering.
Read how LLMs in Production explains chain-of-thought prompting →
WordPress Power Toolkit: Harness AI to build next-level websites
Chain-of-thought reasoning is a problem-solving technique in which an AI model generates intermediate reasoning steps before producing a final answer.
- How it is used
- Guides AI toward staged answers that a user can steer and check while seeking website-design advice.
- How deep it goes
- Explains intermediate steps and gives an interactive prompt, but does not detail the model’s hidden reasoning process.
- Examples
- Uses a staged website-design prompt and sample follow-up questions about website goals and visitors.
- What you can do after
- Practice/perform it by requesting staged advice, supplying input between steps, and checking the final response.
Build AI-Enhanced Web Apps
A prompting technique that guides a language model through a single sequential reasoning path.
- How it is used
- Uses step-by-step prompts to improve reasoning and problem solving in AI-powered web applications.
- How deep it goes
- Provides a prompt-design and consistency-testing procedure, with explicit caveats about incorrect intermediate steps and conclusions.
- Examples
- Demonstrates a percentage calculation and uses a circle-area formula and worked example to illustrate prompt construction.
- What you can do after
- Apply it by structuring a prompt, requesting step-by-step explanations, and testing responses across varied inputs.
Read how Build AI-Enhanced Web Apps explains chain-of-thought prompting →
The Architecture of Reasoning
A prompting technique that asks a model to produce intermediate reasoning steps before its final answer.
- How it is used
- Makes intermediate reasoning visible before accepting a conclusion on sufficiently complex tasks.
- How deep it goes
- Defines the prompting pattern and explains its effects, without giving a prompt template or implementation procedure.
- Examples
- Uses an engineering incident where retry configuration and peak-load reconciliation—not the database symptom—revealed the root cause.
- What you can do after
- Understand how exposing intermediate reasoning can surface assumptions and weak links before a conclusion is accepted.
Read how The Architecture of Reasoning explains chain-of-thought prompting →
Prompt Engineering in Practice
A reasoning or prompting technique in which a model generates intermediate steps toward an answer.
- How it is used
- Makes multistep recommendations auditable when standard models must weigh several signals or follow domain-specific reasoning.
- How deep it goes
- Defines explicit reasoning steps and compares direct, zero-shot, and few-shot prompting through a deployment decision.
- Examples
- Compares prompts for a 20% canary rollout with an elevated error rate, connection-pool utilization, and downstream timeouts.
- What you can do after
- Evaluate/understand a rollout recommendation by checking its stated signal-by-signal reasoning and thresholds.
Read how Prompt Engineering in Practice explains chain-of-thought prompting →
Grokking AI Applications
A prompting technique that asks a language model to express intermediate reasoning steps before presenting a conclusion.
- How it is used
- Improves prompt reliability by structuring complex tasks and making the model’s reasoning more visible.
- How deep it goes
- Defines step-by-step prompting and pairs it with decomposition and self-validation, without discussing model internals.
- Examples
- Uses business-plan decomposition and energy-drink tagline generation to contrast unstructured and structured requests.
- What you can do after
- Apply CoT by writing prompts that request intermediate reasoning, final answers, and response verification.
Read how Grokking AI Applications explains chain-of-thought prompting →
Build a DeepSeek Model (From Scratch)
Chain-of-thought is a sequence of intermediate natural-language reasoning steps produced between a problem statement and its final answer.
- How it is used
- Transfers reasoning behavior from a capable teacher to a smaller language model through generated intermediate text.
- How deep it goes
- Explains trace content, supervised training, rejection sampling, and capacity limits, but does not provide implementation code.
- Examples
- Uses a prime-sum reasoning trace and an 800K-example dataset spanning mathematics, code, STEM, logic, and general tasks.
- What you can do after
- Apply supervised fine-tuning to transfer verified teacher reasoning traces into a smaller student model.
Read how Build a DeepSeek Model (From Scratch) explains chain-of-thought prompting →
Vibe Engineering
Chain-of-thought prompting is a technique in which a language model generates intermediate reasoning steps before producing its final answer.
- How it is used
- Uses intermediate reasoning to decompose complex coding and text-to-SQL tasks before generating an answer.
- How deep it goes
- Explains staged reasoning, tool grounding, and visible-trace auditing, while noting that modern models increasingly reason internally.
- Examples
- Uses a StripeV3 payment refactor and BIRD text-to-SQL benchmarking with schema, column, and query context.
- What you can do after
- Apply it via structured prompts, grounding tools, visible plans, and benchmark-based validation.
Read how Vibe Engineering explains chain-of-thought prompting →
AI Agents and Applications
- How it is used
- Guides an LLM to classify a user-defined sequence by supplying worked examples and explicit reasoning steps.
- How deep it goes
- Defines CoT through worked few-shot examples and logical steps without detailing model internals.
- Examples
- Classifies invented strange sequences by counting odd numbers, summing them, and checking divisibility by three.
- What you can do after
- Apply CoT by adding worked examples and explicit reasoning steps to an LLM prompt.
Read how AI Agents and Applications explains chain-of-thought prompting →
Generative AI in Action
Chain of thought is a prompting technique that decomposes a problem into intermediate reasoning steps before producing an answer.
- How it is used
- Deploys intermediate prompts to guide complex reasoning tasks such as question answering, translation, and code generation.
- How deep it goes
- Explains sequential reasoning, zero-shot and few-shot variants, and examples, but stops short of model internals or mathematical derivation.
- Examples
- Uses photosynthesis explanations, proportional arithmetic, and few-shot word problems to demonstrate intermediate reasoning.
- What you can do after
- Apply it via zero-shot instructions or few-shot demonstrations to structure model reasoning and inspect intermediate answers.
Read how Generative AI in Action explains chain-of-thought prompting →
AI Agents for Offensive Security
A prompting and reasoning technique that elicits intermediate steps to connect a problem statement with a conclusion or action.
- How it is used
- Plans reconnaissance strategy from objectives, knowledge, hypotheses, boundaries, and security posture before agent actions.
- How deep it goes
- Defines stepwise reasoning and situates it in ReAct planning, without specifying a prompt template or internal model mechanics.
- Examples
- Uses a cake-slice arithmetic problem and a reconnaissance pipeline that plans, probes, observes, and records JSONL findings.
- What you can do after
- Apply it via a ReAct agent to select bounded reconnaissance actions and preserve resulting context as artifacts.
Read how AI Agents for Offensive Security explains chain-of-thought prompting →
Sutskever's List
Chain-of-thought prompting is a prompting technique that elicits explicit intermediate reasoning steps before a model produces its final answer.
- How it is used
- Uses explicit intermediate traces as an inference-time scaffold for multistep reasoning and planning.
- How deep it goes
- Explains the stepwise mechanism through examples and notes that it changes neither model architecture nor parameters.
- Examples
- Uses a farm-legs arithmetic problem, math word problems, and logic puzzles to illustrate stepwise solving.
- What you can do after
- Apply it by prompting a model to generate intermediate natural-language steps before its final answer.
Read how Sutskever's List explains chain-of-thought prompting →
Building Reliable AI Systems
Chain-of-thought prompting is a prompting method that elicits explicit intermediate reasoning steps from a model.
- How it is used
- Guides multistep model responses toward more transparent, inspectable reasoning as part of reliable prompt engineering.
- How deep it goes
- Explains demonstrated and zero-shot reasoning patterns through worked examples and model-specific guidance.
- Examples
- Uses odd-number sums, an apple arithmetic problem, and order-number discount eligibility to illustrate stepwise responses.
- What you can do after
- Practice constructing stepwise prompts for multistep tasks and testing them on the target model.
Read how Building Reliable AI Systems explains chain-of-thought prompting →
Learn AI Data Engineering
Chain-of-thought prompting is a prompting technique that asks a language model to produce or follow an explicit sequence of intermediate reasoning steps before an answer.
- How it is used
- Guides a coding companion through multi-step SQL problems so generated queries become more interpretable and reviewable.
- How deep it goes
- Defines step-by-step prompting and demonstrates it with SQL and arithmetic, while noting that exposed reasoning does not guarantee correctness.
- Examples
- Uses arithmetic division, Pagila customer spending, average rentals, and queries involving joins, grouping, ordering, and limits.
- What you can do after
- Diagnose/debug generated SQL by inspecting its intermediate joins, calculations, assumptions, and edge-case handling before execution.
Read how Learn AI Data Engineering explains chain-of-thought prompting →
Time Series Forecasting Using Foundation Models
Chain-of-thought prompting is a prompting technique that elicits intermediate reasoning steps before a model produces an answer.
- How it is used
- Frames forecasting and anomaly detection as natural-language tasks for LLMs.
- How deep it goes
- Explains prompt structure, demonstrations, chunking, and output handling, but does not establish probabilistic forecasts.
- Examples
- Uses binary anomaly labels, statistical bounds, few-shot demonstrations, and chunked Python-style processing.
- What you can do after
- Apply it to anomaly detection by constructing prompts, parsing labels, and handling incomplete model output.
Read how Time Series Forecasting Using Foundation Models explains chain-of-thought prompting →
Machines that Think
A prompting technique that encourages a model to produce intermediate reasoning steps before its final answer.
- How it is used
- Structures generation with intermediate steps to support multi-step answers and make unsupported conclusions less immediate.
- How deep it goes
- Defines the prompting approach and its rationale, then qualifies its limits without detailing implementation.
- Examples
- Uses arithmetic and logical reasoning tasks, plus hidden prompt biases that produce plausible but unfaithful explanations.
- What you can do after
- Evaluate reasoning explanations cautiously rather than treating them as faithful accounts of a model’s causal process.
Read how Machines that Think explains chain-of-thought prompting →
Transformers in Action
Chain-of-thought prompting guides a language model by providing or eliciting a sequence of intermediate reasoning steps before the final answer.
- How it is used
- Guides language-model generation toward intermediate reasoning for complex text-to-text and multistep reasoning tasks.
- How deep it goes
- Explains decomposition, demonstrations, structured outputs, and self-consistency, but does not detail model internals.
- Examples
- Uses arithmetic commonsense reasoning, the Roger tennis-ball problem, and a cube-root request with a structured response schema.
- What you can do after
- Apply it via few-shot demonstrations, structured schemas, and repeated sampling for more inspectable reasoning outputs.
Read how Transformers in Action explains chain-of-thought prompting →
AI Agents in Action
Chain of thought prompting is a prompting technique that guides a language model to produce or internally follow intermediate reasoning steps before reaching an answer.
- How it is used
- Guides language models through intermediate reasoning to solve problems, and can pair solution generation with answer evaluation.
- How deep it goes
- Demonstrates example-based and zero-shot prompts, plus a second prompt that scores a solution.
- Examples
- Uses time-travel problems, including a worked calculation in which Sarah spends 729 days in the past.
- What you can do after
- Apply it by supplying worked reasoning examples or adding “Let’s think step by step” before a problem.
Read how AI Agents in Action explains chain-of-thought prompting →
How Large Language Models Work
A prompting technique that encourages a language model to produce an intermediate sequence of reasoning steps before an answer.
- How it is used
- Uses step-by-step prompting to improve performance on tasks that benefit from generated intermediate text.
- How deep it goes
- Explains the prompt pattern and possible mechanisms, but stops short of resolving why performance improves.
- Examples
- Uses “Let’s think step by step,” difficult math problems, planning, and unusual situations requiring contextual interpretation.
- What you can do after
- Apply it via a step-by-step prompt while checking for missing steps, calculation errors, and invalid reasoning.
Read how How Large Language Models Work explains chain-of-thought prompting →
Reinforcement Learning from Human Feedback
A reasoning trace is a sequence of generated textual intermediate steps used while solving a problem before reaching an answer.
- How it is used
- Uses demonstrations or instructions to elicit intermediate reasoning before answers, especially in evaluation, reasoning training, and tool-use pipelines.
- How deep it goes
- Defines generated reasoning traces and shows prompt formats, then connects them to process scoring, search, training, and evaluation.
- Examples
- Demonstrates arithmetic word problems, multiple-choice prompts with exact answer suffixes, process-scored traces, and interleaved tool actions.
- What you can do after
- Apply it via prompting, structure generated answers for exact-match evaluation, or support reasoning search and tool-use loops.
Read how Reinforcement Learning from Human Feedback explains chain-of-thought prompting →
Deep Learning with Python, Third Edition
A search-based inference approach that explores reasoning in natural language by generating intermediate thought steps before an answer.
- How it is used
- Uses intermediate natural-language steps to improve answers to math problems and search for solutions at test time.
- How deep it goes
- Explains few-shot and zero-shot prompting, gives a Gemma example, and relates the method to fine-tuning without detailing model internals.
- Examples
- Uses worked math demonstrations, “Let’s think step by step,” and Judy’s letter-counting problem.
- What you can do after
- Apply it by adding worked reasoning examples or a step-by-step cue to a prompt, then check the final answer.
Read how Deep Learning with Python, Third Edition explains chain-of-thought prompting →
Retrieval Augmented Generation, The Foundational Ideas
Chain-of-thought reasoning is a reasoning technique that generates or follows intermediate steps between a problem and its answer.
- How it is used
- Uses intermediate reasoning to evaluate generated outputs, especially faithfulness and coherence in RAG systems.
- How deep it goes
- Explains prompt structure, evaluation steps, and probability-weighted scoring, but stops short of broader reasoning internals.
- Examples
- Demonstrates coherence scoring, faithfulness checking, explicit claim verification, and continuous 1–5 probability-weighted ratings.
- What you can do after
- Apply G-Eval-style prompting to construct an evaluator that produces explicit checks and more finely grained scores.
LLM Customization and Fine-Tuning
A prompting technique that elicits intermediate reasoning steps from a language model before its final answer.
- How it is used
- Use CoT to support multi-step tasks, not single-label tasks with nothing to reason through.
- How deep it goes
- Compare a standard answer with a worked reasoning trace and note its accuracy and token-cost tradeoff.
- Examples
- Calculate a train’s distance at 60 km/h over 2.5 hours, with and without a reasoning trace.
- What you can do after
- Apply CoT examples to multi-step tasks when their accuracy benefit justifies the additional output tokens.
Read how LLM Customization and Fine-Tuning explains chain-of-thought prompting →
Also covered in
- Build a Reasoning Model (From Scratch)
- Deep Learning with R, Third Edition
- Knowledge Graphs and LLMs in Action
- Build an AI Agent (From Scratch)
- Context EngineeringIn early access (MEAP)
What to know first
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- promptA prompt is text or other input supplied to an AI model to provide instructions, context, or other information that guides its response or generated output.
- fine-tuningFine-tuning is the continued training of a pretrained model on targeted data or objectives to adapt its parameters or behavior to a task, domain, or use.
- chain-of-thoughtA chain-of-thought is an ordered sequence of intermediate reasoning steps that connects information or a problem to a conclusion, whether expressed or generated as text.
Related concepts
- prompt engineeringkind of · Prompt engineering is the deliberate design and refinement of inputs, instructions, and context to guide an AI model’s behavior or outputs.
- reasoning architecturekind of · A structure that organizes how reasoning proceeds, such as by moving directly to an answer, exposing intermediate logic, branching into alternatives, rotating perspectives, or testing conclusions against evidence.
- language modeluses · A language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- chain-of-thoughtproduces · A chain-of-thought is an ordered sequence of intermediate reasoning steps that connects information or a problem to a conclusion, whether expressed or generated as text.
- few-shot learninguses · Few-shot learning is an approach in which a model is guided to perform or adapt to a task from only a small number of examples.
- G-Evalused by · G-Eval is an LLM-based technique for evaluating generated text against natural-language criteria, often by generating evaluation steps and assigning scores.
Questions about chain-of-thought prompting
What is chain-of-thought prompting?
Chain-of-thought prompting is a technique that elicits or supplies intermediate reasoning steps to guide a model toward a final answer.
Which Manning books explain chain-of-thought prompting?
Build an Advanced RAG Application (From Scratch), Introduction to Generative AI, Second Edition, Coding with AI, AI Agents in Action, Second Edition, LLM Evaluation and Alignment, The Foundational Ideas, The Art of AI Product Development, LLMs in Production, WordPress Power Toolkit: Harness AI to build next-level websites and 21 more.
What should I know before learning chain-of-thought prompting?
Manning books that teach chain-of-thought prompting usually introduce language model, prompt, fine-tuning and chain-of-thought first.
What is chain-of-thought prompting a kind of?
Chain-of-thought prompting is a kind of prompt engineering. Prompt engineering is the deliberate design and refinement of inputs, instructions, and context to guide an AI model’s behavior or outputs.
What is chain-of-thought prompting also called?
Chain-of-thought prompting is also called CoT prompting.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.




























