arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2505.12423cs.CLcs.AI
收藏

PSC:通过相移校准扩展大语言模型的上下文窗口

PSC: Extending Context Window of Large Language Models via Phase Shift Calibration

HiThink Research(恒生电子研究院)

Wenqiao Zhu, Chao Xu, Lulu Wang, Jun Wu

AI总结:

针对现有基于RoPE的大模型上下文窗口扩展方法难以确定最优基频缩放因子的问题,提出相移校准模块PSC,可有效提升PI、YaRN等多种现有方法的性能,在多模型多任务上具备鲁棒性,且随窗口扩大困惑度下降更显著。

摘要:

旋转位置嵌入(RoPE)是一种高效的位置编码方法,已被广泛应用于众多大语言模型(LLM)中。近年来,研究者提出了大量基于RoPE进一步扩展上下文窗口的方法,这类方法的核心思路是预定义或搜索一组因子来重新缩放RoPE的基频。然而,由于搜索空间呈指数级增长,现有方法很难预定义出最优因子。针对这一问题,我们提出了PSC(Phase Shift Calibration,相移校准)——一个用于校准现有方法预定义频率的小型模块。我们证明,引入PSC后,PI、YaRN、LongRoPE等多种现有方法的性能都能得到进一步提升。我们在多个模型和任务上开展了大量实验,结果表明:(1)启用PSC后,当上下文窗口大小从16k调整到32k再到64k时,困惑度的相对下降幅度会随之增大;(2)我们的方法适用范围广,在各类模型和任务上都表现出鲁棒性。代码可在https://github.com/WNQzhu/PSC 获取。

英文摘要:

Rotary Position Embedding (RoPE) is an efficient position encoding approach and is widely utilized in numerous large language models (LLMs). Recently, a lot of methods have been put forward to further expand the context window based on RoPE. The core concept of those methods is to predefine or search for a set of factors to rescale the base frequencies of RoPE. Nevertheless, it is quite a challenge for existing methods to predefine an optimal factor due to the exponential search space. In view of this, we introduce PSC (Phase Shift Calibration), a small module for calibrating the frequencies predefined by existing methods. With the employment of PSC, we demonstrate that many existing methods can be further enhanced, like PI, YaRN, and LongRoPE. We conducted extensive experiments across multiple models and tasks. The results demonstrate that (1) when PSC is enabled, the comparative reductions in perplexity increase as the context window size is varied from 16k, to 32k, and up to 64k. (2) Our approach is broadly applicable and exhibits robustness across a variety of models and tasks. The code can be found at https://github.com/WNQzhu/PSC.

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

↑