arXiv:2505.18948cs.LGcs.CC2025-05NeurIPS被引 21

用填充和循环扩展Transformer表达能力,实现高效并行计算。

Exact Expressive Power of Transformers with Padding

  • 引入填充与循环机制,提升Transformer的并行推理能力。
  • 在输入长度n下,$O(\log^d n)$循环可识别$\mathsf{FO}$-uniform $\mathsf{TC}^d$类问题。
  • 为测试时计算提供无需参数增长的并行替代方案,适合追求效率的研究者。

链式思维是增强基于Transformer的大语言模型计算能力的自然推理方法,但需串行解码。是否存在更高效的方式,在不增加参数的前提下扩展Transformer的表达能力?本文研究了带填充标记的Transformer作为可并行化的测试时计算形式。研究表明,平均硬注意力、掩码预归一化Transformer在多项式填充下恰好能识别$\mathsf{FO}$-uniform $\mathsf{TC}^0$类问题——即极高度并行化的计算问题。虽然$\mathsf{TC}^0$上界已知,但匹配的下界长期未果。进一步分析揭示,当与动态增深(通过循环)结合时,填充变压器的表达能力显著提升。核心贡献在于将经典复杂性理论中的完备问题与归约概念引入Transformer的形式化研究。由此证明:在输入长度为$n$的情况下,具有$O(\log^d n)$循环的填充变压器恰好识别$\mathsf{FO}$-uniform $\mathsf{TC}^d$类问题。因此,填充与循环协同作用系统地拓展了变压器的表达能力:在多项式对数循环下,多项式填充的Transformer精确识别$\mathsf{FO}$-uniform $\mathsf{NC}$类问题——在不损失并行性的前提下所能达到的最佳结果(除非$\mathsf{NC} = \mathsf{P}$)。这些结果为探索填充与循环作为链式思维的并行替代方案提供了理论支持。

原文摘要 · Abstract (English)

Chain of thought is a natural inference-time method for increasing the computational power of transformer-based large language models (LLMs), but comes at the cost of sequential decoding. Are there more efficient alternatives to expand a transformer's expressive power without adding parameters? We consider transformers with padding tokens as a form of parallelizable test-time compute. We show that averaging-hard-attention, masked-pre-norm transformers with polynomial padding recognize precisely the class $\mathsf{FO}$-uniform $\mathsf{TC}^0$ of extremely parallelizable problems. While the $\mathsf{TC}^0$ upper bound was known, proving a matching lower bound had been elusive. Further, our novel analysis reveals the precise expanded power of padded transformers when coupled with another form of inference-time compute, namely dynamically increasing depth via looping. Our core technical contribution is to show how padding helps bring the notions of complete problems and reductions, which have been a cornerstone of classical complexity theory, to the formal study of transformers. Armed with this new tool, we prove that padded transformers with $O(\log^d n)$ looping on inputs of length $n$ recognize exactly the class $\mathsf{FO}$-uniform $\mathsf{TC}^d$ of moderately parallelizable problems. Thus, padding and looping together systematically expand transformers' expressive power: with polylogarithmic looping, polynomially padded transformers recognize precisely the class $\mathsf{FO}$-uniform $\mathsf{NC}$, the best that could be expected without losing parallelism (unless $\mathsf{NC} = \mathsf{P}$). Our results thus motivate further exploration of padding and looping as parallelizable alternatives to chain of thought for test-time compute.

Transformer并行计算复杂性理论测试时计算

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。