arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.04089cs.LGcs.AI
收藏

关于Transformer在学习隐马尔可夫模型方面的局限性

On Limitation of Transformer for Learning HMMs

School of Computer Science, Peking University(北京大学计算机学院);Department of Electrical and Computer Engineering, Princeton University(普林斯顿大学电气与计算机工程系)

Jiachen Hu, Qinghua Liu, Chi Jin

AI总结:

本文通过实验和理论分析揭示了Transformer在学习隐马尔可夫模型时在训练速度、准确率和序列长度方面均不如RNN,并提出块CoT训练方法可部分缓解该局限。

摘要:

尽管基于Transformer的架构在自然语言处理、计算机视觉和机器人技术等各种序列建模任务中取得了显著成功,但它们学习基本序列模型(如隐马尔可夫模型,HMMs)的能力仍不清楚。本文通过大量实验研究了Transformer在学习HMM及其变体方面的性能,并将其与循环神经网络(RNNs)进行了比较。我们表明,在所有测试的HMM模型上,Transformer在训练速度和测试准确率方面始终不如RNNs。甚至存在一些具有挑战性的HMM实例,Transformer难以学习,而RNNs能够成功学习。我们的实验进一步揭示了Transformer的深度与其能够有效学习的最长序列长度之间的关系,这种关系取决于HMM的类型和复杂度。为了解决Transformer在建模HMM方面的局限性,我们证明了一种思维链(CoT)的变体,在训练阶段称为块CoT(block CoT),可以帮助Transformer降低评估误差并以增加训练时间为代价学习更长的序列。最后,我们通过理论结果补充了实证发现,证明了Transformer在对数深度下逼近HMM的表达能力。

英文摘要:

Despite the remarkable success of Transformer-based architectures in various sequential modeling tasks, such as natural language processing, computer vision, and robotics, their ability to learn basic sequential models, like Hidden Markov Models (HMMs), is still unclear. This paper investigates the performance of Transformers in learning HMMs and their variants through extensive experimentation and compares them to Recurrent Neural Networks (RNNs). We show that Transformers consistently underperform RNNs in both training speed and testing accuracy across all tested HMM models. There are even challenging HMM instances where Transformers struggle to learn, while RNNs can successfully do so. Our experiments further reveal the relation between the depth of Transformers and the longest sequence length it can effectively learn, based on the types and the complexity of HMMs. To address the limitation of transformers in modeling HMMs, we demonstrate that a variant of the Chain-of-Thought (CoT), called $\textit{block CoT}$ in the training phase, can help transformers to reduce the evaluation error and to learn longer sequences at a cost of increasing the training time. Finally, we complement our empirical findings by theoretical results proving the expressiveness of transformers in approximating HMMs with logarithmic depth.

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

↑