NLP Lineage

22 May 2020 · Language modelling

RAG

Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

P. Lewis, E. Perez, A. Piktus, et al. (12 authors)

Date
22 May 2020
What the date marks
arXiv submission
Kind
Research paper
Organisation
Facebook AI / UCL / NYU
Access
Apache 2.0
Other dates
NeurIPS 2020
Threads
In the guided tour
Chapter 10. Reading more than you remember
Learning phases
4. Embeddings and RAG

A milestone: 2 later milestones descend directly from it, and its descendants reach 3 of the 10 threads. How levels are decided

Drafted with Claude from the paper on 15 October 2026; reviewed by Zeeshan Arif. Read from arxiv.org (arXiv version 4 (April 2021) of the NeurIPS 2020 conference paper).

What it changed

It joined a text generator with a search over Wikipedia and trained them together, so a model could write answers from passages it looks up, and its knowledge could be updated by changing the documents instead of retraining.

The problem before it

Pretrained language models store a lot of facts in their weights. The authors list three problems with that. The models cannot easily add or correct what they know. They cannot show where an answer came from. And they sometimes produce “hallucinations”, text that sounds right but is false.

Models that also search a document collection can fix some of this, because documents can be read, checked and replaced. Two such models, REALM and ORQA, had shown good results. But they were built on masked language models and only picked a span of text out of a document. They could not write free text, so they were used only for extractive question answering.

The idea

The mechanism. RAG has two pretrained parts, which the authors call two kinds of memory:

The model retrieves the top 5 or 10 passages and lets the generator work with each one. Then it combines the results, weighted by how well each passage matched. Nobody tells the model which passage is correct. The passage is treated as a hidden choice, and training improves both the question encoder and the generator, from the input and output text alone. To save cost, the passage encoder and the index stay fixed.

There are two ways to combine passages:

This is retrieval-augmented generation, and the paper gives it its name.

The notation. The retriever gives p_η(z | x) ∝ exp(d(z)ᵀ q(x)), where d(z) is a passage’s vector and q(x) the question’s vector. RAG-Sequence computes p(y | x) ≈ Σ_z p_η(z | x) Π_i p_θ(y_i | x, z, y_(1:i-1)), summing over the top passages z. RAG-Token moves the sum inside the product: p(y | x) ≈ Π_i Σ_z p_η(z | x) p_θ(y_i | x, z, y_(1:i-1)).

What it showed

Reported in the paper. It was published at NeurIPS 2020, a peer-reviewed conference. Answers in question answering are scored by exact match: the share of answers that are exactly right.

Limits, and what came later

The limits come from the paper:

Later work built on it. RETRO treats RAG as an earlier, smaller-scale example of retrieval-augmented generation. Lost in the middle studied how well models use the passages they are given in retrieval settings.

What to know first

How to read it

The paper is 19 pages, including references and appendices.

  1. Read section 1 with Figure 1.
  2. Read section 2.1 for the two models. The two formulas are the core.
  3. Read section 4.1 with Table 1, then section 4.3 with Figure 2, which shows RAG-Token using a different passage for each book title.
  4. Read “Index hot-swapping” in section 4.5.
  5. Read appendix H on retrieval collapse.

Expect about 1.5 hours for the parts above (an estimate).

In brief, from the research data

Before it

A model's knowledge was whatever got baked into its weights during training.

The problem

Baked-in knowledge goes stale, cannot be audited, and cannot cite a source.

What it introduced

Retrieve passages with a dense retriever and condition a BART generator on them, training both together.

Why it matters

It named and popularised the pattern that most production LLM systems now use.

What modern models inherit

Retrieval plus generation as the default answer to stale and unsourced knowledge.

What came next

RETRO scaled retrieval to trillions of tokens; the whole vector-database industry followed.

To understand it

Learn

  • Dense retrieval with embeddings
  • Vector search
  • Conditioning generation on retrieved passages

Helpful first

Sentence embeddings and BERT encoders.

Before and after

The milestones it descends from, and the milestones that descend from it. Work developed alongside it is not counted. Weak links are left out unless you include them.

Before: where it came from

RAG has 23 documented ancestors across 5 chapters, reaching back to Recurrent networks in 1990. Showing its direct parents and the 6 turning points among them.

RAG has 23 documented ancestors across 5 chapters, reaching back to Recurrent networks in 1990. Showing all of them.

RAG has 24 recorded ancestors, including indirect ones, across 5 chapters, reaching back to Recurrent networks in 1990. Showing its direct parents and the 6 turning points among them.

