[论文解读] Transformers Learn Shortcuts to Automata
该论文表明,Transformers 通过分层重参数化学习到‘捷径’解法,以模拟有限状态自动机,从而在 O(log T) 甚至 O(1) 的深度内实现精确的顺序计算模拟——远浅于序列长度 T。理论与实证结果表明,这些捷径普遍存在、高效,并可通过标准训练过程学习到,尽管其在分布外泛化方面表现出脆弱性。
Algorithmic reasoning requires capabilities which are most naturally understood through recurrent models of computation, like the Turing machine. However, Transformer models, while lacking recurrence, are able to perform such reasoning using far fewer layers than the number of reasoning steps. This raises the question: what solutions are learned by these shallow and non-recurrent models? We find that a low-depth Transformer can represent the computations of any finite-state automaton (thus, any bounded-memory algorithm), by hierarchically reparameterizing its recurrent dynamics. Our theoretical results characterize shortcut solutions, whereby a Transformer with $o(T)$ layers can exactly replicate the computation of an automaton on an input sequence of length $T$. We find that polynomial-sized $O(\log T)$-depth solutions always exist; furthermore, $O(1)$-depth simulators are surprisingly common, and can be understood using tools from Krohn-Rhodes theory and circuit complexity. Empirically, we perform synthetic experiments by training Transformers to simulate a wide variety of automata, and show that shortcut solutions can be learned via standard training. We further investigate the brittleness of these solutions and propose potential mitigations.
研究动机与目标
- 理解非循环、浅层的 Transformers 如何执行通常需要顺序计算的算法推理任务。
- 探究 Transformers 是否能以序列长度的亚线性深度,精确模拟有限状态自动机。
- 表征此类捷径解法存在的结构与计算条件。
- 评估实际中所学捷径解法的鲁棒性与泛化性能。
- 提出训练策略,引导 Transformers 学习更具鲁棒性的、类似 RNN 的迭代推理机制。
提出的方法
- 理论分析结合 Krohn-Rhodes 分解与电路复杂度,刻画常数深度 Transformers 在何种条件下可模拟半自动机。
- 构建显式的深度为 O(log T) 和 O(1) 的 Transformer 架构,通过转移动态的分层重参数化,精确模拟任意有限状态自动机。
- 通过在各类半自动机任务上训练标准的非自回归 Transformers,实证观察在标准优化设置下捷径学习现象。
- 引入基于最近性偏置的草稿板训练方法,引导自回归 Transformers 学习迭代式、思维链风格的推理过程。
- 使用周期性激活(如 sin/cos)和最大池化操作,降低前馈网络的宽度与深度需求。
- 应用来自电路复杂度的归约方法(如 NC¹-完全性),证明非可解半自动机的深度要求下限。
实验结果
研究问题
- RQ1浅层、非循环的 Transformer 是否能以序列长度的亚线性深度,精确模拟有限状态自动机的计算过程?
- RQ2在何种条件下,半自动机存在常数深度的捷径解法?其与代数结构有何关联?
- RQ3标准训练过程是否会导致 Transformers 自然地学习到这些捷径解法?
- RQ4所学捷径解法对分布偏移(尤其是序列长度变化)的鲁棒性如何?
- RQ5我们能否引导 Transformers 学习迭代式、类似 RNN 的推理,而非依赖捷径?
主要发现
- 深度为 O(log T) 的 Transformer 可精确模拟任意有限状态自动机,且与序列长度 T 无关。
- 对于可解半自动机,常数深度(O(1))的捷径解法存在,其存在性由 Krohn-Rhodes 定理保证。
- 对于不可解半自动机,除非 TC⁰ = NC¹,否则常数深度模拟不可能实现,从而确立了理论下限。
- 实证训练表明,尽管存在非凸优化问题,标准 Transformers 在多种自动机类型上仍收敛至捷径解法。
- 所学捷径解法在分布外泛化方面表现较差,尤其在未见过的序列长度上性能显著下降,且在监督受限条件下表现不如 RNN。
- 基于最近性偏置的草稿板训练成功引导自回归 Transformers 学习到迭代式、思维链风格的推理,有效缓解了捷径的脆弱性。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。