arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2405.08553cs.LGcs.CL
收藏

用动态可组合多头注意力改进Transformer

Improving Transformers with Dynamically Composable Multi-Head Attention

School of Cyberspace Security, Beijing University of Posts and Telecommunications(北京邮电大学网络空间安全学院);ColorfulClouds Technology Co.,Ltd.(彩云科技有限公司)

Da Xiao, Qingye Meng, Shengping Li, Xingyuan Yuan

AI总结:

提出动态可组合多头注意力(DCMHA),通过输入依赖的Compose函数动态组合注意力头,解决MHA头冗余等问题,显著提升Transformer性能且匹配1.7x-2.0x计算量的模型。

摘要:

多头注意力(MHA)是Transformer的关键组件。在MHA中,注意力头独立工作,导致注意力分数矩阵低秩瓶颈和头冗余等问题。我们提出动态可组合多头注意力(DCMHA),这是一种参数和计算高效的注意力架构,通过动态组合注意力头来解决MHA的缺陷并提升模型表达能力。DCMHA的核心是一个Compose函数,以依赖于输入的方式变换注意力分数和权重矩阵。DCMHA可作为MHA的直接替代品用于任何transformer架构,得到相应的DCFormer。在语言建模中,DCFormer在不同架构和模型规模上显著优于Transformer,匹配了计算量约1.7x-2.0x的模型性能。例如,DCPythia-6.9B在预训练困惑度和下游任务评估上均优于开源Pythia-12B。代码和模型见https://github.com/Caiyun-AI/DCFormer。

英文摘要:

Multi-Head Attention (MHA) is a key component of Transformer. In MHA, attention heads work independently, causing problems such as low-rank bottleneck of attention score matrices and head redundancy. We propose Dynamically Composable Multi-Head Attention (DCMHA), a parameter and computation efficient attention architecture that tackles the shortcomings of MHA and increases the expressive power of the model by dynamically composing attention heads. At the core of DCMHA is a $\it{Compose}$ function that transforms the attention score and weight matrices in an input-dependent way. DCMHA can be used as a drop-in replacement of MHA in any transformer architecture to obtain the corresponding DCFormer. DCFormer significantly outperforms Transformer on different architectures and model scales in language modeling, matching the performance of models with ~1.7x-2.0x compute. For example, DCPythia-6.9B outperforms open source Pythia-12B on both pretraining perplexity and downstream task evaluation. The code and models are available at https://github.com/Caiyun-AI/DCFormer.

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

↑