RAG has 24 recorded ancestors, including indirect ones, across 5 chapters, reaching back to Recurrent networks in 1990. Showing all of them.

  1. 2020RAGThis milestone.
  2. 2020Dense retrievalRAG built directly on thisChapter 10. Reading more than you remember
  3. 2019BARTRAG built directly on thisChapter 4. Pretrain once, use everywhere
  4. 2018BERT Turning pointDense retrieval built directly on thisChapter 4. Pretrain once, use everywhere
  5. 2018GPT-1BERT was influenced by thisChapter 4. Pretrain once, use everywhere
  6. 2018ELMoBERT was influenced by thisChapter 4. Pretrain once, use everywhere
  7. 2018ULMFiTBERT was influenced by thisChapter 4. Pretrain once, use everywhere
  8. 2017CoVeELMo was influenced by thisChapter 3. Attention, then only attention
  9. 2017Transformer Turning pointBERT built directly on thisChapter 3. Attention, then only attention
  10. 2017FAISSRAG was influenced by thisChapter 10. Reading more than you remember
  11. 2016Layer normTransformer built directly on thisChapter 3. Attention, then only attention
  12. 2015Residual connectionsTransformer was influenced by thisChapter 3. Attention, then only attention
  13. 2015LM pretraining Turning pointBERT was influenced by thisChapter 2. Words become vectors
  14. 2015Luong attentionTransformer was influenced by thisChapter 3. Attention, then only attention
  15. 2014AdamTransformer was influenced by thisChapter 2. Words become vectors
  16. 2014GloVeELMo built directly on thisChapter 2. Words become vectors
  17. 2014Seq2seq Turning pointTransformer built directly on thisChapter 2. Words become vectors
  18. 2014Attention Turning pointTransformer built directly on thisChapter 3. Attention, then only attention
  19. 2014GRU / encoder-decoderAttention built directly on thisChapter 2. Words become vectors
  20. 2013word2vecELMo was influenced by thisChapter 2. Words become vectors
  21. 2011NLP from scratchELMo was influenced by thisChapter 1. Language as probability
  22. 2003Neural LMNLP from scratch was influenced by this
    word2vec was influenced by this
    Chapter 1. Language as probability
  23. 1997LSTM Turning pointELMo built directly on thisChapter 1. Language as probability
  24. 1990Recurrent networksLSTM was influenced by thisChapter 1. Language as probability
  1. 2020RAGThis milestone.
  2. 2020Dense retrievalRAG built directly on thisChapter 10. Reading more than you remember
  3. 2019BARTRAG built directly on thisChapter 4. Pretrain once, use everywhere
  4. 2018BERT Turning pointDense retrieval built directly on thisChapter 4. Pretrain once, use everywhere
  5. 2018GPT-1BERT was influenced by thisChapter 4. Pretrain once, use everywhere
  6. 2018ELMoBERT was influenced by thisChapter 4. Pretrain once, use everywhere
  7. 2018ULMFiTBERT was influenced by thisChapter 4. Pretrain once, use everywhere
  8. 2017CoVeELMo was influenced by thisChapter 3. Attention, then only attention
  9. 2017Transformer Turning pointBERT built directly on thisChapter 3. Attention, then only attention
  10. 2017ConvS2STransformer was influenced by this (indirect influence)Chapter 3. Attention, then only attention
  11. 2017FAISSRAG was influenced by thisChapter 10. Reading more than you remember
  12. 2016Layer normTransformer built directly on thisChapter 3. Attention, then only attention
  13. 2015Residual connectionsTransformer was influenced by thisChapter 3. Attention, then only attention
  14. 2015LM pretraining Turning pointBERT was influenced by thisChapter 2. Words become vectors
  15. 2015Luong attentionTransformer was influenced by thisChapter 3. Attention, then only attention
  16. 2014AdamTransformer was influenced by thisChapter 2. Words become vectors
  17. 2014GloVeELMo built directly on thisChapter 2. Words become vectors
  18. 2014Seq2seq Turning pointTransformer built directly on thisChapter 2. Words become vectors
  19. 2014Attention Turning pointTransformer built directly on thisChapter 3. Attention, then only attention
  20. 2014GRU / encoder-decoderAttention built directly on thisChapter 2. Words become vectors
  21. 2013word2vecELMo was influenced by thisChapter 2. Words become vectors
  22. 2011NLP from scratchELMo was influenced by thisChapter 1. Language as probability
  23. 2003Neural LMNLP from scratch was influenced by this
    word2vec was influenced by this
    Chapter 1. Language as probability
  24. 1997LSTM Turning pointELMo built directly on thisChapter 1. Language as probability
  25. 1990Recurrent networksLSTM was influenced by thisChapter 1. Language as probability

After: what it led to

RAG has 2 documented descendants across 1 chapter, reaching forward to Lost in the middle in 2023. Showing all of them.

RAG has 2 documented descendants across 1 chapter, reaching forward to Lost in the middle in 2023. Showing all of them.

RAG has 10 recorded descendants, including indirect ones, across 3 chapters, reaching forward to Gemini 3.1 in 2026. Showing its direct descendants.

RAG has 10 recorded descendants, including indirect ones, across 3 chapters, reaching forward to Gemini 3.1 in 2026. Showing all of them.

  1. 2020RAGThis milestone.
  2. 2021RETROwas influenced by RAGChapter 10. Reading more than you remember
  3. 2023Lost in the middlewas influenced by RAGChapter 10. Reading more than you remember
  1. 2020RAGThis milestone.
  2. 2021RETROwas influenced by RAGChapter 10. Reading more than you remember
  3. 2023Lost in the middlewas influenced by RAGChapter 10. Reading more than you remember
  4. 2024Gemini 1.5was influenced by Lost in the middle (indirect influence)Chapter 10. Reading more than you remember
  5. 2024Gemini 2.0built directly on Gemini 1.5Chapter 14. Where the threads meet now
  6. 2025Gemini 2.5was influenced by Gemini 1.5Chapter 12. Thinking longer
  7. 2025IMO goldbuilt directly on Gemini 2.5Chapter 12. Thinking longer
  8. 2025IMO-ProofBenchwas influenced by IMO goldChapter 12. Thinking longer
  9. 2025Gemini 3was influenced by Gemini 1.5Chapter 14. Where the threads meet now
  10. 2026Gemini 3 Deep Thinkbuilt directly on Gemini 3Chapter 12. Thinking longer
  11. 2026Gemini 3.1built directly on Gemini 3Chapter 14. Where the threads meet now

Direct links and their sources

Where it came from

Built directly on

Influenced by

What it led to

Influenced

Terms