Retrieval meets Long Context Large Language Models

📄 arXiv: 2310.03025v2 📥 PDF

作者: Peng Xu, Wei Ping, Xianchao Wu, Lawrence McAfee, Chen Zhu, Zihan Liu, Sandeep Subramanian, Evelina Bakhturina, Mohammad Shoeybi, Bryan Catanzaro

分类: cs.CL, cs.AI, cs.IR, cs.LG

发布日期: 2023-10-04 (更新: 2024-01-23)

备注: Published at ICLR 2024


💡 一句话要点

提出检索增强方法以优化长上下文大语言模型的性能

🎯 匹配领域: 支柱九:具身大模型 (Embodied Foundation Models)

关键词: 长上下文 大语言模型 检索增强 自然语言处理 生成模型 性能优化

📋 核心要点

  1. 现有方法在长上下文任务中面临性能和计算效率的挑战,特别是在上下文窗口扩展与检索增强之间的选择。
  2. 论文提出了一种结合检索增强与长上下文窗口的方法,通过简单的检索增强来提升LLMs的生成性能。
  3. 实验结果表明,检索增强的Llama2-70B在多个长上下文任务中表现优异,超越了多个基线模型,且生成速度显著提升。

📝 摘要(中文)

近年来,扩展大语言模型(LLMs)的上下文窗口变得越来越流行,而将检索与LLMs结合的解决方案已经存在多年。本文探讨了检索增强与长上下文窗口的优劣,并通过对两种最先进的预训练LLMs(43B GPT和Llama2-70B)的研究,发现使用简单的检索增强的4K上下文窗口LLM在长上下文任务中能够达到与经过微调的16K上下文窗口LLM相当的性能,同时计算量更小。更重要的是,检索显著提升了LLMs的性能,无论其扩展的上下文窗口大小如何。最佳模型为检索增强的Llama2-70B,32K上下文窗口,在九个长上下文任务中超越了GPT-3.5-turbo-16k和Davinci003,并且生成速度更快。

🔬 方法详解

问题定义:本文旨在解决长上下文任务中大语言模型的性能与计算效率问题。现有方法在扩展上下文窗口时,往往需要更多的计算资源,且难以平衡性能与效率。

核心思路:论文的核心思路是将检索增强与长上下文窗口结合,利用检索技术在生成过程中提供额外的信息支持,从而提升模型的生成能力和效率。

技术框架:整体架构包括两个主要模块:首先是检索模块,通过检索相关信息来增强生成过程;其次是生成模块,使用增强的信息生成更准确的输出。该框架能够灵活地处理不同上下文窗口的需求。

关键创新:最重要的技术创新在于通过简单的检索增强实现了与长上下文窗口相当的性能,且计算量显著降低。这一方法与传统的单纯扩展上下文窗口的方式本质上不同,后者通常需要更多的计算资源。

关键设计:在模型设计中,关键参数包括上下文窗口的大小(如4K和32K),损失函数的选择,以及检索模块的实现细节。这些设计确保了模型在生成过程中的高效性和准确性。

🖼️ 关键图片

fig_0
fig_1

📊 实验亮点

实验结果显示,检索增强的Llama2-70B在九个长上下文任务中的平均得分超越了GPT-3.5-turbo-16k和Davinci003,且在生成速度上也有显著提升。与非检索的Llama2-70B-32k基线相比,性能提升明显,展示了检索增强的有效性。

🎯 应用场景

该研究的潜在应用领域包括自然语言处理中的问答系统、基于查询的摘要生成以及上下文少样本学习等。通过提升长上下文任务的性能,该方法能够为实际应用提供更高效的解决方案,具有广泛的实际价值和未来影响。

📄 摘要(原文)

Extending the context window of large language models (LLMs) is getting popular recently, while the solution of augmenting LLMs with retrieval has existed for years. The natural questions are: i) Retrieval-augmentation versus long context window, which one is better for downstream tasks? ii) Can both methods be combined to get the best of both worlds? In this work, we answer these questions by studying both solutions using two state-of-the-art pretrained LLMs, i.e., a proprietary 43B GPT and Llama2-70B. Perhaps surprisingly, we find that LLM with 4K context window using simple retrieval-augmentation at generation can achieve comparable performance to finetuned LLM with 16K context window via positional interpolation on long context tasks, while taking much less computation. More importantly, we demonstrate that retrieval can significantly improve the performance of LLMs regardless of their extended context window sizes. Our best model, retrieval-augmented Llama2-70B with 32K context window, outperforms GPT-3.5-turbo-16k and Davinci003 in terms of average score on nine long context tasks including question answering, query-based summarization, and in-context few-shot learning tasks. It also outperforms its non-retrieval Llama2-70B-32k baseline by a margin, while being much faster at generation. Our study provides general insights on the choice of retrieval-augmentation versus long context extension of LLM for practitioners.