Skip to main content
QUICK REVIEW

[论文解读] Retrieval meets Long Context Large Language Models

Peng Xu, Wei Ping|arXiv (Cornell University)|Oct 4, 2023
Topic Modeling被引用 14
一句话总结

本文比较检索增强和长上下文LLMs(4K、16K、32K)在长上下文任务上的表现,结果显示检索能提升短上下文和长上下文的表现,且4K带检索在计算量更少的情况下可达到16K/32K的性能。此外,还展示了强大的检索增强的 Llama2-70B-32k 模型,在若干任务上优于 OpenAI 的 API。

ABSTRACT

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.

研究动机与目标

  • 评估检索增强是否比扩展长上下文更能提升在长上下文任务上的性能。
  • 量化检索对具有不同上下文窗口(4K、16K、32K)的模型的影响。
  • 评估将检索与长上下文结合是否能在问答、摘要和就地学习等任务上带来提升。

提出的方法

  • 比较两种解码器型LLM(GPT-43B、Llama2-70B)在4K、16K、32K上下文窗口下的表现。
  • 通过对RoPE嵌入进行位置插值,将上下文扩展到16K/32K。
  • 使用三种检索器(Dragon、Contriever、OpenAI embeddings)获取前N个区块并作为证据喂给模型。
  • 在混合指令数据集上对模型进行指令微调,以便能够遵循提示。
  • 在包括 QM、QASP、NQA、QLTY、MSQ、HQA、MFQA 的七个长上下文数据集上评估零-shot与少-shot任务。

实验结果

研究问题

  • RQ1相较于单纯扩大上下文窗口,检索增强是否能提升长上下文LLM的性能?
  • RQ2检索增强的4K上下文模型是否在准确性和效率上与16K/32K上下文模型相匹配或超越?
  • RQ3上下文窗口大小和检索到的区块数量对不同模型尺寸的下游任务有何影响?
  • RQ4在大上下文LLMs中,不同检索器的比较结果如何?
  • RQ5检索增强的大上下文模型是否能在长上下文基准测试中超越现有的 OpenAI 模型?

主要发现

模型序列长度平均值QMQASPNQAQLTYMSQHQAMFQA
GPT-43B4k26.4415.5623.6615.6449.3511.0828.9140.90
GPT-43B + ret4k29.3216.6023.4519.8151.5514.9534.2644.63
GPT-43B16k29.4516.0925.7516.9450.0514.7437.4845.08
GPT-43B + ret16k29.6515.6923.8221.1147.9015.5236.1447.39
Llama2-70B4k31.6116.3427.7019.0763.5515.4034.6444.55
Llama2-70B + ret4k36.0217.4128.7423.4170.1521.3942.0648.96
Llama2-70B16k36.7816.7230.9222.3276.1018.7843.9748.63
Llama2-70B + ret16k37.2318.7029.5423.1270.9023.2844.8150.24
Llama2-70B32k37.3615.3731.8823.5973.8019.0749.4948.35
Llama2-70B + ret32k39.6018.3431.2724.5369.5526.7253.8952.91
Llama2-7B4k22.6514.2522.0714.3840.908.6623.1335.20
Llama2-7B + ret4k26.0416.4522.9718.1843.2514.6826.6240.10
Llama2-7B32k28.2016.0923.6619.0744.5015.7431.6346.71
Llama2-7B + ret32k27.6317.1123.2519.1243.7015.6729.5545.03
  • 检索在评估任务中显著提升了4K和16K/32K上下文LLMs的性能。
  • 带检索的4K上下文LLM在平均性能上可与16K长上下文LLM相当(GPT-43B: 29.32 与 29.45;Llama2-70B: 36.02 与 36.78),且计算量要小得多。
  • 检索增强的 Llama2-70B-32k-ret(32K上下文)在九个长上下文任务上的平均分超越 GPT-3.5-turbo-16k 和 Davinci-003(例如平均分 43.6 对 42.8 和 基线 40.9)。
  • 检索进一步提升长上下文模型,Llama2-70B-32k-ret 的平均分高于非检索基线(Table 3 中为 39.60 对 37.36),且在某些情况下生成速度更快。
  • 检索的好处在多种检索器(Dragon、Contriever、OpenAI embeddings)上都能观察到,并且在短/长上下文设置中均持续存在。
  • 将检索的区块数量超过前5(至前10/前20)并不一定提升性能,甚至可能因为中间丢失效应而降低。

更好的研究,从现在开始

从论文设计到论文写作,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。