AI Glossary: Chain of Thought

Chain of thought (CoT) is a prompting technique that dramatically improves the reasoning capabilities of large language models by having them explain their reasoning step by step before arriving at a final answer.

What is Chain of Thought?

Chain of thought (CoT) is a prompting technique introduced by Google Research in 2022 that significantly improves the reasoning capabilities of large language models. The core idea is simple: instead of asking the model to directly output an answer, you instruct it to generate a series of intermediate reasoning steps that lead to the final answer.

Think of it as the difference between a student who just writes down the answer to a math problem and one who shows their work. The student who shows their work is more likely to get the right answer because they're forced to think through each step, and they can catch errors along the way. CoT does the same for AI models.

Core Concept

Generate intermediate reasoning steps before the final answer to improve accuracy on complex tasks.

Origin

Introduced by Wei et al. (Google, 2022) in the paper "Chain-of-Thought Prompting Elicits Reasoning in Large Language Models."

Emergent Property

CoT is an emergent abilityβ€”it only works reliably with large models (typically 100B+ parameters). Smaller models don't benefit as much.

The Fundamental Insight

Large language models are autoregressive: each token is generated based on all previous tokens. By generating reasoning steps, the model allocates more computation to the problem. Each intermediate step serves as additional context that helps the model reason about subsequent steps. This is like giving the model "scratch paper" to work on.

How Chain of Thought Works

The mechanism behind CoT is both simple and profound. When a model generates tokens, each token is conditioned on all previous tokens. By generating reasoning steps, the model:

  1. Decomposes complex problems β€” Breaking a hard problem into smaller, manageable sub-problems
  2. Allocates more computation β€” More tokens = more forward passes = more "thinking"
  3. Provides self-context β€” Each reasoning step becomes context for the next step, creating a contextual chain
  4. Enables error correction β€” The model can detect and correct inconsistencies in its own reasoning as it continues
Standard Prompting vs Chain of Thought Standard PromptingQ: "If a train travels 60 mph for 2.5 hours,how far does it go?"A: "150 miles" ❌ (often wrong)Direct answer, no reasoning shown Chain of Thought PromptingQ: "If a train travels 60 mph for 2.5 hours,how far does it go?"A: "Distance = speed Γ— time= 60 Γ— 2.5 = 150 miles" βœ…Shows step-by-step reasoning

The key difference: standard prompting jumps to the answer; CoT generates intermediate reasoning steps.

Variants: Few-shot, Zero-shot, and Beyond

Few-shot CoT

The original approach: provide a few examples in the prompt, each showing the reasoning chain before the answer. The model learns the pattern of "reason, then answer" from the examples.

Example few-shot CoT prompt (abbreviated):

Q: Roger has 5 tennis balls. He buys 2 more cans. Each can has 3 balls. How many does he have?
A: Roger started with 5 balls. 2 cans Γ— 3 balls = 6 balls. 5 + 6 = 11. Answer: 11 balls.

Q: [Your question here]
A:

Zero-shot CoT

A simpler variant discovered by Kojima et al. (2022): just add "Let's think step by step" to the prompt. No examples needed! This works surprisingly well because the model has seen enough reasoning patterns during pre-training.

Tree of Thoughts (ToT)

Extends CoT by exploring multiple reasoning paths simultaneously. The model generates several possible next steps, evaluates each, and pursues the most promising ones. This allows backtracking and exploring alternatives, much like how humans solve complex problems.

Self-Consistency

Instead of generating one reasoning chain, generate multiple independent chains (using different random seeds or higher temperature), then take a majority vote on the final answer. This is particularly effective for tasks where there are multiple valid reasoning paths.

Few-shot CoT

Provide example reasoning chains in the prompt. Best for maximum accuracy on complex tasks.

Zero-shot CoT

Simply add "Let's think step by step." No examples needed. Good for quick use.

Tree of Thoughts

Explore multiple reasoning paths and select the best. Best for strategic planning and creative problem-solving.

Self-Consistency

Generate multiple chains and take majority vote. Simple way to boost reliability.

When to Use Chain of Thought

