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

大型语言模型的并行上下文窗口

Parallel Context Windows for Large Language Models

AI21 Labs(AI21实验室)

Nir Ratner, Yoav Levine, Yonatan Belinkov, Ori Ram, Inbal Magar, Omri Abend, Ehud Karpas, Amnon Shashua, Kevin Leyton-Brown, Yoav Shoham

AI总结:

提出并行上下文窗口(PCW)方法,通过将长文本分块、限制窗口内注意力机制并重用位置嵌入,无需额外训练即可突破现成LLM的上下文窗口限制,在7.5亿至1780亿参数模型的上下文学习及多跳、检索增强问答等长文本任务中取得显著提升。

摘要:

在处理长文本时,大型语言模型(LLMs)受限于其上下文窗口。现有的解决这一限制的努力涉及训练专门的架构,并且不能轻易应用于现成的LLMs。我们提出了并行上下文窗口(PCW),这是一种无需进一步训练即可缓解任何现成LLM上下文窗口限制的方法。该方法的关键是将长上下文切分成块(“窗口”),将注意力机制限制为仅在每个窗口内应用,并在各窗口间重用位置嵌入。我们的主要结果在参数规模介于7.5亿到1780亿之间的模型上测试了PCW方法的上下文学习,并显示在具有多样化输入和输出空间的任务中取得了显著改进。我们还展示了在其他可能受益于长上下文窗口的设置中的额外优势:多跳问题和带有多个检索文档的检索增强问答。我们的结果突显了并行上下文窗口作为一种有前景的方法,可在需要长文本序列的一系列设置中应用现成的LLMs。我们在 https://github.com/ai21labs/parallel-context-windows 上公开了我们的代码。

英文摘要:

When applied to processing long text, Large Language Models (LLMs) are limited by their context window. Existing efforts to address this limitation involve training specialized architectures, and cannot be easily applied to off-the-shelf LLMs. We present Parallel Context Windows (PCW), a method that alleviates the context window restriction for any off-the-shelf LLM without further training. The key to the approach is to carve a long context into chunks (``windows''), restrict the attention mechanism to apply only within each window, and re-use the positional embeddings across the windows. Our main results test the PCW approach on in-context learning with models that range in size between 750 million and 178 billion parameters, and show substantial improvements for tasks with diverse input and output spaces. We show additional benefits in other settings where long context windows may be beneficial: multi-hop questions and retrieval-augmented question answering with multiple retrieved documents. Our results highlight Parallel Context Windows as a promising method for applying off-the-shelf LLMs in a range of settings that require long text sequences. We make our code publicly available at https://github.com/ai21labs/parallel-context-windows.

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

↑