Dissecting Chain-of-Thought: Compositionality through In-Context Filtering and Learning
On the map: LLM reasoning → Prompting and chain-of-thought reasoning
Abstract (arXiv)
Chain-of-thought (CoT) is a method that enables language models to handle complex reasoning tasks by decomposing them into simpler steps. Despite its success, the underlying mechanics of CoT are not yet fully understood. In an attempt to shed light on this, our study investigates the impact of CoT on the ability of transformers to in-context learn a simple to study, yet general family of compositional functions: multi-layer perceptrons (MLPs). In this setting, we find that the success of CoT can be attributed to breaking down in-context learning of a compositional function into two distinct phases: focusing on and filtering data related to each step of the composition and in-context learning the single-step composition function. Through both experimental and theoretical evidence, we demonstrate how CoT significantly reduces the sample complexity of in-context learning (ICL) and facilitates the learning of complex functions that non-CoT methods struggle with. Furthermore, we illustrate how transformers can transition from vanilla in-context learning to mastering a compositional function with CoT by simply incorporating additional layers that perform the necessary data-filtering for CoT via the attention mechanism. In addition to these test-time benefits, we show CoT helps accelerate pretraining by learning shortcuts to represent complex functions and filtering plays an important role in this process. These findings collectively provide insights into the mechanics of CoT, inviting further investigation of its role in complex reasoning tasks.
Key facts. Cited by 19 papers in the map (data through 7 Oct 2026). Placed in Prompting and chain-of-thought reasoning, one of 17 directions in LLM reasoning. Builds on 30 of its 47 references that are in the map. First posted on arXiv 30 May 2023.
Builds on
30 of 47 references.
Closest ancestors · 1
Same direction, newest first
Other references · 29
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
- 2022Emergent Abilities of Large Language Modelscited by 2,483
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
- 2021Show Your Work: Scratchpads for Intermediate Computation with Language Modelscited by 871
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
- 2023Faith and Fate: Limits of Transformers on Compositionalitycited by 496
- 2021MetaICL: Learning to Learn In Contextcited by 450
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
- 2023Larger language models do in-context learning differentlycited by 386
17 more
- 2022Transformers Learn Shortcuts to Automatacited by 260
- 2022Can language models learn from explanations in context?cited by 248
- 2023MathPrompter: Mathematical Reasoning using Large Language Modelscited by 236
- 2023Looped Transformers as Programmable Computerscited by 224
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2020WT5?! Training Text-to-Text Models to Explain their Predictionscited by 148
- 2023How well do Large Language Models perform in Arithmetic tasks?cited by 130
- 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
- 2022Teaching Algorithmic Reasoning via In-context Learningcited by 111
- 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
- 2023A Theoretical Understanding of Shallow Vision Transformers: Learning, Generalization, and Sample Complexitycited by 77
- 2022Z-ICL: Zero-Shot In-Context Learning with Pseudo-Demonstrationscited by 70
- 2018Memorize or generalize? Searching for a compositional RNN in a haystackcited by 41
- 2020Tight Hardness Results for Training Depth-2 ReLU Networkscited by 35
- 2023Learning to Reason and Memorize with Self-Notescited by 30
- 2017Learning to Compose Skillscited by 15
- 2021Automatic Code Generation using Pre-Trained Language Modelscited by 8
Built on by
Citing papers per year: 2023: 7; 2024: 8; 2025: 4.
19 papers.
Sort:
By area:
- 2023Navigate through Enigmatic Labyrinth A Survey of Chain of Thought Reasoning: Advances, Frontiers and Futurecited by 184
- 2024The Impact of Reasoning Step Length on Large Language Modelscited by 152
- 2023Uncovering mesa-optimization algorithms in Transformerscited by 94
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 72
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Surveycited by 62
- 2023Max-Margin Token Selection in Attention Mechanismcited by 57
- 2024From Sparse Dependence to Sparse Attention: Unveiling How Chain-of-Thought Enhances Transformer Sample Efficiencycited by 28
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methodscited by 27
- 2024Understanding Reasoning Ability of Language Models From the Perspective of Reasoning Paths Aggregationcited by 22
- 2023Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Taskscited by 21
- 2024A Theoretical Understanding of Chain-of-Thought: Coherent Reasoning and Error-Aware Demonstrationcited by 13
- 2024A Theory for Length Generalization in Learning to Reasoncited by 11
7 more
- 2025Learning Task Representations from In-Context Learningcited by 11
- 2024Towards an Understanding of Stepwise Inference in Transformers: A Synthetic Graph Navigation Modelcited by 9
- 2023Conditions for Length Generalization in Learning Reasoning Skillscited by 7
- 2025Don't Take Things Out of Context: Attention Intervention for Enhancing Chain-of-Thought Reasoning in Large Language Modelscited by 7
- 2024Theoretical Understanding of In-Context Learning in Shallow Transformers with Unstructured Datacited by 5
- 2025ALAS: Transactional and Dynamic Multi-Agent LLM Planningcited by 3
- 2025Language Ranker: A Lightweight Ranking framework for LLM Decodingcited by 2
- 2025ALAS: Transactional and Dynamic Multi-Agent LLM Planning5 Nov 2025
- 2025Language Ranker: A Lightweight Ranking framework for LLM Decoding23 Oct 2025
- 2025Don't Take Things Out of Context: Attention Intervention for Enhancing Chain-of-Thought Reasoning in Large Language Models14 Mar 2025
- 2025Learning Task Representations from In-Context Learning8 Feb 2025
- 2024A Theoretical Understanding of Chain-of-Thought: Coherent Reasoning and Error-Aware Demonstration21 Oct 2024
- 2024From Sparse Dependence to Sparse Attention: Unveiling How Chain-of-Thought Enhances Transformer Sample Efficiency7 Oct 2024
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methods25 Aug 2024
- 2024A Theory for Length Generalization in Learning to Reason31 Mar 2024
- 2024Towards an Understanding of Stepwise Inference in Transformers: A Synthetic Graph Navigation Model12 Feb 2024
- 2024Understanding Reasoning Ability of Language Models From the Perspective of Reasoning Paths Aggregation5 Feb 2024
- 2024Theoretical Understanding of In-Context Learning in Shallow Transformers with Unstructured Data1 Feb 2024
- 2024The Impact of Reasoning Step Length on Large Language Models10 Jan 2024
7 more
- 2023Conditions for Length Generalization in Learning Reasoning Skills22 Nov 2023
- 2023Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Tasks21 Nov 2023
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representations16 Oct 2023
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Survey8 Oct 2023
- 2023Navigate through Enigmatic Labyrinth A Survey of Chain of Thought Reasoning: Advances, Frontiers and Future27 Sep 2023
- 2023Uncovering mesa-optimization algorithms in Transformers11 Sep 2023
- 2023Max-Margin Token Selection in Attention Mechanism23 Jun 2023
- 2023Navigate through Enigmatic Labyrinth A Survey of Chain of Thought Reasoning: Advances, Frontiers and Futurecited by 184
- 2024The Impact of Reasoning Step Length on Large Language Modelscited by 152
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Surveycited by 62
- 2024From Sparse Dependence to Sparse Attention: Unveiling How Chain-of-Thought Enhances Transformer Sample Efficiencycited by 28
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methodscited by 27
- 2024Understanding Reasoning Ability of Language Models From the Perspective of Reasoning Paths Aggregationcited by 22
- 2024A Theoretical Understanding of Chain-of-Thought: Coherent Reasoning and Error-Aware Demonstrationcited by 13
- 2024Towards an Understanding of Stepwise Inference in Transformers: A Synthetic Graph Navigation Modelcited by 9
- 2023Conditions for Length Generalization in Learning Reasoning Skillscited by 7
- 2025Don't Take Things Out of Context: Attention Intervention for Enhancing Chain-of-Thought Reasoning in Large Language Modelscited by 7
- 2025Don't Take Things Out of Context: Attention Intervention for Enhancing Chain-of-Thought Reasoning in Large Language Models14 Mar 2025
- 2024A Theoretical Understanding of Chain-of-Thought: Coherent Reasoning and Error-Aware Demonstration21 Oct 2024
- 2024From Sparse Dependence to Sparse Attention: Unveiling How Chain-of-Thought Enhances Transformer Sample Efficiency7 Oct 2024
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methods25 Aug 2024
- 2024Towards an Understanding of Stepwise Inference in Transformers: A Synthetic Graph Navigation Model12 Feb 2024
- 2024Understanding Reasoning Ability of Language Models From the Perspective of Reasoning Paths Aggregation5 Feb 2024
- 2024The Impact of Reasoning Step Length on Large Language Models10 Jan 2024
- 2023Conditions for Length Generalization in Learning Reasoning Skills22 Nov 2023
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Survey8 Oct 2023
- 2023Navigate through Enigmatic Labyrinth A Survey of Chain of Thought Reasoning: Advances, Frontiers and Future27 Sep 2023
- 2025ALAS: Transactional and Dynamic Multi-Agent LLM Planningcited by 3
- 2025ALAS: Transactional and Dynamic Multi-Agent LLM Planning5 Nov 2025
- 2023Uncovering mesa-optimization algorithms in Transformerscited by 94
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 72
- 2023Max-Margin Token Selection in Attention Mechanismcited by 57
- 2023Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Taskscited by 21
- 2024A Theory for Length Generalization in Learning to Reasoncited by 11
- 2025Learning Task Representations from In-Context Learningcited by 11
- 2024Theoretical Understanding of In-Context Learning in Shallow Transformers with Unstructured Datacited by 5
- 2025Learning Task Representations from In-Context Learning8 Feb 2025
- 2024A Theory for Length Generalization in Learning to Reason31 Mar 2024
- 2024Theoretical Understanding of In-Context Learning in Shallow Transformers with Unstructured Data1 Feb 2024
- 2023Compositional Capabilities of Autoregressive Transformers: A Study on Synthetic, Interpretable Tasks21 Nov 2023
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representations16 Oct 2023
- 2023Uncovering mesa-optimization algorithms in Transformers11 Sep 2023
- 2023Max-Margin Token Selection in Attention Mechanism23 Jun 2023
Similar, not cited
Close in wording, no citation either way
- 2025The Curse of CoT: On the Limitations of Chain-of-Thought in In-Context Learning
- 2024Training Nonlinear Transformers for Chain-of-Thought Inference: A Theoretical Generalization Analysis
- 2025Compositional Generalization from Learned Skills via CoT Training: A Theoretical and Structural Analysis for Reasoning
- 2025Revisiting Chain-of-Thought Prompting: Zero-shot Can Be Stronger than Few-shot
- 2026An Asymptotic Theory of Chain-of-Thought in In-Context Learning
- 2025CoT is Not True Reasoning, It Is Just a Tight Constraint to Imitate: A Theory Perspective
- 2025CoT-ICL Lab: A Synthetic Framework for Studying Chain-of-Thought Learning from In-Context Demonstrations
- 2025To Think or Not to Think: The Hidden Cost of Meta-Training with Excessive CoT Examples