Phase 3 · Making Models ReasonModule 10~34 min read

Chain-of-Thought Prompting

The technique that unlocked reasoning: ask the model to think step by step before answering, and watch accuracy on hard problems jump.

What you'll learn

Ask a model a multi-step question and demand the answer immediately, and it often blurts out a wrong one. Ask it to think step by step first, and accuracy on reasoning problems jumps — sometimes dramatically. This is chain-of-thought (CoT) prompting, the technique that opened the door to everything in this phase.

By the end of this module you'll be able to:

  • Explain why generating reasoning improves a model's answers
  • Trigger chain-of-thought with a single line, or with worked examples
  • Separate the model's reasoning from the final answer for clean output
  • Know when a reasoning model makes explicit CoT unnecessary

Why step-by-step helps

Remember that a model generates one token at a time (Module 2), and each token it writes becomes part of the context for the next. When it jumps straight to an answer, it has to compute everything "in one breath." When it writes out the steps, each step becomes visible scratch work the model can build on — it literally has more room to think, on the page.

✗Weak prompt

Prompt

A juice is $1.50. A sandwich costs $2 more than a juice. I buy 3 juices and 2 sandwiches. Total? Answer with just the number.

Response

$10.50
✓Strong prompt

Prompt

A juice is $1.50. A sandwich costs $2 more than a juice. I buy 3 juices and 2 sandwiches. Think step by step, then give the total.

Response

A sandwich is $1.50 + $2 = $3.50. Three juices: 3 × $1.50 = $4.50. Two sandwiches: 2 × $3.50 = $7.00. Total: $4.50 + $7.00 = $11.50.
Forced to answer 'with just the number', the model slips. Given room to work, it reaches the correct $11.50.
Chain-of-thought, made visible
Juice = $1.50
Sandwich = juice + $2 = $3.50
3 juices = 3 × $1.50 = $4.50
2 sandwiches = 2 × $3.50 = $7.00
Total = $4.50 + $7.00
Answer = $11.50
Each step is scratch work the next step builds on — the model reasons on the page instead of all at once.

"Let's think step by step"

The simplest version is zero-shot CoT: just add a line like "Let's think step by step" or "Show your reasoning before answering." That short nudge is often enough to switch the model from guessing to working — no examples required.

Key idea

The magic isn't the exact phrase — it's permission and space to reason. Any instruction that makes the model lay out intermediate steps before the answer tends to help on multi-step problems.

Few-shot chain-of-thought

For harder or domain-specific reasoning, combine CoT with few-shot (Module 7): show one or two examples that include the worked-out reasoning, not just the final answer. The model imitates the style of reasoning, not only the format — useful when problems need a particular method (a specific formula, a checklist, a legal test).

Tip

In your few-shot examples, make the reasoning as clean as you want the model's to be. Sloppy or skipped steps in the examples produce sloppy reasoning in the answer.

Separating reasoning from the answer

Chain-of-thought is great for accuracy but messy for output — you rarely want to show users the scratch work. Two clean patterns:

  • Delimit it. Ask the model to put reasoning inside tags (or after a heading) and the final answer separately, then display only the answer.
  • Ask for the answer last, clearly labeled ("End with 'Final answer:' on its own line") so your code can extract just that part.

Watch out

Don't force reasoning into a tiny space and still expect it. "Think step by step but answer in one word" is a contradiction — you've removed the very room the technique needs. Let it reason, then extract the short answer.

Reasoning models vs. CoT prompting

Newer reasoning models are trained to think before they answer — they generate an internal chain of thought automatically, so you often don't need to ask. With those models, explicit "think step by step" instructions add little and can even get in the way. Know which kind of model you're using:

  • Standard models: CoT prompting is your lever — ask for steps on hard problems.
  • Reasoning models: reasoning is built in — give them the goal and let them work; keep prompts clean.

Recap & quick check

Key takeaways

  • Chain-of-thought asks the model to reason step by step before answering, boosting accuracy on multi-step tasks.
  • It helps because each written step becomes scratch work the next token can build on — reasoning on the page.
  • Zero-shot CoT is one line ('think step by step'); few-shot CoT shows worked reasoning to imitate.
  • Separate reasoning from the final answer (tags or a labeled 'Final answer:') so you display only what you need.
  • Reasoning models think internally by default, so explicit CoT prompting is often unnecessary with them.

Quick check

1. Why does chain-of-thought improve accuracy on multi-step problems?

2. What is 'zero-shot chain-of-thought'?

3. Why is 'Think step by step, but answer in one word' a bad prompt?

4. You're using a modern reasoning model. What's the guidance on CoT?

One prompt can only reason so far. The next step is breaking a big task into a chain of focused prompts. Next up: Module 11 — Task Decomposition & Prompt Chaining.