GeekHub Learn
Module
Lesson 4.44 of 7 in this module2 min read Module 4: Prompt Engineering Fundamentals

Chain-of-thought and structured reasoning

If you have ever watched ChatGPT confidently get a multi-step problem wrong, the fix is almost always: make it think out loud.

Ask a student "what is 47 times 89?" and they may guess. Ask "show your steps" and they slow down and get it right. Same model, better output, just by changing how it thinks.

Chain-of-thought (CoT) prompting asks the model to reason step by step before answering. It works because the model can attend to its own intermediate reasoning, which is itself in the context.

Variants:

  • Zero-shot CoT: append "Let's think step by step."
  • Few-shot CoT: provide examples where the reasoning is spelled out.
  • Tree-of-thoughts: explore multiple reasoning paths and pick the best.
  • Self-consistency: sample multiple reasoning paths and vote.

In 2026, frontier models have built-in reasoning modes that handle this automatically. For non-reasoning models, you still need CoT prompts.

Question: If a train travels 60 km/h for 1.5 hours then 80 km/h for 0.5 hours,
what is the total distance?

Let's think step by step.

The model will likely produce something like:

Step 1: 60 * 1.5 = 90 km.
Step 2: 80 * 0.5 = 40 km.
Step 3: 90 + 40 = 130 km.
Answer: 130 km.

Without "step by step", the model is more likely to attempt the answer in one shot and slip.

Visualize it

A side-by-side diagram. Left: "answer-only" path with one arrow to a wrong answer. Right: "step-by-step" path with 3 intermediate boxes leading to the right answer.

Try it now

Ask any LLM a tricky word problem without CoT. Then again with "Let's think step by step." Compare.

Hands-on lab

Find 5 logic puzzles. Solve each twice in ChatGPT: once with no instruction, once with CoT. Track accuracy.

Try it now

When does chain-of-thought hurt output quality?

Common mistakes

  • Using CoT for trivial tasks (waste of tokens)
  • Asking for both reasoning and clean output without specifying format
  • Hiding the reasoning from the user when they want it (or vice versa)

Debugging tip

If output contains rambling, use "Think internally, then output only the final answer in [format]." Many providers also support a hidden reasoning field.

Challenge

Pick a coding bug fix request. Compare three variants: no CoT, CoT, and CoT + final answer in JSON. Note which is most reliable.

Where this shows up

  • Math and arithmetic
  • Multi-step planning
  • Bug triage and root-cause analysis
  • Diagnostic flows in medical or legal AI (with human review)

From the field

The "reasoning models" of 2025-2026 (o-series, Claude reasoning, Gemini Thinking) are essentially CoT baked in at training time. You can sometimes ignore CoT prompts when using them. But knowing how to do CoT manually still matters when budget forces you to a non-reasoning model.

Recap

Make the model think out loud. CoT dramatically improves accuracy on multi-step tasks at the cost of more tokens.


Quick recall

3 prompts · think before you flip

Prompt 1 of 3

What is chain-of-thought prompting?

Quiz time

1 question · tap an answer to check it

  1. 1. The simplest zero-shot CoT trick is to add

Finished lesson 4.4?

Mark complete to update your module progress and unlock the streak.

Loading