chain of thought (CoT)
A chain of thought (CoT) is the sequence of intermediate reasoning steps a large language model (LLM) generates between a problem and its final answer, instead of jumping straight to a result.
In models of sufficient scale, a chain of thought can be elicited by structuring the prompt to ask for one. Common approaches include an instruction like Let’s think step by step, or few-shot demonstration examples that explicitly show reasoning steps leading to the answer.
Reasoning models internalize this behavior. They’re trained with reinforcement learning to produce a chain of thought before answering, so vendors now advise against explicit CoT prompting with them. OpenAI’s guidance recommends avoiding think step by step instructions outright, and Anthropic treats manual CoT as a fallback for when extended thinking is off.
A notable variation, self-consistency, samples multiple reasoning paths and then selects the answer that’s most consistent across those paths.
A chain of thought isn’t a guaranteed window into how a model reached its answer. Faithfulness research from Anthropic has found that models often rely on cues they never mention in their visible reasoning, so the printed steps are a useful intermediate output rather than a verified explanation.
Related Resources
Tutorial
Prompt Engineering: A Practical Example
Learn prompt engineering techniques with a practical, real-world project to get better results from large language models. This tutorial covers zero-shot and few-shot prompting, delimiters, numbered steps, role prompts, chain-of-thought prompting, and more. Improve your LLM-assisted projects today.
For additional information on related topics, take a look at the following resources:
- Leverage OpenAI's API in Your Python Projects (Course)
- How to Use the Claude API in Python (Tutorial)
- How to Use Ollama to Run Large Language Models Locally (Tutorial)
- Practical Prompt Engineering (Quiz)
- How to Use the Claude API in Python (Quiz)
- How to Use Ollama to Run Large Language Models Locally (Quiz)
By Leodanis Pozo Ramos • Updated Aug. 27, 2026