# Chain of Thought

> Make the model think out loud before it answers.

- **Category**: Agentic AI
- **Subcategory**: Reasoning
- **Canonical URL**: https://designpattern.fyi/patterns/chain_of_thought/

---

## Description
**Intent**: Elicit step-by-step reasoning in the model's output so it decomposes a problem before answering it.

**Context**: LLMs trained to predict the next token tend to shortcut to answers. On multi-step math, logic, or planning tasks, this produces confident wrong answers. CoT sidesteps this by forcing the model to externalize its work.

**Solution**: Add "think step by step" or equivalent to your prompt, or use few-shot examples that demonstrate step-by-step reasoning. The model's scratchpad becomes part of the output before the final answer token. For API use, some models support a native `thinking` block (e.g. Claude extended thinking) that keeps the trace separate from the user-facing response. See also: zero-shot-chain-of-thought, extended-thinking, scratchpad.



## Use Cases
- Math and logic problems where intermediate steps determine correctness.
- Any task where auditability of reasoning matters (compliance, medical, legal).
- Debugging model failures — the trace shows exactly where reasoning went wrong.






## Trade-offs


### Advantages

- Measurably improves accuracy on multi-step tasks with no fine-tuning required.

- Makes model reasoning auditable and debuggable.

- Works zero-shot with modern models — just ask.




### Considerations & Drawbacks

- Increases output token count and therefore cost and latency.

- The reasoning trace can be wrong and still lead to a correct answer (or vice versa).

- Verbose traces can fill context windows on long pipelines.







---
**Reference**: [Original Source](https://www.agentpatternscatalog.org/patterns/chain-of-thought/)

