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

神经注意力:用神经网络增强自注意力机制中的QKV计算

Neural Attention: Enhancing QKV Calculation in Self-Attention Mechanism with Neural Networks

Fuzhou University(福州大学)

Muhan Zhang

AI总结:

本文提出用专门设计的神经网络替代传统线性变换来计算自注意力机制中的QKV,实验表明该方法在IWSLT 2017翻译任务上提升了BLEU分数,并在Wikitext-103上降低了Roberta模型的困惑度。

摘要:

在深度学习领域,自注意力机制已在包括自然语言处理和计算机视觉在内的众多任务中证实了其关键作用。尽管在多样化应用中取得了成功,传统自注意力机制主要依赖线性变换来计算查询、键和值(QKV),这在特定情况下可能并非最优选择。本文探讨了一种新颖的QKV计算方法——实现一种专门设计的神经网络结构来进行计算。我们利用修改后的Marian模型,在IWSLT 2017德英翻译任务数据集上进行了实验,并将我们的方法与传统方法进行了对比。实验结果显示,我们的方法在BLEU分数上有显著提升。此外,在Wikitext-103数据集上训练Roberta模型时,我们的方法也展现出优越性,与原始版本相比,模型困惑度显著降低。这些实验结果不仅验证了我们方法的有效性,还揭示了通过基于神经网络的QKV计算来优化自注意力机制的巨大潜力,为未来的研究和实际应用铺平了道路。我们提出方法的源代码和实现细节可在https://github.com/ocislyjrti/NeuralAttention获取。

英文摘要:

In the realm of deep learning, the self-attention mechanism has substantiated its pivotal role across a myriad of tasks, encompassing natural language processing and computer vision. Despite achieving success across diverse applications, the traditional self-attention mechanism primarily leverages linear transformations for the computation of query, key, and value (QKV), which may not invariably be the optimal choice under specific circumstances. This paper probes into a novel methodology for QKV computation-implementing a specially-designed neural network structure for the calculation. Utilizing a modified Marian model, we conducted experiments on the IWSLT 2017 German-English translation task dataset and juxtaposed our method with the conventional approach. The experimental results unveil a significant enhancement in BLEU scores with our method. Furthermore, our approach also manifested superiority when training the Roberta model with the Wikitext-103 dataset, reflecting a notable reduction in model perplexity compared to its original counterpart. These experimental outcomes not only validate the efficacy of our method but also reveal the immense potential in optimizing the self-attention mechanism through neural network-based QKV computation, paving the way for future research and practical applications. The source code and implementation details for our proposed method can be accessed at https://github.com/ocislyjrti/NeuralAttention.

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

↑