Skip to content
Lesson 1 of 8Advanced Prompt Engineering

Designing prompts · Lesson 1 of 8

Chain-of-thought concepts

When step-by-step prompting helps, what visible reasoning really is (and isn't), and how to ask for intermediate work you can actually check.

12 min readAdvanced
Sign in to bookmark

You're learning as a guest — everything is open. Sign in to save progress, earn XP and pick up where you left off.

What "chain of thought" means

"Chain of thought" (CoT) is the idea of getting a language model to work through intermediate steps before it commits to a final answer. The classic version is a single extra line — "Let's think step by step" — added to a prompt. The more useful modern version is asking for specific intermediate work: the quantities you extracted, the rules you applied, the cases you considered.

It helps most on problems that genuinely have multiple steps: arithmetic word problems, logic puzzles, scheduling constraints, debugging, multi-condition policy questions. It helps much less (and can just add noise and cost) on simple lookups, short rewrites, or tone changes.

Why writing steps out can help

A language model generates text one token at a time, and each new token is conditioned on everything before it. If the model jumps straight to "The answer is 42", there's no written-out intermediate result for later tokens to build on. If it first writes "Subtotal: 3 × 12 = 36, plus 6 shipping = 42", each step becomes context for the next. That's a practical, mechanical reason step-by-step prompting often improves results on multi-step tasks — not magic, and not a guarantee.

Before

A train leaves at 9:40 and the trip takes 2 hours 35 minutes, with a 25-minute delay. Can I make a 13:00 meeting that's a 15-minute walk from the station?

After

A train leaves at 9:40 and the trip takes 2 hours 35 minutes, with a 25-minute delay. Can I make a 13:00 meeting that's a 15-minute walk from the station? Before answering, write out: 1. Scheduled arrival time 2. Actual arrival time with the delay 3. Time I reach the meeting after walking Then give a yes/no answer and how many minutes of buffer I have.

The second prompt doesn't just say "think harder". It names the intermediate values, so you can check each one: 9:40 + 2:35 = 12:15, + 25 min = 12:40, + 15 min = 12:55. Yes, with 5 minutes to spare.

The important caveat: visible reasoning is generated text

It's tempting to read a model's step-by-step explanation as a transcript of how it "really" thought. Be careful. The written reasoning is output the model generated, produced by the same process as the final answer. Research and everyday experience both show that:

  • A model can write plausible-looking steps and still reach a wrong answer.
  • A model can reach a correct answer while the stated steps don't actually justify it.
  • The explanation can be a post-hoc rationalisation rather than the cause of the answer.

So treat visible reasoning as useful evidence you can audit, not as a guaranteed faithful trace of internal computation.

Watch out: "Show your reasoning" doesn't make an answer trustworthy on its own. It makes the answer checkable — which only helps if someone (or something) actually checks it.

Models that reason internally

Some newer models are built to do extended reasoning before they respond. Depending on the product or API, that reasoning may be hidden entirely, shown only as a summary, or exposed in a separate field. You usually can't force a full raw transcript out of these models, and prompting them with "reveal all your hidden thoughts" tends to produce yet another generated explanation, not privileged access.

For these models, piling on "think step by step" often adds little. What still helps:

  • A clear statement of the problem and constraints.
  • A request for a specific, checkable output format (the key figures, the assumptions, the final answer).
  • Any settings the provider offers for reasoning effort or budget, used deliberately rather than by default.

Ask for checkable work, not "your thoughts"

The most practical shift in this lesson is from "tell me what you're thinking" to "show me the pieces I need to verify you".

Before

Explain your thought process and then tell me whether this expense claim complies with policy.

After

Check this expense claim against the policy below. For each line item, output: - item, amount, category - the policy rule that applies (quote it) - compliant: yes/no, with a one-line reason Then give an overall verdict. If any rule is ambiguous, say so instead of guessing.

The improved prompt produces intermediate work that maps to things a reviewer can verify: quoted rules, amounts, per-item decisions. If the model misquotes a rule, you'll see it.

A developer-flavoured pattern

In an application, you often want the reasoning separated from the answer so your code can parse the result:

Prompt
Solve the problem in <problem>. Write your working inside <work> tags, then put only the final numeric answer inside <answer> tags.

<problem>
A subscription costs $14/month or $150/year. Over 18 months, which is cheaper if the annual plan can't be prorated?
</problem>

Your code reads <answer>; a human (or a test) can inspect <work> when something looks off. Note that you're paying for the extra tokens either way, so use this where accuracy matters.

When to skip it

  • Simple factual or formatting tasks — extra steps add length, latency and cost.
  • When the output must be short and user-facing — keep the work in a separate section, or a separate call.
  • When you're using a reasoning model that already deliberates internally — focus on a precise task description instead.

Tip: If you're unsure whether step-by-step helps for your task, test it: run the same set of questions with and without it and compare accuracy. That's exactly what the evaluation lesson later in this course covers.

Common mistakes

  • Mistake: Treating a confident step-by-step explanation as proof the answer is right.

    Fix: Verify the intermediate values or quoted sources yourself, or add an independent check step.

  • Mistake: Adding 'think step by step' to every prompt, including trivial ones.

    Fix: Reserve it for multi-step problems and measure whether it actually improves your results.

  • Mistake: Asking a reasoning model to 'show all your hidden thoughts'.

    Fix: Request a concise, structured summary of the key assumptions and figures instead.

Practice exercise

Turn 'think step by step' into checkable work

Rewrite the starter prompt so the model produces intermediate work you could verify with a calculator or by reading the policy. Name the exact values or checks you want, specify where the final answer goes, and tell the model what to do if information is missing.

Your draft stays in this browser tab — it isn't sent anywhere.Try your draft in the Playground

Hints

Self-check

Tick each item your prompt covers.

0 of 4 checked

You can do the whole exercise as a guest.Sign in to save progress

Knowledge check

Test your understanding

Question 1 of 4

Which statement about a model's visible step-by-step reasoning is most accurate?

Finished reading?

Guests can read every lesson.Sign in to save progress

Continue to next lesson