[论文解读] In-Context Retrieval-Augmented Language Models
本论文表明,通过将检索到的文档作为输入前缀(In-Context RALM),使用现成的检索器,尤其是 BM25,在不改变语言模型(LM)的情况下能带来大型语言模型的显著提升,且进一步的提升来自面向LM的检索结果再排序。
Retrieval-Augmented Language Modeling (RALM) methods, which condition a language model (LM) on relevant documents from a grounding corpus during generation, were shown to significantly improve language modeling performance. In addition, they can mitigate the problem of factually inaccurate text generation and provide natural source attribution mechanism. Existing RALM approaches focus on modifying the LM architecture in order to facilitate the incorporation of external information, significantly complicating deployment. This paper considers a simple alternative, which we dub In-Context RALM: leaving the LM architecture unchanged and prepending grounding documents to the input, without any further training of the LM. We show that In-Context RALM that builds on off-the-shelf general purpose retrievers provides surprisingly large LM gains across model sizes and diverse corpora. We also demonstrate that the document retrieval and ranking mechanism can be specialized to the RALM setting to further boost performance. We conclude that In-Context RALM has considerable potential to increase the prevalence of LM grounding, particularly in settings where a pretrained LM must be used without modification or even via API access.
研究动机与目标
- 在不修改架构或训练的前提下,推动对大型语言模型(LMs)的 grounding。
- 在多样化语料库和模型规模上评估一个简单的就地检索增强框架。
- 研究检索策略和文档再排序,以最大化 LM 性能。
- 证明其在开放域问答中的适用性,并讨论部署带来的收益。
提出的方法
- 提出 In-Context RALM:在不改变 LM 权重的情况下,将检索到的文档前置于 LM 输入。
- 使用检索步幅 s 来控制生成过程中的检索频率。
- 使用检索查询长度 ell 来限制用于查询检索器的前缀部分。
- 在五个语料库上用开源多种语言模型(GPT-2、GPT-Neo/J、OPT、LLaMA)进行评估:WikiText-103、RealNews、ArXiv、Stack Exchange、FreeLaw。
- 比较稀疏检索(BM25)与密集检索器;在零-shot 设置中,BM25 往往优于神经检索器。
- 引入两种面向 LM 的再排序方法:(a)使用 LM 的零-shot 再排序;(b)在领域数据上训练的预测再排序以选择最佳 top-k 文档。
- 使用 Natural Questions 和 TriviaQA 评估开放域问答性能。
实验结果
研究问题
- RQ1简单地将检索到的文档前置到现成 LM 的输入,LM 性能能提升多少?
- RQ2哪种检索器类型和检索配置(步幅和查询长度)能最大化上下文对语言建模的锚定?
- RQ3LM 面向的检索结果再排序是否能在原生 top-1 检索之外带来额外提升?
- RQ4In-Context RALM 在不修改或微调 LM 的情况下,能否有效迁移到开放域问答任务?
主要发现
- BM25 检索器在就地 LM grounding 中通常优于密集神经检索器。
- 更频繁的检索(更小的步幅 s)比稀疏检索带来更强的 perplexity 提升,s=4 是一个实用的默认值。
- 检索查询长度 ell 大约为 32 个 token 在该设置中是 BM25 的一个甜点。
- 使用现成检索器的就地 RALM 可以在不同语料库中达到相当于 2–3 倍规模模型的性能。
- LM 面向的再排序(零-shot)和预测再排序在比原生 BM25 还要降低 perplexity 方面提供额外提升,且在领域数据上训练的预测再排序带来显著收益。
- 对于大型模型,In-Context RALM 可以使较小模型的表现提升到与更大模型相媲美(例如,6.7B OPT 模型配合 BM25 在某些设置可媲美 66B OPT)。
- 在开放域问答中,提供检索文档作为上下文可显著提升性能,即使冻结 LM;通常两份文档就足够。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。