arXivDaily arXiv每日学术速递 周一至周五更新
arXiv周末暂无论文更新,休息一下吧,周末愉快~~
arXiv 2306.15595cs.CLcs.AIcs.LG
收藏

通过位置插值扩展大型语言模型的上下文窗口

Extending Context Window of Large Language Models via Positional Interpolation

Meta Platforms Inc.(元平台公司)

Shouyuan Chen, Sherman Wong, Liangjian Chen, Yuandong Tian

AI总结:

本文提出位置插值(PI)方法,通过线性缩小输入位置索引,以极少的微调将基于RoPE的LLM上下文窗口扩展至32768,且在长上下文任务中表现优异并保持原窗口内的性能。

摘要:

我们提出了位置插值(PI),它以最少的微调(在1000步以内)将基于RoPE的预训练LLM(如LLaMA模型)的上下文窗口大小扩展至最多32768,同时在需要长上下文的各种任务上展示了强大的实证结果,包括从LLaMA 7B到65B的密钥检索、语言建模和长文档摘要。同时,通过位置插值扩展的模型在其原始上下文窗口内的任务上相对较好地保持了质量。为实现这一目标,位置插值线性缩小输入位置索引以匹配原始上下文窗口大小,而不是外推到训练好的上下文长度之外,后者可能导致灾难性的高注意力分数,彻底破坏自注意力机制。我们的理论研究显示,插值的上界至少比外推小约600倍,进一步证明了其稳定性。通过位置插值扩展的模型保留其原始架构,并可重用大多数现有的优化和基础设施。

英文摘要:

We present Position Interpolation (PI) that extends the context window sizes of RoPE-based pretrained LLMs such as LLaMA models to up to 32768 with minimal fine-tuning (within 1000 steps), while demonstrating strong empirical results on various tasks that require long context, including passkey retrieval, language modeling, and long document summarization from LLaMA 7B to 65B. Meanwhile, the extended model by Position Interpolation preserve quality relatively well on tasks within its original context window. To achieve this goal, Position Interpolation linearly down-scales the input position indices to match the original context window size, rather than extrapolating beyond the trained context length which may lead to catastrophically high attention scores that completely ruin the self-attention mechanism. Our theoretical study shows that the upper bound of interpolation is at least $\sim 600 \times$ smaller than that of extrapolation, further demonstrating its stability. Models extended via Position Interpolation retain its original architecture and can reuse most pre-existing optimization and infrastructure.

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

↑