信息熵不变性:增强注意力机制中的长度外推
Information Entropy Invariance: Enhancing Length Extrapolation in Attention Mechanisms
AI总结:
基于信息熵不变性提出两种缩放温度方法InfoScale和CosScale,分别用于点积注意力和余弦注意力,显著提升了大型语言模型的长度外推能力,在GAU-α模型上扩展至训练长度64倍并优于七种现有方法。
摘要:
自2021年关于提升大型语言模型长度外推能力的研究出现以来,一些研究在所提出的方法中对缩放点积注意力机制中的缩放因子进行了修改,但缺乏严格的理论证明。为填补这一空白,我们基于信息熵不变性提出了两种新的缩放温度以增强长度外推。首先,为点积注意力设计了一种免训练方法InfoScale,通过确保熵的一致性,在长度外推过程中保持对原始标记的关注。其次,我们从理论上分析了缩放(CosScale)对余弦注意力的影响。实验数据表明,结合InfoScale和CosScale在GAU-α模型上取得了最先进的性能,其上下文窗口扩展至训练长度的64倍,并优于七种现有方法。我们的分析揭示,显著增加CosScale近似于窗口注意力,并突显了注意力分数稀释作为长程上下文处理中关键挑战的重要性。代码和数据可在https://github.com/HT-NEKO/Information-Entropy-Invariance获取。
英文摘要:
Since the emergence of research on improving the length extrapolation capabilities of large language models in 2021, some studies have made modifications to the scaling factor in the scaled dot-product attention mechanism as part of their proposed methods without rigorous theoretical justifications. To fill this gap, we propose two new scaled temperatures based on information entropy invariance to enhance length extrapolation. First, a training-free method InfoScale is designed for dotproduct attention, and preserves focus on original tokens during length extrapolation by ensuring consistent entropy. Second, we theoretically analyze the impact of scaling (CosScale) on cosine attention. Experimental data demonstrates that combining InfoScale and CosScale achieves state-ofthe-art performance on the GAU-α model with a context window extended to 64 times the training length, and outperforms seven existing methods. Our analysis reveals that significantly increasing CosScale approximates the Windowed Attention, and highlights the significance of attention score dilution as a key challenge in long-range context handling. The code and data are available at https://github.com/HT-NEKO/ Information-Entropy-Invariance.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。