Prompt Engineering
Chain-of-Thought Prompting
Force the model to reason step by step before committing to an answer.
The Recipe
Append a single phrase to your prompt that triggers explicit intermediate reasoning. The model will break complex problems into sub-steps, reducing errors on math, logic, and multi-hop tasks.
Let's think step by step.
Why It Works
- ▸Decomposes the problem into manageable sub-questions the model can solve individually.
- ▸Surfaces hidden assumptions and catches arithmetic mistakes before the final output.
- ▸Works across GPT-4, Claude, Gemini, and open-source models — no fine-tuning required.
Example
Prompt:
“A store sells apples for $2 each and oranges for $3 each. I buy 4 apples and 3 oranges with a $20 bill. How much change do I get? Let's think step by step.”
Model output:
4 apples × $2 = $8. 3 oranges × $3 = $9. Total = $17. Change = $20 − $17 = $3.
Variants
Zero-shot CoT
Just add the trigger phrase — no examples needed.
Few-shot CoT
Provide 2–3 worked examples with reasoning chains before the query.
Auto-CoT
Cluster diverse questions, generate chains automatically, prepend to prompt.