近期的理论研究发现了一些极其简单的推理问题,例如判断图中两个节点是否连通、模拟有限状态机等,已被证明无法由读取输入后立即作答的标准Transformer解决。但在实际应用中,允许Transformer使用“思维链(chain of thought)”或“草稿板(scratchpad)”——即在回答前生成一系列中间token并基于这些中间token进行推理——能够提升其推理能力。受此启发,我们提出问题:这种中间生成机制是否能从根本上拓展仅解码器(decoder-only)Transformer的计算能力?我们证明答案是肯定的,但能力提升的幅度关键取决于中间生成的量。例如,我们发现,解码步数为(相对于输入长度)对数级的Transformer解码器,仅能略微突破标准Transformer的能力上限;而在采用投影预归一化(projected pre-norm,标准预归一化的轻微推广)的假设下,线性步数的解码步数能带来明确的新能力(在标准复杂性猜想下):可识别所有正则语言。我们的结果还表明,线性步数下Transformer解码器的能力仍限定在上下文有关语言范围内;而采用广义预归一化的多项式步数Transformer解码器,恰好能识别所有多项式时间可解问题——这是首次用标准复杂性类对一类Transformer的能力给出精确刻画。综上,本研究提供了一个精细的框架,用于理解Transformer的思维链或草稿板长度如何影响其推理能力。
英文摘要:
Recent theoretical work has identified surprisingly simple reasoning problems, such as checking if two nodes in a graph are connected or simulating finite-state machines, that are provably unsolvable by standard transformers that answer immediately after reading their input. However, in practice, transformers' reasoning can be improved by allowing them to use a "chain of thought" or "scratchpad", i.e., generate and condition on a sequence of intermediate tokens before answering. Motivated by this, we ask: Does such intermediate generation fundamentally extend the computational power of a decoder-only transformer? We show that the answer is yes, but the amount of increase depends crucially on the amount of intermediate generation. For instance, we find that transformer decoders with a logarithmic number of decoding steps (w.r.t. the input length) push the limits of standard transformers only slightly, while a linear number of decoding steps, assuming projected pre-norm (a slight generalization of standard pre-norm), adds a clear new ability (under standard complexity conjectures): recognizing all regular languages. Our results also imply that linear steps keep transformer decoders within context-sensitive languages, and polynomial steps with generalized pre-norm make them recognize exactly the class of polynomial-time solvable problems -- the first exact characterization of a type of transformers in terms of standard complexity classes. Together, this provides a nuanced framework for understanding how the length of a transformer's chain of thought or scratchpad impacts its reasoning power.
Compositional Reasoning with Transformers, RNNs, and Chain of Thought
Courant Institute of Mathematical Sciences(Courant数学科学研究所);New York University(纽约大学);Center for Data Science(数据科学中心);Center for Computational Mathematics(计算数学中心);Flatiron Institute(Flatiron研究所)
Finite State Automata Inside Transformers with Chain-of-Thought: A Mechanistic Study on State Tracking
Key Laboratory of High Confidence Software Technology (PKU), MOE, China(高性能软件技术关键实验室(PKU),教育部,中国);School of Computer Science, Peking University, China(北京大学计算机学院,中国);The University of Hong Kong(香港大学);Shanghai AI Lab(上海人工智能实验室)
Think Consistently, Reason Efficiently: Energy-Based Calibration for Implicit Chain-of-Thought
University of Oxford(牛津大学);Tsinghua University(清华大学);Tencent(腾讯);Southern University of Science and Technology(南方科技大学);National University of Singapore(新加坡国立大学)
How Expressive are Transformers in Spectral Domain for Graphs?
Indian Institute of Technology, Hyderabad(印度理工学院海得拉巴分校);RWTH Aachen(亚琛工业大学);Zerotha Research(泽罗萨研究院);Cerence GmbH(赛轮思公司);The University of Tokyo(东京大学);IBM Research(IBM研究院)
Theoretical Constraints on the Expressive Power of $\mathsf{RoPE}$-based Tensor Attention Transformers
The University of Hong Kong(香港大学);University of Wisconsin-Madison(威斯康星大学麦迪逊分校);The Simons Institute for the Theory of Computing at UC Berkeley(加州大学伯克利分校西蒙斯理论计算研究所);Anhui University(安徽大学)
On the Expressive Power of Floating-Point Transformers
Department of Artificial Intelligence, Korea University(韩国大学人工智能系);Department of Mathematics and Statistics, Sejong University(世宗大学数学与统计学系);Department of Mathematical Sciences, Gwangju Institute of Science and Technology(全州科学技术研究院数学科学系)
On the Expressive Power and Limitations of Multi-Layer SSMs
Robotics and Perception Group(机器人与感知组);University of Zurich(苏黎世大学);Shenzhen International Center For Industrial And Applied Mathematics(深圳国际工业与应用数学中心);Shenzhen Research Institute of Big Data(深圳大数据研究 institute);Tengen Intelligence Institute(腾格智能研究所);CRRC Zhuzhou Institute(CRRC 长沙研究所)