Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, Douwe Kiela

2020 · NeurIPS

Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

Problem

Framing

Large parametric seq2seq models store facts, but they cannot update knowledge, expose provenance, or reliably ground generation on knowledge-intensive tasks. RAG closes this gap by treating retrieved Wikipedia passages as latent variables inside generation, then marginalizing over them end-to-end. It sets new open-domain QA results, including 44.5 EM on Natural Questions.

Currently Used Methods

Direct antecedents

Proposed Method

Architecture

RAG combines a DPR-style retriever pη(zx)p_{\eta}(z\mid x) with a BART generator pθ(yix,z,y1:i1)p_{\theta}(y_i\mid x, z, y_{1:i-1}). The retriever scores 21M Wikipedia 100-word passages with a BERT-base query encoder against a fixed document index, then the generator conditions on the input and top-KK passages.

Overview diagram: query encoder retrieves top-K Wikipedia passages from a dense index, then a seq2seq generator marginalizes over retrieved documents for answer, label, or question generation.

Loss / Objective

The model treats retrieved documents as latent variables and optimizes negative log-likelihood after top-KK marginalization.

pRAG\mboxSequence(yx)ztop\mboxk(p(x))pη(zx)pθ(yx,z)=ztop\mboxk(p(x))pη(zx)i=1Npθ(yix,z,y1:i1) p_{\mathrm{RAG\mbox{-}Sequence}}(y\mid x) \approx \sum_{z \in \mathrm{top\mbox{-}}k(p(\cdot \mid x))} p_{\eta}(z\mid x) p_{\theta}(y\mid x, z) = \sum_{z \in \mathrm{top\mbox{-}}k(p(\cdot \mid x))} p_{\eta}(z\mid x) \prod_{i=1}^{N} p_{\theta}(y_i \mid x, z, y_{1:i-1}) pRAG\mboxToken(yx)i=1Nztop\mboxk(p(x))pη(zx)pθ(yix,z,y1:i1) p_{\mathrm{RAG\mbox{-}Token}}(y\mid x) \approx \prod_{i=1}^{N} \sum_{z \in \mathrm{top\mbox{-}}k(p(\cdot \mid x))} p_{\eta}(z\mid x) \, p_{\theta}(y_i \mid x, z, y_{1:i-1})

Sampling Rule / Algorithm

Decoding differs by marginalization level: sequence-level for RAG-Sequence, token-level for RAG-Token.

pθ(yix,y1:i1)=ztop\mboxk(p(x))pη(zix)pθ(yix,zi,y1:i1) p'_{\theta}(y_i \mid x, y_{1:i-1}) = \sum_{z \in \mathrm{top\mbox{-}}k(p(\cdot \mid x))} p_{\eta}(z_i \mid x) p_{\theta}(y_i \mid x, z_i, y_{1:i-1})

Training Procedure

Evaluation

Datasets

Metrics

Headline results

Ablations

Results figure: heatmap of RAG-Token token-level document posterior over five retrieved passages during Jeopardy question generation, showing different tokens attending to different documents.

Method Strengths and Weaknesses

Strengths

Weaknesses

Suggestions from the authors

Links

Prior Papers

Further Papers