Skip to main content
QUICK REVIEW

[Paper Review] REPLUG: Retrieval-Augmented Black-Box Language Models

Weijia Shi, Sewon Min|arXiv (Cornell University)|Jan 30, 2023
Topic ModelingComputer Science68 citations
TL;DR

RePlug treats the language model as a black box and augments it with a tunable retriever that prepends retrieved documents (with an ensemble), and can be LM-supervised to improve retrieval quality; it improves performance on language modeling and downstream tasks for large LMs.

ABSTRACT

We introduce REPLUG, a retrieval-augmented language modeling framework that treats the language model (LM) as a black box and augments it with a tuneable retrieval model. Unlike prior retrieval-augmented LMs that train language models with special cross attention mechanisms to encode the retrieved text, REPLUG simply prepends retrieved documents to the input for the frozen black-box LM. This simple design can be easily applied to any existing retrieval and language models. Furthermore, we show that the LM can be used to supervise the retrieval model, which can then find documents that help the LM make better predictions. Our experiments demonstrate that REPLUG with the tuned retriever significantly improves the performance of GPT-3 (175B) on language modeling by 6.3%, as well as the performance of Codex on five-shot MMLU by 5.1%.

Motivation & Objective

  • Motivate retrieval augmentation for very large, black-box LMs that are not accessible for fine-tuning or internal representation access.
  • Propose a plug-and-play retrieval module that prepends retrieved documents and ensembling to improve predictions without modifying the LM.
  • Introduce RePlug LSR to adapt the retriever using LM-provided supervision signals to reduce perplexity.
  • Demonstrate improvements across diverse black-box LMs and tasks including language modeling, MMLU, and open-domain QA.

Proposed method

  • Use a dense retriever (dual encoder with cosine similarity) to fetch top-k documents from a corpus for a given input x.
  • Prepend each retrieved document to x and pass each (d, x) pair separately through the frozen black-box LM, ensembling the output probabilities.
  • Propose an ensemble scheme that combines predictions from multiple retrieved documents without increasing LM parameter updates.
  • Introduce RePlug LSR to train the retriever by minimizing KL divergence between retrieval likelihood and LM-guided likelihood using LM perplexity as supervision, while keeping the LM frozen.
  • Asynchronous datastore updates recycle document embeddings and re-build the FAISS index every T steps to keep retrieval aligned with retriever updates.
  • Demonstrate applicability to various LMs and retrieval models, including GPT-3, Codex, OPT, and BLOOM.
Figure 1: Different from previous retrieval-augmented approaches (Borgeaud et al., 2022 ) that enhance a language model with retrieval by updating the LM’s parameters, RePlug treats the language model as a black box and augments it with a frozen or tunable retriever. This black-box assumption makes
Figure 1: Different from previous retrieval-augmented approaches (Borgeaud et al., 2022 ) that enhance a language model with retrieval by updating the LM’s parameters, RePlug treats the language model as a black box and augments it with a frozen or tunable retriever. This black-box assumption makes

Experimental results

Research questions

  • RQ1Can retrieval-augmented methods improve truly black-box LMs without fine-tuning or internal access?
  • RQ2Does prepending retrieved documents with an ensemble improve next-token prediction more efficiently than concatenating all retrieved docs?
  • RQ3Can a retrieval model be effectively adapted to an LM via LM supervision (LSR) to further improve retrieval quality?
  • RQ4Do retrieval-augmented methods benefit both language modeling and downstream tasks like MMLU and open-domain QA for very large LMs?
  • RQ5How does RePlug perform across diverse model families and sizes?

Key findings

  • RePlug consistently improves a range of black-box LMs on language modeling and downstream tasks.
  • GPT-3 175B language modeling gains up to 6.3% with RePlug; Codex on five-shot MMLU gains 4.5% (RePlug) and 5.1% (RePlug LSR).
  • RePlug LSR yields larger gains than RePlug alone (e.g., up to 6.3% for GPT-3 175B and 7.7% vs 4.7% average improvement across models in Table 1).
  • On MMLU, Codex + RePlug improves humanities, social, STEM, and other categories, achieving a 4.5% (RePlug) and 5.1% (RePlug LSR) increase over Codex.
  • In open-domain QA, Codex + RePlug LSR achieves 12.0% improvement on Natural Questions in the few-shot setting, outperforming Atlas and others.
  • RePlug improves various model families (GPT-2, OPT, BLOOM) across sizes, with perplexity reductions (e.g., OPT-125M improves by 6.9%), showing broad applicability.
Figure 2: RePlug at inference (§ 3 ). Given an input context, RePlug first retrieves a small set of relevant documents from an external corpus using a retriever (§ 3.1 Document Retrieval ). Then it prepends each document separately to the input context and ensembles output probabilities from differe
Figure 2: RePlug at inference (§ 3 ). Given an input context, RePlug first retrieves a small set of relevant documents from an external corpus using a retriever (§ 3.1 Document Retrieval ). Then it prepends each document separately to the input context and ensembles output probabilities from differe

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.