Skip to the workspace
Pebellslearn by building
Prompting Techniques and Context Engineering  ›  Lesson

Chain-of-Thought Prompting

CoT 12 minChain-of-thought prompting has the model work through intermediate steps before giving a final answer, which helps on multi-step problems at the cost of extra tokens and time.

ai engineer / Chain-of-Thought Prompting

Explore each scene at your own pace.

01 · The rule

The rule

Chain-of-Thought Prompting

A customer returns an opened wheelset and unopened gloves. Pedal Point's rules: opened items that are not faulty lose a 10% restocking fee, unopened items come back in full, shipping is never refunded. Asked for "just the refund amount", the assistant sometimes applies the fee to both items. The maths is easy for a person working step by step. So let the model work step by step too.

The rule

For multi-step problems, let the model work before it answers.

A model writes one token at a time, and each token is shaped by the text before it. If the very first token must be the final answer, all the reasoning has to happen invisibly inside that one step. If the model first writes out the intermediate steps, each later step can build on them.

Chain-of-thought (CoT) prompting asks for exactly that:

Work through each returned item: is it opened, is it faulty, what fee applies?
Then give the total on a final line in the form: REFUND: <amount>

For the wheelset at 250 and gloves at 40:

  • Wheelset: opened, not faulty, fee 10% of 250 = 25, refund 225.
  • Gloves: unopened, refund 40.
  • Total: 225 + 40 = 265.

Some models are built to reason internally before answering and need less prompting for this; the principle is the same.

Use CoT where it pays:

  • Helps: calculations, policy rules that combine, planning, multi-step decisions.
  • Wastes: simple lookups and classifications. Reasoning costs extra tokens and time on every request.

Two cautions. The written reasoning is not a guaranteed record of why the model reached its answer, so do not treat it as proof. And for anything involving money, recompute the result in code.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.