arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2502.20082cs.CL
收藏

LongRoPE2:近乎无损的大语言模型上下文窗口扩展

LongRoPE2: Near-Lossless LLM Context Window Scaling

Microsoft(微软)

Ning Shang, Li Lyna Zhang, Siyuan Wang, Gaokai Zhang, Gilsinia Lopez, Fan Yang, Weizhu Chen, Mao Yang

AI总结:

LongRoPE2通过进化搜索和混合训练,近乎无损地将LLaMA3-8B上下文窗口扩展至128K,保留98.5%性能,仅用10B令牌。

摘要:

LongRoPE2是一种新颖的方法,旨在将预训练大语言模型(LLMs)的有效上下文窗口扩展至目标长度,同时保持其在原始较短上下文窗口上的性能。这通过三个贡献实现:(1)提出一个假设,即较高RoPE维度上的训练不足导致了现有方法中持续存在的分布外(OOD)问题;(2)一种有效的RoPE重缩放算法,采用由“针驱动”困惑度引导的进化搜索来解决训练不足问题;(3)一种混合上下文窗口训练方法,通过微调模型权重以适应重缩放后的RoPE处理长上下文序列,同时使用原始RoPE保持短上下文性能。在LLaMA3-8B和Phi3-mini-3.8B上进行的广泛实验,跨越多个基准,验证了该假设并展示了LongRoPE2的有效性。值得注意的是,LongRoPE2将LLaMA3-8B扩展至128K有效上下文长度,同时保留了超过98.5%的短上下文性能,仅使用了100亿个令牌——比Meta的方法少80倍,而Meta的方法未能达到目标有效上下文长度。代码将在https://github.com/microsoft/LongRoPE提供。

英文摘要:

LongRoPE2 is a novel approach that extends the effective context window of pre-trained large language models (LLMs) to the target length, while preserving the performance on the original shorter context window. This is achieved by three contributions: (1) a hypothesis that insufficient training in higher RoPE dimensions contributes to the persistent out-of-distribution (OOD) issues observed in existing methods; (2) an effective RoPE rescaling algorithm that adopts evolutionary search guided by "needle-driven" perplexity to address the insufficient training problem; (3) a mixed context window training approach that fine-tunes model weights to adopt rescaled RoPE for long-context sequences while preserving the short-context performance with the original RoPE. Extensive experiments on LLaMA3-8B and Phi3-mini-3.8B across various benchmarks validate the hypothesis and demonstrate the effectiveness of LongRoPE2. Remarkably, LongRoPE2 extends LLaMA3-8B to achieve a 128K effective context length while retaining over 98.5% of short-context performance, using only 10B tokens -- 80x fewer than Meta's approach, which fails to reach the target effective context length. Code will be available at https://github.com/microsoft/LongRoPE.

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

↑