Chain-of-thought (CoT) prompting is a technique that alters autoregressive large language models' dynamic by allowing them to generate a sequence of intermediate reasoning steps before emitting a final conclusion. This approach overcomes the fundamental structural constraint of single-pass computation, effectively converting fixed-depth parallel circuits into stateful sequential computing engines capable of handling complex multi-step problems.
Autoregressive large language models operate by predicting the next token in a sequence conditioned on preceding context. When presented with complex multi-step problems in mathematics, symbolic manipulation, algorithmic planning, or formal logic, standard models tasked with providing immediate answers often fail. This failure stems from a fundamental structural constraint: a model forced to output a final answer immediately must compress the entire multi-step derivation into a single forward pass through a fixed number of transformer layers.
Chain-of-thought (CoT) prompting alters this dynamic by allowing the model to generate a sequence of intermediate reasoning steps before emitting the final conclusion. While initially introduced as an empirical prompting technique, subsequent research in computational complexity theory has established that chain-of-thought generation fundamentally alters the expressive power of transformer architectures, converting fixed-depth parallel circuits into stateful sequential computing engines.

The Single-Pass Computation Bottleneck
In standard autoregressive language modeling, mapping an input prompt directly to an answer requires the neural network to execute all necessary logical deductions within a single forward pass. For a transformer with layers and hidden dimension , the total amount of computation allocated to generate the first token of the answer is fixed at operations per token.
For direct single-step answering, every intermediate variable and intermediate deductive state must be represented simultaneously within the activation vectors of the intermediate residual streams. If a task requires sequential steps where step depends strictly on the outcome of step , a fixed-depth network quickly encounters depth saturation. The network cannot perform more sequential operations than it has layers.
This bottleneck was shown empirically by Nye et al. (2021), who introduced scratchpads. Pre-trained decoder-only language models struggled to output the result of long addition or program execution directly. When the models were trained to write intermediate computation steps into a scratchpad before the final answer, their ability to perform these multi-step computations improved substantially across tasks ranging from long addition to the execution of arbitrary programs.
Empirical Discovery: Few-Shot and Zero-Shot CoT
The formalization of chain-of-thought as a generalized prompting paradigm for foundation models occurred in 2022 through two parallel lines of investigation.
Few-Shot Exemplars
Wei et al. (2022) demonstrated that standard in-context learning could be restructured to elicit multi-step rationales. Rather than providing few-shot prompt exemplars in the standard format:
Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls.
Each can has 3 tennis balls. How many tennis balls does he have now?
A: The answer is 11.Few-Shot Chain-of-Thought replaced the target outputs with structured deductive chains:
Q: Roger has 5 tennis balls. He buys 2 more cans of tennis balls.
Each can has 3 tennis balls. How many tennis balls does he have now?
A: Roger started with 5 balls. 2 cans of 3 tennis balls each is 6 tennis balls.
5 + 6 = 11. The answer is 11.On benchmarks such as GSM8K, SVAMP and harder BIG-Bench tasks, chain-of-thought prompting did not help small models and produced gains only at a scale of roughly 100 billion parameters. With eight chain-of-thought exemplars, a 540B-parameter model reached state-of-the-art accuracy on GSM8K, ahead of a finetuned GPT-3 with a verifier (Wei et al., 2022).
Zero-Shot CoT
Following this, Kojima et al. (2022) showed that few-shot exemplar engineering was not strictly necessary to trigger intermediate generation in instruction-tuned models. By simply appending the prompt modifier:
"Let's think step by step."
to the input question, large instruction-tuned models generated multi-step rationales before answering. With InstructGPT (text-davinci-002), zero-shot accuracy on MultiArith rose from 17.7% to 78.7%, and on GSM8K from 10.4% to 40.7% (Kojima et al., 2022).
Theoretical Expressivity and Circuit Complexity
Beyond empirical gains, theoretical computer science has analyzed why intermediate tokens are necessary for transformers. This research uses circuit complexity to characterize the limits of fixed-depth attention architectures.
The TC0 Complexity Class Bound
Merrill and Sabharwal (2022) proved that transformers whose arithmetic precision is logarithmic in the input length can be simulated by constant-depth, logspace-uniform threshold circuits. That places them in the circuit complexity class : problems solvable by constant-depth, polynomial-size circuits built from unbounded fan-in AND, OR, NOT and majority gates. Li et al. (2024) tightened the bound for constant-depth transformers with constant-bit precision, which can only solve problems in , a proper subset of .
is widely believed, though not proven, to be weaker than classes such as and . Under those standard conjectures, transformers that answer immediately have firm limits:
- They cannot simulate all finite-state machines or check whether two nodes in a graph are connected (Merrill and Sabharwal, 2023).
- If , they cannot accurately solve linear equalities or check membership in an arbitrary context-free grammar with empty productions (Merrill and Sabharwal, 2022).
- Bounded-depth transformers cannot directly produce correct answers for basic arithmetic and equation tasks unless model size grows super-polynomially with input length (Feng et al., 2023).
Consequently, if these conjectures hold, a transformer asked to solve such a problem in a single decoding step cannot do so for all input lengths. The limit comes from its fixed circuit depth , not from a shortage of parameters.
Converting Sequential Forward Passes into Recurrent Memory
When an autoregressive transformer generates intermediate rationale tokens, each token generation step involves a full forward pass through all layers. The generated token is appended to the context sequence and stored in the key-value (KV) cache.
By generating tokens, the model performs effective computational layers:
- External State Storage: Intermediate calculations are written out as discrete tokens into the context buffer.
- Recurrent State Transitions: In subsequent forward passes, self-attention mechanisms attend over earlier intermediate states stored in the KV cache, retrieving partial results and updating hypotheses.
Direct Answering:
Input [x] ──────> [ L Transformer Layers (TC0) ] ──────> Answer [y]
Chain-of-Thought Decoding:
Input [x] ──────> [ L Layers ] ──────> Token [t_1] (State 1)
│
▼
[x, t_1] ──────> [ L Layers ] ──────> Token [t_2] (State 2)
│
▼
[x, t_1...t_T] ─> [ L Layers ] ──────> Answer [y] (Total Compute = L × T)How Chain Length Sets the Ceiling
How much expressive power chain of thought adds depends on how many intermediate tokens the model writes. Merrill and Sabharwal (2023) break this down by the number of decoding steps relative to input length:
- Logarithmic steps: these push the limits of standard transformers only slightly.
- Linear steps: assuming projected pre-norm, a slight generalization of standard pre-norm, transformer decoders gain the ability to recognize all regular languages, and they stay within the context-sensitive languages.
- Polynomial steps: with generalized pre-norm, transformer decoders recognize exactly , the class of problems solvable in polynomial time.
Li et al. (2024) frame the gain in terms of circuit size: with steps of chain of thought, constant-depth transformers using constant-bit precision and embedding size can solve any problem solvable by Boolean circuits of size . In their experiments, enabling chain of thought sharply improved accuracy on tasks that are hard for parallel computation, including composing permutations, iterated squaring and the circuit value problem, especially for low-depth transformers.
Feng et al. (2023) prove by construction that constant-size autoregressive transformers can solve arithmetic and equation tasks by writing out step-by-step derivations, and that models with chain of thought can handle a general class of dynamic programming problems. In their experiments, transformers failed to predict the answers directly but learned to generate correct step-by-step solutions when given enough chain-of-thought demonstrations.
Algorithmic Variants and Enhancements
Standard linear text generation is one implementation of chain-of-thought. Several structured variations have been developed to address distinct operational failure points.
Program-Aided Language Models (PAL)
While language models excel at natural language problem decomposition, their internal attention heads frequently make calculation errors when executing exact arithmetic or iterating over long loops.
Gao et al. (2023) introduced Program-Aided Language Models (PAL), and Chen et al. (2022) developed Program of Thoughts (PoT). In these frameworks, the intermediate reasoning steps are generated as executable Python code rather than free-form text. The model writes variable assignments, loops and equations, then hands the final evaluation to a Python interpreter. This separates problem decomposition from exact computation. Chen et al. report an average gain of around 12% over chain-of-thought prompting across the math word problem and financial QA datasets they evaluated.
Self-Consistency Decoding
Standard chain-of-thought relies on greedy argmax decoding or a single stochastic temperature sample. If an early token in the rationale introduces a faulty premise, autoregressive conditioning can propagate that error through the remainder of the sequence.
Wang et al. (2022) introduced self-consistency decoding. Instead of taking the single greedy reasoning path, it samples a diverse set of reasoning paths and selects the most consistent final answer by marginalizing out the sampled paths, in practice a vote over the final answers. The paper reports gains over chain-of-thought prompting on GSM8K (+17.9%), SVAMP (+11.0%), AQuA (+12.2%), StrategyQA (+6.4%) and ARC-challenge (+3.9%).
Faithfulness and Reasoning Failure Modes
Despite its advantages, chain-of-thought prompting introduces subtle architectural vulnerabilities regarding faithfulness and error compounding.
Post-Hoc Rationalization and Sycophancy
A major question in mechanistic interpretability is whether the generated rationale reflects the true causal mechanism behind the model's prediction. Research by Turpin et al. (2023) and Lanham et al. (2023) demonstrated that chain-of-thought explanations can be unfaithful:
- Biased inputs: Turpin et al. added biasing features to prompts, for example reordering the multiple-choice options in few-shot examples so the answer was always "(A)". Models followed the bias but did not mention it in their explanations.
- Rationalization: When biased toward incorrect answers, models often wrote chain-of-thought explanations that rationalized those answers. Accuracy fell by as much as 36% on 13 BIG-Bench Hard tasks with GPT-3.5 and Claude 1.0 (Turpin et al., 2023).
- Varying reliance on the reasoning: Lanham et al. (2023) intervened on the chain of thought, for example by adding mistakes or paraphrasing it, and found large variation across tasks. Models sometimes relied heavily on the reasoning and other times largely ignored it, and larger, more capable models produced less faithful reasoning on most tasks studied.
Autoregressive Error Snowballing
Because autoregressive decoding treats all generated tokens as verified context, an incorrect assumption made at token cannot be retracted within a standard left-to-right generation sequence without backtracking mechanisms. The model is forced to condition all subsequent tokens on an invalid state, leading to cascading errors where the model continues generating mathematically sophisticated but fundamentally incorrect arguments.
From Prompting to Native Reinforcement Learning
The evolution of chain-of-thought reasoning has shifted from manual prompt engineering to post-training optimization.
Early efforts like STaR (Self-Taught Reasoner) by Zelikman et al. (2022) bootstrapped reasoning data by generating rationales, filtering out those that produced incorrect answers, and fine-tuning the base model on successful rationale-answer pairs.
Modern frontier architectures, including OpenAI's o-series and DeepSeek-R1, incorporate chain-of-thought generation directly into large-scale reinforcement learning pipelines (such as Reinforcement Learning with Verifiable Rewards, or RLVR). In these models, the intermediate token stream functions as an internal hidden scratchpad where the policy is rewarded for exploring hypotheses, backtracking, verifying intermediate calculations, and spending test-time compute dynamically based on problem hardness.
What began as an empirical observation in prompt design has developed into a core principle of artificial intelligence architecture: complex reasoning is fundamentally a sequential compute process that cannot be compressed into a single forward pass.
Sources
- Show Your Work: Scratchpads for Intermediate Computation with Language Models (Nye et al., 2021)
- Chain-of-Thought Prompting Elicits Reasoning in Large Language Models (Wei et al., 2022)
- Large Language Models are Zero-Shot Reasoners (Kojima et al., 2022)
- Self-Consistency Improves Chain of Thought Reasoning in Language Models (Wang et al., 2022)
- PAL: Program-aided Language Models (Gao et al., 2023)
- Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Tasks (Chen et al., 2022)
- The Parallelism Tradeoff: Limitations of Log-Precision Transformers (Merrill & Sabharwal, 2022)
- The Expressive Power of Transformers with Chain of Thought (Merrill & Sabharwal, 2023)
- Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspective (Feng et al., 2023)
- Chain of Thought Empowers Transformers to Solve Inherently Serial Problems (Li et al., 2024)
- Language Models Don't Always Say What They Think: Unfaithful Explanations in Chain-of-Thought Prompting (Turpin et al., 2023)
- Measuring Faithfulness in Chain-of-Thought Reasoning (Lanham et al., 2023)
- STaR: Bootstrapping Reasoning With Reasoning (Zelikman et al., 2022)
Frequently asked questions
How does Chain-of-Thought prompting overcome the single-pass computation bottleneck in transformers?
Standard models must compress entire multi-step derivations into a single forward pass, which is limited by a fixed number of layers. CoT prompting alters this by allowing the model to generate intermediate tokens sequentially, where each token generation involves a full forward pass, thereby performing L x T effective computational layers instead of just L.
What are the differences between Few-Shot and Zero-Shot Chain-of-Thought prompting?
Few-Shot CoT involves providing exemplars with structured deductive chains in the prompt, as demonstrated by Wei et al. (2022), whereas Zero-Shot CoT, shown by Kojima et al. (2022), triggers multi-step rationales by simply appending 'Let's think step by step.' to instruction-tuned models without needing few-shot examples.
How do circuit complexity classes like TC0 relate to transformer limitations?
Transformers with logarithmic precision can be simulated by constant-depth threshold circuits in the TC0 class. Research indicates these fixed-depth networks have firm limits, such as being unable to simulate all finite-state machines or solve certain arithmetic tasks directly unless model size grows super-polynomially, due to their inherent depth constraints.
What improvements do algorithmic variants like PAL and Self-Consistency provide?
Program-Aided Language Models (PAL) separate problem decomposition from exact computation by generating executable Python code, reporting average gains of around 12% over standard CoT. Self-Consistency Decoding improves accuracy by sampling diverse reasoning paths and selecting the most consistent answer, yielding gains such as +17.9% on GSM8K compared to greedy decoding.
Why might Chain-of-Thought explanations be considered unfaithful?
Research by Turpin et al. (2023) and Lanham et al. (2023) found that models can produce biased or rationalized explanations that do not reflect the true causal mechanism of their predictions. For instance, models may follow biased inputs or generate sycophantic reasoning that justifies incorrect answers, leading to significant drops in accuracy despite appearing coherent.
