arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2401.01325cs.CLcs.AIcs.LG
收藏

LLM Maybe LongLM: 无需微调即可自扩展LLM上下文窗口

LLM Maybe LongLM: Self-Extend LLM Context Window Without Tuning

Texas A&M University(德克萨斯农工大学);Amazon(亚马逊公司);Rice University(莱斯大学);Case Western Reserve University(凯斯西储大学)

Hongye Jin, Xiaotian Han, Jingfeng Yang, Zhimeng Jiang, Zirui Liu, Chia-Yuan Chang, Huiyuan Chen, Xia Hu

AI总结:

针对LLM难以泛化到超出训练长度的长上下文问题,提出无需微调的SelfExtend方法,通过构建分组与邻域双层注意力扩展上下文窗口,仅少量代码修改即可生效,多基准实验验证了其有效性。

摘要:

众所周知,大语言模型(LLM)无法很好地泛化到长度超过训练序列长度的长上下文,这给推理阶段使用LLM处理长输入序列带来了挑战。本研究认为,LLM本身具备无需微调即可处理长上下文的固有能力。为实现这一目标,我们提出SelfExtend方法,通过构建分组注意力和邻域注意力的双层注意力信息来扩展LLM的上下文窗口:分组注意力捕捉相距较远的token之间的依赖关系,邻域注意力则捕捉指定范围内相邻token之间的依赖关系。这两层注意力均在推理阶段基于原始模型的自注意力机制计算得出。仅需少量代码修改,我们的SelfExtend即可在无需任何微调的情况下轻松扩展现有LLM的上下文窗口。我们在多个基准上开展了全面实验,结果表明SelfExtend能有效扩展现有LLM的上下文窗口长度。代码可在https://github.com/datamllab/LongLM 获取。

英文摘要:

It is well known that LLMs cannot generalize well to long contexts whose lengths are larger than the training sequence length. This poses challenges when employing LLMs for processing long input sequences during inference. In this work, we argue that LLMs themselves have inherent capabilities to handle long contexts without fine-tuning. To achieve this goal, we propose SelfExtend to extend the context window of LLMs by constructing bi-level attention information: the grouped attention and the neighbor attention. The grouped attention captures the dependencies among tokens that are far apart, while neighbor attention captures dependencies among adjacent tokens within a specified range. The two-level attentions are computed based on the original model's self-attention mechanism during inference. With minor code modification, our SelfExtend can effortlessly extend existing LLMs' context window without any fine-tuning. We conduct comprehensive experiments on multiple benchmarks and the results show that our SelfExtend can effectively extend existing LLMs' context window length. The code can be found at \url{https://github.com/datamllab/LongLM}.

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

↑