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

Transformer 中的自注意力是否需要独立权重?

Does Self-Attention Need Separate Weights in Transformers?

University of Central Florida(中央佛罗里达大学);Nokia Bell Labs(诺基亚贝尔实验室)

Md Kowsher, Nusrat Jahan Prottasha, Chun-Nam Yu, Ozlem Ozmen Garibay, Niloofar Yousefi

AI总结:

本文提出共享 Key、Value、Query 权重矩阵的自注意力 BERT 模型,大幅减少参数量和训练时间,并在 GLUE 及噪声分布外数据上取得更高准确率。

摘要:

自注意力的成功在于其能够捕捉长程依赖并增强上下文理解,但其受限于计算复杂度以及在处理具有固有方向性的序列数据时所面临的挑战。本工作引入了一种基于共享权重自注意力的 BERT 模型,该模型只为(Key、Value 和 Query)表示学习一个权重矩阵,而不是为它们各自学习三个独立的矩阵。我们的共享权重注意力将训练参数量减少了超过一半,并将训练时间缩短至约十分之一。此外,我们证明在 GLUE 的小型任务上,该模型比 BERT 基线具有更高的预测准确率,尤其是在噪声数据和分布外数据上表现出更强的泛化能力。实验结果表明,我们的共享自注意力方法在注意力模块中实现了 66.53% 的参数量缩减。在 GLUE 数据集上,基于共享权重自注意力的 BERT 模型相较于标准、对称和成对注意力 BERT 模型,准确率分别提升了 0.38%、5.81% 和 1.06%。模型和源代码可在 Anonymous 获取。

英文摘要:

The success of self-attention lies in its ability to capture long-range dependencies and enhance context understanding, but it is limited by its computational complexity and challenges in handling sequential data with inherent directionality. This work introduces a shared weight self-attention-based BERT model that only learns one weight matrix for (Key, Value, and Query) representations instead of three individual matrices for each of them. Our shared weight attention reduces the training parameter size by more than half and training time by around one-tenth. Furthermore, we demonstrate higher prediction accuracy on small tasks of GLUE over the BERT baseline and in particular a generalization power on noisy and out-of-domain data. Experimental results indicate that our shared self-attention method achieves a parameter size reduction of 66.53% in the attention block. In the GLUE dataset, the shared weight self-attention-based BERT model demonstrates accuracy improvements of 0.38%, 5.81%, and 1.06% over the standard, symmetric, and pairwise attention-based BERT models, respectively. The model and source code are available at Anonymous.

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

↑