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

从分布视角扩展大语言模型的上下文窗口

Extending Context Window of Large Language Models from a Distributional Perspective

Harbin Institute of Technology(哈尔滨工业大学);Du Xiaoman (Beijing) Science Technology Co., Ltd.(度小满(北京)科技有限公司)

Yingsheng Wu, Yuxuan Gu, Xiaocheng Feng, Weihong Zhong, Dongliang Xu, Qing Yang, Hongtao Liu, Bing Qin

AI总结:

本文从旋转角度分布视角提出一种新的RoPE上下文窗口扩展策略,通过最小化分布扰动保持预训练一致性,在LLaMA2扩展至8k和16k时分别最多减少72%和32%的分布扰动,并在LongBench-E上平均提升最高4.33%。

摘要:

缩放旋转位置嵌入(RoPE)已成为扩展基于RoPE的大语言模型(LLMs)上下文窗口的常用方法。然而,现有缩放方法往往依赖经验性做法,缺乏对RoPE内部分布的深入理解,导致在扩展上下文窗口长度时性能欠佳。本文提出从旋转角度分布的视角来优化上下文窗口扩展任务。具体而言,我们首先估计模型内旋转角度的分布,并分析长度扩展对该分布的扰动程度。随后,我们提出一种新的扩展策略,通过最小化旋转角度分布之间的扰动来保持与预训练阶段的一致性,从而增强模型泛化到更长序列的能力。与强基线方法相比的实验结果表明,在将LLaMA2的上下文窗口扩展到8k时,我们的方法最多可减少72%的分布扰动;扩展到16k时,最多可减少32%。在LongBench-E基准上,我们的方法相比现有最先进方法平均提升最高达4.33%。此外,在上下文窗口扩展后,我们的方法在Hugging Face Open LLM基准上保持了模型性能,平均性能波动仅为-0.12至+0.22。

英文摘要:

Scaling the rotary position embedding (RoPE) has become a common method for extending the context window of RoPE-based large language models (LLMs). However, existing scaling methods often rely on empirical approaches and lack a profound understanding of the internal distribution within RoPE, resulting in suboptimal performance in extending the context window length. In this paper, we propose to optimize the context window extending task from the view of rotary angle distribution. Specifically, we first estimate the distribution of the rotary angles within the model and analyze the extent to which length extension perturbs this distribution. Then, we present a novel extension strategy that minimizes the disturbance between rotary angle distributions to maintain consistency with the pre-training phase, enhancing the model's capability to generalize to longer sequences. Experimental results compared to the strong baseline methods demonstrate that our approach reduces by up to 72% of the distributional disturbance when extending LLaMA2's context window to 8k, and reduces by up to 32% when extending to 16k. On the LongBench-E benchmark, our method achieves an average improvement of up to 4.33% over existing state-of-the-art methods. Furthermore, Our method maintains the model's performance on the Hugging Face Open LLM benchmark after context window extension, with only an average performance fluctuation ranging from -0.12 to +0.22.

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

↑