Transformer 的逻辑分析是在自注意力机制中进行的,还是在全连接部分中进行的?
Is logical analysis performed by transformers taking place in self-attention or in the fully connected part?
AI总结:
本文通过手工构建单层编码器并在语法类别对预测任务上测试,发现Transformer的逻辑分析可在自注意力中完成,并计算了梯度下降中的不希望零点以避免其影响。
摘要:
Transformer 架构将自注意力机制应用于以向量表示的标记(token),随后经过一个全连接(神经网络)层。这两个部分可以多层堆叠。传统上,自注意力被视为在逻辑操作由全连接层执行之前聚合信息的机制。在本文中,我们表明,相当反直觉的是,逻辑分析也可以在自注意力内部进行。为此,我们实现了一个手工构建的单层编码器层,该层在自注意力内部执行逻辑分析。然后,我们研究单层 Transformer 模型通过梯度下降进行自学习的场景。我们调查当模型有选择时,它是利用全连接层还是自注意力机制进行逻辑分析。鉴于梯度下降可能陷入不希望出现的零点,我们明确计算这些不希望出现的零点,并找到避免它们的方法。我们在预测文本中相邻标记的语法类别对的背景下完成所有这些工作。我们相信,我们的发现对于理解自注意力可能执行的逻辑操作具有更广泛的意义。
英文摘要:
Transformers architecture apply self-attention to tokens represented as vectors, before a fully connected (neuronal network) layer. These two parts can be layered many times. Traditionally, self-attention is seen as a mechanism for aggregating information before logical operations are performed by the fully connected layer. In this paper, we show, that quite counter-intuitively, the logical analysis can also be performed within the self-attention. For this we implement a handcrafted single-level encoder layer which performs the logical analysis within self-attention. We then study the scenario in which a one-level transformer model undergoes self-learning using gradient descent. We investigate whether the model utilizes fully connected layers or self-attention mechanisms for logical analysis when it has the choice. Given that gradient descent can become stuck at undesired zeros, we explicitly calculate these unwanted zeros and find ways to avoid them. We do all this in the context of predicting grammatical category pairs of adjacent tokens in a text. We believe that our findings have broader implications for understanding the potential logical operations performed by self-attention.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。