Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization
By: Yu Huang , Zixin Wen , Aarti Singh and more
Potential Business Impact:
AI learns to solve harder problems with longer thinking.
The ability to reason lies at the core of artificial intelligence (AI), and challenging problems usually call for deeper and longer reasoning to tackle. A crucial question about AI reasoning is whether models can extrapolate learned reasoning patterns to solve harder tasks with longer chain-of-thought (CoT). In this work, we present a theoretical analysis of transformers learning on synthetic state-tracking tasks with gradient descent. We mathematically prove how the algebraic structure of state-tracking problems governs the degree of extrapolation of the learned CoT. Specifically, our theory characterizes the length generalization of transformers through the mechanism of attention concentration, linking the retrieval robustness of the attention layer to the state-tracking task structure of long-context reasoning. Moreover, for transformers with limited reasoning length, we prove that a recursive self-training scheme can progressively extend the range of solvable problem lengths. To our knowledge, we provide the first optimization guarantee that constant-depth transformers provably learn $\mathsf{NC}^1$-complete problems with CoT, significantly going beyond prior art confined in $\mathsf{TC}^0$, unless the widely held conjecture $\mathsf{TC}^0 \neq \mathsf{NC}^1$ fails. Finally, we present a broad set of experiments supporting our theoretical results, confirming the length generalization behaviors and the mechanism of attention concentration.
Similar Papers
Reasoning by Superposition: A Theoretical Perspective on Chain of Continuous Thought
Machine Learning (CS)
Helps computers solve problems faster by thinking in parallel.
Multi-head Transformers Provably Learn Symbolic Multi-step Reasoning via Gradient Descent
Machine Learning (CS)
Teaches computers to solve problems step-by-step.
Eliciting Chain-of-Thought in Base LLMs via Gradient-Based Representation Optimization
Computation and Language
Teaches computers to think step-by-step to solve problems.