小深度变压器也能解决复杂序列任务,揭示了深度对推理能力的关键作用。
A Little Depth Goes a Long Way: The Expressive Power of Log-Depth Transformers
- 让变压器深度随输入长度以对数级增长,提升表达能力。
- 只需 Θ(log n) 深度即可识别正则语言和判断图连通性。
- 理论预测与实际训练结果高度吻合,指导模型深度设计。
近期理论表明,变换器在长输入上无法表达序列推理问题,因其计算深度受限。但以往研究将深度视为常数,未明确有限深度对短输入是否足够,以及增加深度如何影响表达能力。本文分析深度随上下文长度 $n$ 以 $Θ(\log n)$ 增长的变换器,证明即使高度均匀的模型也能表达两类重要问题:识别正则语言(体现状态追踪能力)和图连通性(支撑多步推理)。这两类问题在标准复杂度假设下无法被固定深度变换器表达,凸显了深度增长的优势。理论进一步定量预测表达所需深度,表明深度扩展比增宽或增加思维链步骤更高效。实验显示,理论所需深度与实际训练成功所需的深度高度一致,弥合了表达能力与可学习性之间的差距。研究澄清了深度对推理能力的影响,为序列推理模型的深度选择提供了实用指导。
原文摘要 · Abstract (English)
Recent theoretical results show transformers cannot express sequential reasoning problems over long inputs, intuitively because their computational depth is bounded. However, prior work treats the depth as a constant, leaving it unclear to what degree bounded depth may suffice for solving problems over short inputs, or how increasing the transformer's depth affects its expressive power. We address these questions by analyzing transformers whose depth can grow minimally with context length $n$. We show even highly uniform transformers with depth $Θ(\log n)$ can express two important problems: recognizing regular languages, which captures state tracking abilities and was known to be expressible only by an unconventional, non-uniform model of transformers, and graph connectivity, which underlies multi-step reasoning. Notably, both of these problems cannot be expressed by fixed-depth transformers under standard complexity conjectures, demonstrating the expressivity benefit of growing depth. Moreover, our theory quantitatively predicts how depth must grow with input length to express these problems, showing that depth scaling is more efficient than scaling width or chain-of-thought steps. Empirically, our detailed experiments designed to bridge the expressivity vs. learnability gap reveal that our theoretical depth requirements for regular language recognition closely match the practical depth requirements for successfully training transformers. Thus, our results clarify how depth affects a transformer's reasoning capabilities, and provide practical guidance for effective depth selection for sequential reasoning.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。