Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Huang, Yu, Wen, Zixin, Singh, Aarti, Chi, Yuejie, Chen, Yuxin
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866909896649211904
author Huang, Yu
Wen, Zixin
Singh, Aarti
Chi, Yuejie
Chen, Yuxin
author_facet Huang, Yu
Wen, Zixin
Singh, Aarti
Chi, Yuejie
Chen, Yuxin
contents 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.
format Preprint
id arxiv_https___arxiv_org_abs_2511_07378
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization
Huang, Yu
Wen, Zixin
Singh, Aarti
Chi, Yuejie
Chen, Yuxin
Machine Learning
Artificial Intelligence
Optimization and Control
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.
title Transformers Provably Learn Chain-of-Thought Reasoning with Length Generalization
topic Machine Learning
Artificial Intelligence
Optimization and Control
url https://arxiv.org/abs/2511.07378