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

以一敌多:利用注意力头嵌入实现参数高效的多头注意力

Pit One Against Many: Leveraging Attention-head Embeddings for Parameter-efficient Multi-head Attention

University of Sheffield(谢菲尔德大学)

Huiyin Xue, Nikolaos Aletras

AI总结:

针对多头注意力内存开销大的问题,提出仅用单个共享投影矩阵和每头嵌入的MHE注意力,在显著降低内存和参数的同时,保持高预测性能。

摘要:

扩展预训练语言模型在各种自然语言处理任务中带来了巨大的性能提升,但同时也带来了内存需求方面的巨大成本。受Transformer中位置嵌入的启发,我们旨在简化和减少多头注意力(MHA)机制的内存占用。我们提出了一个替代模块,该模块仅使用单个共享投影矩阵和多个头嵌入(MHE),即每个头一个嵌入。我们通过实验证明,与替代注意力机制相比,我们的MHE注意力在内存效率上显著更高,同时在多个下游任务上保持了相对于原始MHA的高预测性能保留率。MHE注意力仅需要相对于单头注意力微不足道的额外参数($3nd$,其中$n$是注意力头数,$d$是头嵌入的大小),而MHA则需要$(3n^2-3n)d^2-3nd$的额外参数。

英文摘要:

Scaling pre-trained language models has resulted in large performance gains in various natural language processing tasks but comes with a large cost in memory requirements. Inspired by the position embeddings in transformers, we aim to simplify and reduce the memory footprint of the multi-head attention (MHA) mechanism. We propose an alternative module that uses only a single shared projection matrix and multiple head embeddings (MHE), i.e. one per head. We empirically demonstrate that our MHE attention is substantially more memory efficient compared to alternative attention mechanisms while achieving high predictive performance retention ratio to vanilla MHA on several downstream tasks. MHE attention only requires a negligible fraction of additional parameters ($3nd$, where $n$ is the number of attention heads and $d$ the size of the head embeddings) compared to a single-head attention, while MHA requires $(3n^2-3n)d^2-3nd$ additional parameters.

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

↑