Lesson 13 / 18Module 5. Advanced TechniquesDetailed lesson
Academy/Prompt Engineering/Lesson 13. Chain-of-thought: step-by-step reasoning
Intermediate+20 min

Lesson 13. Chain-of-thought: step-by-step reasoning

If ChatGPT or Claude gives inaccurate answers to complex analytical or logical questions, the problem is usually not in the model but in how the request was phrased. Chain-of-thought forces the model to explain its thinking step by step — and this produces significantly more accurate results.

Topic breakdown

Chain-of-thought (CoT) is a technique where you ask the model not just to give an answer but to show its reasoning process. 'Think step by step' or 'explain each step' noticeably reduces the probability of error.

Why does this work? When the model writes sequentially, each sentence becomes context for the next. This way it relies on computation rather than guessing.

Zero-shot CoT — just adding 'think step by step' is enough. Few-shot CoT — showing 1-2 examples with detailed explanation, and the model reproduces that pattern.

Especially effective for math, logical sequences, multi-condition analysis, and strategic decisions. For simple questions, CoT is overkill.

What you'll learn

  • understand what chain-of-thought is and when it's needed
  • distinguish between zero-shot and few-shot CoT
  • write step-by-step prompts for complex analysis
  • verify each step of the model's reasoning

Lesson plan

What is CoT and why does it work?

The model writes sequentially — each sentence becomes context for the next. This reduces the probability of error in complex reasoning.

Zero-shot vs few-shot CoT

Zero-shot: add 'think step by step'. Few-shot: show 1-2 examples with detailed solutions.

When to apply CoT

Complex logic, math, multi-condition analysis. Not needed for simple straightforward questions.

Verifying the result

Compare the model's reasoning with your own logic. If steps aren't logical — refine the prompt or try a different model.

Weak vs strong prompt

Weak prompt

Which business growth option should I choose?

Strong prompt

Solve this problem step by step: 1) analyze the current situation; 2) suggest 3 scaling options; 3) for each, list pros and risks; 4) recommend the most realistic one given resources and time. Business: online fruit and vegetable delivery, 200 orders per month.

The second prompt forces the model to reason through steps rather than guess. The result is a substantiated analysis, not generic words.

Deep dive

Chain-of-thought (CoT) prompting is a technique where you explicitly ask the model to describe each step of its reasoning before giving a final answer. The core effect: each written phrase becomes context for the next. The model 'thinks aloud' and can notice its own errors before reaching a conclusion.

Three CoT variants for practice: 1) Zero-shot CoT — add 'let's reason step by step' or 'explain each step' to the prompt. This is often enough. 2) Few-shot CoT — show one or two complete reasoning examples so the model follows the same pattern. 3) Self-consistency CoT — run the task multiple times and choose the most frequent answer; useful for critical decisions.

Where does CoT give the greatest benefit? In mathematical problems, multi-step data analysis, risk assessment, and business decisions with multiple variables. Here a direct answer without reasoning is unreliable — the model too easily makes mistakes on intermediate steps.

Important limitation: CoT doesn't guarantee a correct answer; it only reduces the probability of an unnoticed error. The reasoning steps may be logically formatted but based on an incorrect premise. Therefore, for critically important tasks, always verify intermediate steps, not just the final conclusion.

Ready prompt template

Copy and adapt
Solve the following problem, describing each step separately. Problem: [specific problem or question]. Steps: 1) identify the core of the problem; 2) review available data; 3) analyze each option logically; 4) choose the best option and justify it. At the end, write the final conclusion in a separate paragraph.

Why it works

Chain-of-thought forces the model to reveal its thinking process instead of giving a direct answer — especially important for complex logic.

Zero-shot CoT: add 'think step by step'. Few-shot CoT: show 1-2 examples with detailed solutions.

Math, logical chains, scenario analysis, and multi-condition decisions — that's where CoT is most effective.

For simple questions, CoT is overkill: it spends tokens without noticeable improvement in the result.

Practice

  • Ask the model a complex question with a standard prompt: 'What's the best way to scale a business?'
  • Rewrite the same question with CoT: ask to consider 3 options, weigh pros and cons, then give a conclusion.
  • Compare both answers: which is more substantiated?
  • Try CoT on a mathematical or logical problem and check accuracy.

Mini-project

Mini-project: decision-making with CoT

Choose a real problem from work or life and use CoT technique to solve it with AI.

Tasks

  • Formulate the problem in one sentence.
  • List the steps needed to solve it.
  • Write a CoT prompt and get a response.
  • Check each step for logic.

Deliverables

  • 1 CoT prompt
  • model response with step-by-step analysis
  • your conclusion about the accuracy of the result

Checklist

Is the problem clearly formulated?
Are reasoning steps listed?
Was the model asked to explain each step?
Is the final conclusion requested separately?
Was the result verified?

Common mistakes

  • applying CoT to all tasks — for simple questions it's overkill
  • writing only 'step by step' without specifying the actual steps
  • asking for too many steps, causing the model to get confused and not give a final conclusion
  • accepting all model reasoning as correct without verification

Lesson FAQ

Does CoT always give a more accurate answer?

More often yes — for complex tasks. For simple questions, CoT spends extra tokens without substantial improvement.

Which models does CoT work best on?

GPT-4o, Claude 3.5 Sonnet, and Gemini Pro. Less powerful models sometimes can't handle multi-step reasoning.

What's the difference between zero-shot and few-shot CoT?

Zero-shot CoT — you simply add an instruction to 'reason step by step', without examples. Few-shot CoT — you show one or two complete step-by-step reasoning examples. For most tasks zero-shot is sufficient; few-shot helps with complex or non-standard formats.

Next step

Chain-of-thought prompting: step-by-step reasoning | Lesson 13 | Prompter Academy