CoT is not a universal solution. It's most effective for specific types of tasks:

Tasks Where CoT Excels

  • Arithmetic reasoning β€” Multi-step math word problems, calculations requiring multiple operations
  • Commonsense reasoning β€” Questions requiring everyday knowledge and logical inference
  • Symbolic reasoning β€” Tasks involving formal logic, symbol manipulation, or rule application
  • Multi-hop QA β€” Questions requiring combining information from multiple sources or facts
  • Code debugging β€” Tracing through code to find bugs or understand behavior

Tasks Where CoT May Not Help

  • Simple factual recall β€” "What is the capital of France?" doesn't need reasoning
  • Creative writing β€” CoT reasoning may constrain creative output
  • Translation β€” Direct translation usually works fine without explicit reasoning

Practical Examples

Example 1: Arithmetic (Without CoT vs With CoT)

Without CoTWith CoT
Q: A store had 120 apples. They sold 35 on Monday and 42 on Tuesday. How many apples are left?

A: 43 apples.
Q: A store had 120 apples. They sold 35 on Monday and 42 on Tuesday. How many apples are left?

A: Let me think step by step. The store started with 120 apples. On Monday, they sold 35, so 120 - 35 = 85 remain. On Tuesday, they sold 42 more, so 85 - 42 = 43. Therefore, 43 apples are left.

Example 2: Multi-step Logic

With CoT, the model can solve problems requiring multiple inferential steps that would be impossible with direct prompting. For instance, "If all dogs are mammals, and all mammals are animals, and Fido is a dog, what is Fido?" The CoT reasoning: "All dogs are mammals β†’ Fido is a mammal. All mammals are animals β†’ Fido is an animal."

CoT vs Other Reasoning Techniques

TechniqueHow It WorksComplexityBest For
Chain of ThoughtLinear reasoning chainLow-MediumMulti-step math, logic, QA
Tree of ThoughtsBranching explorationHighPlanning, puzzles, creative tasks
Self-ConsistencyMultiple chains + votingMediumImproving reliability of CoT
ReActReasoning + Action interleavingMedium-HighTool use, web search, APIs
Least-to-MostDecompose then solve sub-problemsMediumVery long reasoning chains

Frequently Asked Questions

Why does chain of thought only work well with large models?

CoT is an emergent ability that appears at scale. Smaller models don't have the capacity to simultaneously maintain a coherent reasoning chain and arrive at the correct answer. Research shows that CoT benefits start appearing around 10B parameters and become dramatic at 100B+. The exact threshold depends on the model architecture and training data.

Can chain of thought produce incorrect reasoning?

Yes. While CoT significantly improves accuracy, it doesn't guarantee correctness. The model can produce plausible-sounding but incorrect reasoning chains. This is particularly dangerous because the reasoning appears convincing even when wrong. This is why techniques like self-consistency (multiple chains + voting) and verification are important complements to CoT.

Does chain of thought work with all types of models?

CoT is primarily designed for autoregressive transformer-based language models (like GPT, Claude, Llama, PaLM). It works because these models generate tokens sequentially, and each reasoning step conditions the next. It's less applicable to non-autoregressive models or models that don't generate text sequentially. It has been most extensively studied with decoder-only transformer architectures.

How does chain of thought relate to "reasoning" models?

Modern "reasoning" models like OpenAI's o1 and DeepSeek-R1 use chain of thought internally during inference. They generate hidden reasoning chains before producing the final answer, similar to CoT but done automatically and often more extensively. These models are essentially trained to use CoT-style reasoning as part of their inference process, making it a built-in capability rather than a prompting technique.

What is the cost trade-off of using chain of thought?

CoT significantly increases token usage because the model generates reasoning steps before the answer. A CoT response might be 3-10x longer than a direct answer. This increases both latency (more tokens to generate) and cost (more tokens processed). For complex tasks where accuracy is critical, this trade-off is usually worth it. For simple tasks, CoT is rarely justified.

Continue your AI learning journey

Next, learn about Prompt Injectionβ€”a critical security vulnerability in AI systems.

Read Next: Prompt Injection β†’