Transformers with CoT Discover Heavy-Ball Acceleration Through Training

Cai, Yuxuan, Cao, Yuan

–arXiv.org Artificial Intelligence 

Transformers have demonstrated remarkable success across a wide range of applications, including natural language processing (Vaswani et al., 2017) and computer vision (Dosovitskiy, 2020). These models have also exhibited complex reasoning abilities, particularly in mathematical problem solving and coding (Chowdhery et al., 2023). Chain-of-thought (CoT) reasoning has emerged as a key approach for enhancing such reasoning capabilities, enabling models to generate intermediate reasoning steps before producing the final answer (Wei et al., 2022; Kojima et al., 2022). To theoretically understand the capabilities of transformers, recent works have viewed transformers as "algorithm executors." In particular, transformers have been shown to implement optimization algorithms for in-context learning tasks, where the context is modeled as the training dataset for a learning problem. Aky urek et al. (2022); Von Oswald et al. (2023) empirically demonstrated that transformers can perform in-context linear regression via gradient descent. Zhang et al. (2024) theoretically showed that one-layer transformers can be trained to perform in-context linear regression, while Ahn et al. (2023) showed that deep transformers can be trained to implement preconditioned gradient descent. Guo et al. (2024); Bai et al. (2023) further demonstrated the in-context learning capabilities of transformers by constructing multi-head ReLU transformers that implement a variety of learning algorithms. Gatmiry et al. (2024) showed that looped transformers School of Computing & Data Science, The University of Hong Kong; chriscai@connect.hku.hk