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

克服自注意力的理论局限

Overcoming a Theoretical Limitation of Self-Attention

University of Notre Dame(圣母大学)

David Chiang, Peter Cholak

摘要:

尽管Transformers对于许多任务都非常有效,但它们仍在努力处理一些令人惊讶的简单正则语言。Hahn表明,对于接受依赖于单个输入符号的语言,随着输入字符串越来越长,Transformer的分类决策变得越来越不自信(即,交叉熵接近每个字符串1位)。我们使用两种语言来研究这种限制:PARITY,一种是奇数个1的位串的语言,以及FIRST,一种是以1开头的位串的语言。我们展示了三种方法来克服哈恩引理所提出的限制。首先,我们通过构建一个Transformer来解决一个悬而未决的问题,该transformer能够以完美的准确度识别PARITY,对于FIRST也是如此。其次,我们使用层归一化来使两个模型的交叉熵任意接近于零。第三,当Transformers需要关注单个位置时,如FIRST,我们发现它们无法泛化到更长的字符串;我们提供了一个简单的补救方法来解决这个问题,也提高了机器翻译中的长度泛化。

英文摘要:

Although transformers are remarkably effective for many tasks, there are some surprisingly easy-looking regular languages that they struggle with. Hahn shows that for languages where acceptance depends on a single input symbol, a transformer's classification decisions become less and less confident (that is, with cross-entropy approaching 1 bit per string) as input strings get longer and longer. We examine this limitation using two languages: PARITY, the language of bit strings with an odd number of 1s, and FIRST, the language of bit strings starting with a 1. We demonstrate three ways of overcoming the limitation suggested by Hahn's lemma. First, we settle an open question by constructing a transformer that recognizes PARITY with perfect accuracy, and similarly for FIRST. Second, we use layer normalization to bring the cross-entropy of both models arbitrarily close to zero. Third, when transformers need to focus on a single position, as for FIRST, we find that they can fail to generalize to longer strings; we offer a simple remedy to this problem that also improves length generalization in machine translation.

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

↑