高注意力熵是并行编码性能下降的关键原因,提出两种方法有效缓解。
Attention Entropy is a Key Factor: An Analysis of Parallel Context Encoding with Full-attention-based Pre-trained Language Models
- 分析发现并行编码时异常高的注意力熵导致性能下降
- 引入注意力汇聚点和选择性机制降低熵值,提升模型表现
- 适合研究长序列建模与高效注意力机制的学者参考
大型语言模型在众多自然语言任务中表现出色,主要得益于其强大的上下文建模能力。当前主流的上下文建模方式是全自注意力机制,如标准解码器仅有的Transformer结构。尽管强大,该方法在处理长序列时效率较低,且可能忽略输入的固有结构。为解决此问题,一种替代方案是并行上下文编码,将上下文拆分为子片段并行编码。由于训练中未遇到此类并行模式,直接应用会导致性能下降。然而其根本原因及缓解方法尚不明确。本文通过深入分析发现,异常高的注意力熵是关键因素。我们进一步提出两种简单有效的方法:引入注意力汇聚点和选择性机制以降低注意力熵。在多个任务上的实验表明,这些方法能有效减少不规则注意力熵,并缩小性能差距。本研究旨在为改进上下文建模机制提供启示。
原文摘要 · Abstract (English)
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.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。