arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.09347cs.LGstat.ML
收藏

Transformer与循环架构在表征能力上的分离

Separations in the Representational Capabilities of Transformers and Recurrent Architectures

University of Oxford(牛津大学);Saarland University(萨尔大学);Cohere(Cohere公司)

Satwik Bhattamishra, Michael Hahn, Phil Blunsom, Varun Kanade

AI总结:

针对Transformer与RNN的表征能力差异,论文在索引查找、最近邻、有界Dyck语言和字符串相等任务上证明了模型规模分离,并以实验验证实际序列上的性能差异。

摘要:

Transformer架构已被基础模型广泛采用。由于其高昂的推理成本,人们重新对探索高效循环架构(RNN)的潜力产生了兴趣。本文分析了Transformer与RNN在若干具有实际相关性的任务上的表征能力差异,包括索引查找、最近邻、识别有界Dyck语言以及字符串相等。对于所考虑的任务,结果表明不同架构所需模型规模存在分离。例如,证明了一层对数宽度的Transformer即可执行索引查找,而RNN需要线性大小的隐藏状态。相反,尽管常数大小的RNN能够识别有界Dyck语言,但一层Transformer在该任务上需要线性大小。此外,证明了对数大小的两层Transformer可执行字符串相等或不相交等决策任务,而一层Transformer和循环模型在这些任务上均需要线性大小。还证明了对数大小的两层Transformer可在前向传播中实现最近邻算法;另一方面,循环模型需要线性大小。构造基于在O(log N)维空间中存在N个近似正交向量,下界则基于通信复杂度问题的归约。本文通过实验补充理论结果,突出这些架构在实际长度序列上的性能差异。

英文摘要:

Transformer architectures have been widely adopted in foundation models. Due to their high inference costs, there is renewed interest in exploring the potential of efficient recurrent architectures (RNNs). In this paper, we analyze the differences in the representational capabilities of Transformers and RNNs across several tasks of practical relevance, including index lookup, nearest neighbor, recognizing bounded Dyck languages, and string equality. For the tasks considered, our results show separations based on the size of the model required for different architectures. For example, we show that a one-layer Transformer of logarithmic width can perform index lookup, whereas an RNN requires a hidden state of linear size. Conversely, while constant-size RNNs can recognize bounded Dyck languages, we show that one-layer Transformers require a linear size for this task. Furthermore, we show that two-layer Transformers of logarithmic size can perform decision tasks such as string equality or disjointness, whereas both one-layer Transformers and recurrent models require linear size for these tasks. We also show that a log-size two-layer Transformer can implement the nearest neighbor algorithm in its forward pass; on the other hand recurrent models require linear size. Our constructions are based on the existence of $N$ nearly orthogonal vectors in $O(\log N)$ dimensional space and our lower bounds are based on reductions from communication complexity problems. We supplement our theoretical results with experiments that highlight the differences in the performance of these architectures on practical-size sequences.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