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

注意力熵是关键因素:基于全注意力预训练语言模型的并行上下文编码分析

Attention Entropy is a Key Factor: An Analysis of Parallel Context Encoding with Full-attention-based Pre-trained Language Models

Tencent AI Lab(腾讯AI实验室)

Zhisong Zhang, Yan Wang, Xinting Huang, Tianqing Fang, Hongming Zhang, Chenlong Deng, Shuaiyi Li, Dong Yu

AI总结:

本文分析了并行上下文编码在全注意力预训练语言模型中导致性能下降的原因,发现异常高的注意力熵是关键因素,并通过引入注意力汇聚和选择机制有效降低熵值,缩小性能差距。

摘要:

大型语言模型凭借在上下文建模中的卓越能力,在众多语言任务中表现出色。最常用的上下文建模方法是全自注意力,如标准解码器Transformer。尽管强大,但该方法处理长序列时效率低下,且可能忽略输入的固有结构。为解决这些问题,一种替代方法是并行上下文编码,即将上下文分割成子片段并行编码。由于训练时未遇到并行模式,直接应用并行编码会导致性能下降。然而,其潜在原因和缓解措施尚不明确。在本研究中,我们对这一问题进行了详细分析,发现异常高的注意力熵可能是一个关键因素。此外,我们采用两种简单的方法,通过引入注意力汇聚和选择机制来降低注意力熵。在各种任务上的实验表明,这些方法有效降低了不规则的注意力熵并缩小了性能差距。我们希望本研究能为增强上下文建模机制提供启示。

英文摘要:

Large language models have shown remarkable performance across a wide range of language tasks, owing to their exceptional capabilities in context modeling. The most commonly used method of context modeling is full self-attention, as seen in standard decoder-only Transformers. Although powerful, this method can be inefficient for long sequences and may overlook inherent input structures. To address these problems, an alternative approach is parallel context encoding, which splits the context into sub-pieces and encodes them parallelly. Because parallel patterns are not encountered during training, naively applying parallel encoding leads to performance degradation. However, the underlying reasons and potential mitigations are unclear. In this work, we provide a detailed analysis of this issue and identify that unusually high attention entropy can be a key factor. Furthermore, we adopt two straightforward methods to reduce attention entropy by incorporating attention sinks and selective mechanisms. Experiments on various tasks reveal that these methods effectively lower irregular attention entropy and narrow performance gaps. We hope this study can illuminate ways to enhance context modeling mechanisms.

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

↑