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

用于更优长上下文建模的位置编码层级特定缩放

Layer-Specific Scaling of Positional Encodings for Superior Long-Context Modeling

Fudan University(复旦大学);Westlake University(西湖大学)

Zhenghua Wang, Yiran Ding, Changze Lv, Zhibo Xu, Tianlong Li, Tianyuan Shi, Xiaoqing Zheng, Xuanjing Huang

AI总结:

针对LLM的“中间丢失”问题,提出层级特定位置编码缩放方法,利用遗传算法为各层选择最优缩放因子以减缓RoPE衰减,显著提升长上下文准确率及模型外推能力。

摘要:

尽管大型语言模型(LLMs)在处理长上下文输入方面取得了显著进展,但它们仍然面临“中间丢失”问题,即上下文中间的关键信息往往被弱化或丢失。我们的广泛实验表明,该问题可能源于旋转位置嵌入(RoPE)中快速的长期衰减。为了解决这一问题,我们提出了一种层级特定位置编码缩放方法,为每一层分配不同的缩放因子,以减缓由RoPE引起的衰减率,使模型能更多地关注中间上下文。我们采用一种专门设计的遗传算法,通过引入Bezier曲线来缩小搜索空间,从而高效地为每一层选择最优缩放因子。通过全面实验,我们证明了我们的方法显著缓解了“中间丢失”问题。我们的方法在Key-Value Retrieval数据集上实现了高达20%的平均准确率提升。此外,我们表明,与在所有层进行均匀插值相反,层级特定插值在与PI和Dynamic-NTK位置编码方案结合时,增强了模型的外推能力。

英文摘要:

Although large language models (LLMs) have achieved significant progress in handling long-context inputs, they still suffer from the ``lost-in-the-middle'' problem, where crucial information in the middle of the context is often underrepresented or lost. Our extensive experiments reveal that this issue may arise from the rapid long-term decay in Rotary Position Embedding (RoPE). To address this problem, we propose a layer-specific positional encoding scaling method that assigns distinct scaling factors to each layer, slowing down the decay rate caused by RoPE to make the model pay more attention to the middle context. A specially designed genetic algorithm is employed to efficiently select the optimal scaling factors for each layer by incorporating Bezier curves to reduce the search space. Through comprehensive experimentation, we demonstrate that our method significantly alleviates the ``lost-in-the-middle'' problem. Our approach results in an average accuracy improvement of up to 20% on the Key-Value Retrieval dataset. Furthermore, we show that layer-specific interpolation, as opposed to uniform interpolation across all layers, enhances the model's extrapolation capabilities when combined with PI and Dynamic-NTK positional encoding schemes.

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

↑