Lune

NeurIPS2023Top-tier venue

Dissecting Chain-of-Thought: Compositionality through In-Context Filtering and Learning

Yingcong Li, Kartik Sreenivasan, Angeliki Giannou, Dimitris Papailiopoulos, Samet Oymak

Abstract

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.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

24 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyond cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyond cites Language Models are Few-Shot Learners
  • Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyond cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyond cites Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks
  • Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyond cites Transformers Learn In-Context by Gradient Descent
  • Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyond cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • An Explanation of In-context Learning as Implicit Bayesian Inference cites Language Models are Few-Shot Learners
  • Chain-of-Thought Reasoning Without Prompting cites Language Models are Few-Shot Learners
  • Chain-of-Thought Reasoning Without Prompting cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Why Larger Language Models Do In-context Learning Differently? cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Why Larger Language Models Do In-context Learning Differently? cites Language Models are Few-Shot Learners
  • Why Larger Language Models Do In-context Learning Differently? cites Chain-of-Thought Prompting Elicits Reasoning in Large Language Models
  • Why Larger Language Models Do In-context Learning Differently? cites Transformers Learn In-Context by Gradient Descent
  • Why Larger Language Models Do In-context Learning Differently? cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites Language Models are Few-Shot Learners
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites Transformers Learn In-Context by Gradient Descent
  • Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning Tasks cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Transformers Learn In-Context by Gradient Descent cites Language Models are Few-Shot Learners
  • Transformers Learn In-Context by Gradient Descent cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers24

  1. Chain-of-Thought Reasoning Without PromptingXuezhi Wang, Denny ZhouNeurIPS 2024 · 305 citations
  2. Can Mamba Learn How To Learn? A Comparative Study on In-Context Learning TasksJongho Park, Jaeseung Park, Zheyang Xiong, Nayoung Lee et al.ICML 2024 · 124 citations
  3. Why Larger Language Models Do In-context Learning Differently?Zhenmei Shi, Junyi Wei, Zhuoyan Xu, Yingyu LiangICML 2024 · 54 citations
  4. Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and BeyondYingcong Li, Ankit Singh Rawat, Samet OymakNeurIPS 2024 · 24 citations
  5. Transformers Provably Learn Chain-of-Thought Reasoning with Length GeneralizationYu Huang, Zixin Wen, Aarti Singh, Yuejie Chi et al.NeurIPS 2025 · 22 citations

Builds on20

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Chain-of-Thought Prompting Elicits Reasoning in Large Language ModelsJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma et al.NeurIPS 2022 · 22,562 citations
  3. An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 citations
  4. What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
  5. Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations

Related papers

  1. Chain-of-Thought Provably Enables Learning the (Otherwise) UnlearnableChenxiao Yang, Zhiyuan Li, David WipfICLR 2025
  2. Training Nonlinear Transformers for Chain-of-Thought Inference: A Theoretical Generalization AnalysisHongkang Li, Songtao Lu, Pin-Yu Chen, Xiaodong Cui et al.ICLR 2025
  3. Compositional Generalization from Learned Skills via CoT Training: A Theoretical and Structural Analysis for ReasoningXinhao Yao, Ruifeng Ren, Yun Liao, Lizhong Ding et al.ICLR 2026 · 6 citations
  4. LaRS: Latent Reasoning Skills for Chain-of-Thought ReasoningZifan Xu, Haozhu Wang, Dmitriy Bespalov, Xian Wu et al.EMNLP Findings 2024 · 4 citations
  5. Transformers Learn to Implement Multi-step Gradient Descent with Chain of ThoughtJianhao Huang, Zixuan Wang, Jason D. LeeICLR 2025
Dusk over the sea between two cliffs drawn in fine vertical lines