arXiv:2602.05896cs.LGcs.AI2026-02被引 3

证明Transformer算奇偶性最少需两层,且可去除不现实假设

Parity, Sensitivity, and Transformers

  • 用敏感度分析证明单层Transformer无法计算奇偶性
  • 提出四层新结构,无需依赖长度编码等不切实际假设
  • 适合研究Transformer理论能力的学者参考

理解神经架构的计算边界是人工智能理论的核心挑战。其中,奇偶性任务(PARITY)要求判断二进制输入序列中1的个数是偶数还是奇数,是计算理论中的基础问题。尽管如此,Transformer在何种条件下能或不能解决该任务仍不明确。本文证明:计算PARITY所需的最小层数为两层。我们通过分析单层Transformer的平均敏感度增长速度慢于奇偶性本身,否定了一层Transformer解题的可能性。同时,提出一种新构造方法,使四层Transformer可实现奇偶性计算,且不再依赖长度相关位置编码、hardmax、无正则化参数的layernorm,以及与因果掩码不兼容等不现实假设。该模型使用softmax注意力机制,位置编码为长度无关且多项式有界,不使用layernorm,兼容因果与非因果掩码。

原文摘要 · Abstract (English)

Understanding what neural architectures can and cannot compute is a central challenge in the theory of AI. One of the fundamental problems in this context is the PARITY task, which asks whether the number of 1s in a binary input sequence is even or odd. PARITY is one of the central tasks studied in the theory of computation, yet it remains surprisingly unclear under which conditions transformers can or cannot solve it. In this paper, we show that the minimal number of layers a transformer needs to compute PARITY is two. In particular, we solve the open problem asking whether a one-layer transformer can compute PARITY. We answer it negatively by showing that average sensitivity of a one-layer transformer grows slower than that of PARITY. Furthermore, we show a new construction for transformer that computes PARITY, which improves on the existing constructions by removing a number of impractical assumptions. In particular, the existing transformers for PARITY rely on such impractical assumptions as length-dependent positional encoding, hardmax, layernorm without a regularisation parameter, or incompatibility with causal masking. We show that these assumptions can be removed, at the cost of increasing the number of layers from two to four. Specifically, we show that PARITY can be computed by a four-layer transformer using softmax attention, length-independent and polynomially bounded positional encoding, no layernorm, and compatible with both causal and non-causal masking.

Transformer理论分析奇偶性

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