Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin +7 more
5/22/2020
21,201 citations
cs.CLcs.LG
rag

No official code found. Best implementation: costadev00/RAG-paper-implementation-from-scratch (1 star, MIT, last commit 2025-06-23).

Abstract

Large pre-trained language models have been shown to store factual knowledge in their parameters, and achieve state-of-the-art results when fine-tuned on downstream NLP tasks. However, their ability to access and precisely manipulate knowledge is still limited, and hence on knowledge-intensive tasks, their performance lags behind task-specific architectures.

Show full abstract

Additionally, providing provenance for their decisions and updating their world knowledge remain open research problems. Pre-trained models with a differentiable access mechanism to explicit non-parametric memory can overcome this issue, but have so far been only investigated for extractive downstream tasks. We explore a general-purpose fine-tuning recipe for retrieval-augmented generation (RAG) -- models which combine pre-trained parametric and non-parametric memory for language generation. We introduce RAG models where the parametric memory is a pre-trained seq2seq model and the non-parametric memory is a dense vector index of Wikipedia, accessed with a pre-trained neural retriever. We compare two RAG formulations, one which conditions on the same retrieved passages across the whole generated sequence, the other can use different passages per token. We fine-tune and evaluate our models on a wide range of knowledge-intensive NLP tasks and set the state-of-the-art on three open domain QA tasks, outperforming parametric seq2seq models and task-specific retrieve-and-extract architectures. For language generation tasks, we find that RAG models generate more specific, diverse and factual language than a state-of-the-art parametric-only seq2seq baseline.

View on arXivView PDF

Code Implementations(1)

MIT

Full implementation from scratch of the paper “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks”

10Jun 23, 20251 years agoMIT

Similar Papers

Cite this paper

@article{lewis2020retrievalaugmented,
  title  = {Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks},
  author = {Patrick Lewis and Ethan Perez and Aleksandra Piktus and Fabio Petroni and Vladimir Karpukhin and Naman Goyal and Heinrich Küttler and Mike Lewis and Wen-tau Yih and Tim Rocktäschel and Sebastian Riedel and Douwe Kiela},
  year   = {2020},
  eprint = {2005.11401},
  archivePrefix = {arXiv},
  url    = {https://arxiv.org/abs/2005.11401}
}

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/2005.11401.svg)](https://codeofpaper.com/paper/2005.11401)

Discussion