arXivDaily arXiv每日学术速递 周一至周五更新
北美退伍军人节(Veterans Day),12 日无更新
arXiv 2311.09406cs.LGcs.CLcs.NE
收藏

Transformer 神经网络架构中注意力机制对缩放点积的替代方案

Alternatives to the Scaled Dot Product for Attention in the Transformer Neural Network Architecture

University of Puget Sound(普吉特海湾大学)

James Bernhard

AI总结:

针对 Transformer 注意力中缩放点积导致梯度消失的问题,提出除以键长度之和的替代缩放,模拟实验表明其更有效。

摘要:

Transformer 神经网络架构采用一种注意力形式,其中查询与键的点积在应用 softmax 之前除以键维度的平方根。这种点积缩放旨在避免点积绝对值变得过大,从而防止 softmax 导致梯度消失。在本文中,我们提出了一些替代缩放方法,包括在应用 softmax 之前将点积除以键长度之和。我们使用模拟的键和查询来证明,在许多情况下,这种方法在避免 softmax 导致梯度消失的区域方面似乎更为有效。

英文摘要:

The transformer neural network architecture uses a form of attention in which the dot product of query and key is divided by the square root of the key dimension before applying softmax. This scaling of the dot product is designed to avoid the absolute value of the dot products becoming so large that applying softmax leads to vanishing gradients. In this paper, we propose some alternative scalings, including dividing the dot product instead by the sum of the key lengths before applying softmax. We use simulated keys and queries to show that in many situations this appears to be more effective at avoiding regions where applying softmax leads to vanishing gradients.

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

↑