Multi-head Transformers Provably Learn Symbolic Multi-step Reasoning via Gradient Descent

Fuente: arXiv
Salvato in:
Dettagli Bibliografici
Autori principali: Yang, Tong, Huang, Yu, Liang, Yingbin, Chi, Yuejie
Natura: Preprint
Pubblicazione: 2025
Soggetti:
Accesso online:
Tags: Aggiungi Tag
Nessun Tag, puoi essere il primo ad aggiungerne!!
_version_ 1866917130242359296
author Yang, Tong
Huang, Yu
Liang, Yingbin
Chi, Yuejie
author_facet Yang, Tong
Huang, Yu
Liang, Yingbin
Chi, Yuejie
contents Transformers have demonstrated remarkable capabilities in multi-step reasoning tasks. However, understandings of the underlying mechanisms by which they acquire these abilities through training remain limited, particularly from a theoretical standpoint. This work investigates how transformers learn to solve symbolic multi-step reasoning problems through chain-of-thought processes, focusing on path-finding in trees. We analyze two intertwined tasks: a backward reasoning task, where the model outputs a path from a goal node to the root, and a more complex forward reasoning task, where the model implements two-stage reasoning by first identifying the goal-to-root path and then reversing it to produce the root-to-goal path. Our theoretical analysis, grounded in the dynamics of gradient descent, shows that trained one-layer transformers can provably solve both tasks with generalization guarantees to unseen trees. In particular, our multi-phase training dynamics for forward reasoning elucidate how different attention heads learn to specialize and coordinate autonomously to solve the two subtasks in a single autoregressive path. These results provide a mechanistic explanation of how trained transformers can implement sequential algorithmic procedures. Moreover, they offer insights into the emergence of reasoning abilities, suggesting that when tasks are structured to take intermediate chain-of-thought steps, even shallow multi-head transformers can effectively solve problems that would otherwise require deeper architectures.
format Preprint
id arxiv_https___arxiv_org_abs_2508_08222
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Multi-head Transformers Provably Learn Symbolic Multi-step Reasoning via Gradient Descent
Yang, Tong
Huang, Yu
Liang, Yingbin
Chi, Yuejie
Machine Learning
Artificial Intelligence
Information Theory
Optimization and Control
Transformers have demonstrated remarkable capabilities in multi-step reasoning tasks. However, understandings of the underlying mechanisms by which they acquire these abilities through training remain limited, particularly from a theoretical standpoint. This work investigates how transformers learn to solve symbolic multi-step reasoning problems through chain-of-thought processes, focusing on path-finding in trees. We analyze two intertwined tasks: a backward reasoning task, where the model outputs a path from a goal node to the root, and a more complex forward reasoning task, where the model implements two-stage reasoning by first identifying the goal-to-root path and then reversing it to produce the root-to-goal path. Our theoretical analysis, grounded in the dynamics of gradient descent, shows that trained one-layer transformers can provably solve both tasks with generalization guarantees to unseen trees. In particular, our multi-phase training dynamics for forward reasoning elucidate how different attention heads learn to specialize and coordinate autonomously to solve the two subtasks in a single autoregressive path. These results provide a mechanistic explanation of how trained transformers can implement sequential algorithmic procedures. Moreover, they offer insights into the emergence of reasoning abilities, suggesting that when tasks are structured to take intermediate chain-of-thought steps, even shallow multi-head transformers can effectively solve problems that would otherwise require deeper architectures.
title Multi-head Transformers Provably Learn Symbolic Multi-step Reasoning via Gradient Descent
topic Machine Learning
Artificial Intelligence
Information Theory
Optimization and Control
url https://arxiv.org/abs/2508.08222