Chain of Thought
Chain of thought is a technique in which a language model writes out intermediate reasoning steps before giving its final answer, which tends to improve accuracy on math, logic and multi-step problems.
Also known as: CoT, step-by-step reasoning
How it works
Wei and colleagues at Google described chain-of-thought prompting in 2022, showing that including worked examples with step-by-step reasoning improved large models on arithmetic and reasoning benchmarks. Kojima and colleagues found the same year that simply adding "Let's think step by step" helped, known as zero-shot chain of thought.
The technique has since moved into the models themselves. Reasoning models are trained to produce long internal chains of thought before answering, and APIs expose this as a setting, such as a thinking budget or reasoning effort level. Prompting variants include:
- Asking the model to reason inside marked tags, then give a separate final answer.
- Self-consistency: sampling several reasoning paths and taking the most common answer.
- Breaking a task into explicit sub-questions.
Why it matters
For tasks with several dependent steps, such as calculating eligibility under a policy or reconciling figures, reasoning before answering reduces errors. It costs more tokens and time, so it is wasteful for simple classification or extraction. Two cautions matter for business use. First, the written reasoning is not a reliable explanation of how the model actually reached its answer; research from Anthropic and others in 2025 found models do not always faithfully report the factors they used. Treat it as a useful signal for debugging, not as an audit record. Second, do not show raw reasoning to end users by default, since it can contain errors and internal details. See AI evaluation and observability.
Chain of Thought in depth
When chain of thought helps and when it does not
| Task | Likely benefit |
|---|---|
| Multi-step calculations, policy eligibility, reconciliation | High: errors compound without intermediate steps |
| Planning an agent's next actions | High: the plan can be checked before tools run |
| Code changes across several files | Medium to high |
| Simple classification or field extraction | Low: adds tokens and delay with little gain |
| Short factual lookups grounded in a document | Low: retrieval quality matters far more |
With reasoning models, the choice becomes a setting rather than a prompt pattern: you select a reasoning effort or thinking budget per request. Classic chain-of-thought prompting is still useful with non-reasoning models and for making intermediate steps available to your own code.
Example: GST place-of-supply checks
Example: a hypothetical accounts team asks a model whether an invoice should carry CGST and SGST or IGST. The prompt asks the model to work inside separate tags: identify the supplier's state from the GSTIN, identify the place of supply from the bill-to and ship-to details, compare them, then state the tax type. The final answer goes in a separate structured field that code reads. Code also checks the first two digits of each GSTIN against the state code independently, so the model's reasoning is verified rather than trusted. Disagreements go to a person.
Implementing it in production
- Separate reasoning from answer: request the reasoning and the final output in different fields, using structured output, so parsing never depends on prose.
- Decompose where you can: splitting a task into several smaller calls, each checkable, is often more reliable than one long chain.
- Self-consistency for high-stakes items: sample several answers and act only when they agree; route disagreements to review.
- Budget tokens: reasoning tokens are billed and add latency; set limits per route.
- Store reasoning carefully: it can contain personal data from the input, so apply the same retention rules as other logs.
Evaluating the effect
Run the same evaluation set with reasoning off, on at a low budget, and on at a high budget. Compare accuracy, cost per item and p95 latency. Often a low budget captures most of the gain. Also measure answer stability across repeated runs, since reasoning can make outputs more consistent on hard items.
Common mistakes
- Treating the written reasoning as a faithful audit trail of the model's decision.
- Showing raw reasoning to customers, including its false starts.
- Turning on maximum reasoning everywhere and then wondering why costs rose.
- Using reasoning to compensate for missing information; if the facts are not in context, more thinking will not create them. See grounding and hallucination.
Chain of thought is part of prompt engineering and interacts directly with token costs. We measure its effect in AI evaluation and observability and tune it in AI cost optimization.
Questions about Chain of Thought
Something else? Send us your question and an engineer replies with next steps.
Does asking a model to think step by step still help with newer models?
It depends on the model. Reasoning models already produce internal reasoning before answering, so adding the phrase does little; you control their reasoning through effort or budget settings instead. Non-reasoning models can still benefit on multi-step problems, especially when you ask for the steps in a separate section and the answer in a structured field. The only reliable way to know is to test both versions on your own evaluation set and compare accuracy, cost and latency.
Should we log a model's reasoning for compliance purposes?
Logging reasoning can help engineers debug, but it should not be presented as the official explanation of a decision, because research shows models do not always report their real reasoning faithfully. For compliance, record what actually drove the outcome: the inputs, retrieved sources, rules applied in code, the final structured output and any human approval. Some providers return only a summary of reasoning or none at all. If you do keep reasoning text, apply retention and access rules, since it can repeat personal data from the input.