In-Context Retrieval-Augmented Language Models

Ori Ram, Yoav Levine, Itay Dalmedigos, Dor Muhlgay, Amnon Shashua +2 more
1/31/2023
cs.CLcs.IR

No official code found. Best implementation: AI21Labs/in-context-ralm (295 stars, Apache-2.0, last commit 2023-12-20).

Abstract

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.

View on arXivView PDF

Code Implementations(1)

Apache-2.0
29528PythonJan 26, 20232 years agoApache-2.0

Similar Papers

Cite this paper

@article{ram2023incontext,
  title  = {In-Context Retrieval-Augmented Language Models},
  author = {Ori Ram and Yoav Levine and Itay Dalmedigos and Dor Muhlgay and Amnon Shashua and Kevin Leyton-Brown and Yoav Shoham},
  year   = {2023},
  eprint = {2302.00083},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2302.00083v3}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2302.00083.svg)](https://codeofpaper.com/paper/2302.00083)

Discussion