1 of 26

Retrieval-Augmented Generation for Knowledge-Intensive NLP

1

Presenter: Cyrus Hei Chan

Date: 31 Aug 2024

2 of 26

Current Pre-trained LMs

General purpose pertained LMs (i.e. seq2seq2 BART, T5) are powerful:

  • Storing substantial knowledge in parameters in implicit knowledge base (the knowledge is not explicitly stored but rather encoded within the model’s weights)
  • Good performance in many tasks
  • Very applicable

​

However, it is far from gold standard:

  • Hallucinate (generates information that is incorrect, misleading, or fabricated, but presented with high confidence and seeming authenticity)
  • Struggle to expand or revise their knowledge base
  • Knowledge base is difficult to update

​

​

2

3 of 26

Why would retrieval be beneficial?

Retrieving knowledge from external sources is useful:

  • Precise and accurate knowledge access mechanism
  • Trivial to update at test time (very easy and straightforward to update or change the model's knowledge or behavior during the testing phase, without requiring a full retraining of the model)

​

But then:

  • Retrieval supervision is needed (without supervision, the retrieval process may yield irrelevant, inefficient, and inaccurate results)
  • You need heuristics-based retrieval (e.g. MIPS)
  • Need to integrate into downstream models via a task specific way

3

4 of 26

What is RAG?

Jointly learn to retrieve and generate end2end. You do not need any labelling for retrieved documents. Fit for seq2seq tasks.

A RAG Model consists of three components:

  • A pre-trained generator model, e.g. BART, T5 (parametric memory)
  • A retriever model, e.g. DPR (Dense Passage Retriever) (nonparametric memory)
  • Indexed Knowledge Base (structured repository of information), e.g. Wikipedia

​

4

5 of 26

Why RAG?

RAG has gained recent prominence:

  • Information Accuracy: It addresses the critical issue of hallucinations in large language models by grounding responses in retrieved facts.
  • Adaptability: Unlike traditional models, RAG can easily incorporate new information without full retraining, making it more flexible and up-to-date.
  • Efficiency: It potentially reduces the need for ever-larger models by leveraging external knowledge bases.
  • Performance: It has shown improved results on various NLP tasks, particularly those requiring specific or factual knowledge.
  • AI Safety: By reducing false information generation, RAG contributes to more reliable and trustworthy AI systems.

5

6 of 26

Design and Analysis of RAG

6

7 of 26

1.

Transiton headline

Let’s start with the first set of slides

7

RAG Architecture

8 of 26

Models

8

9 of 26

Training: minimize loss via SGD Adam

9

10 of 26

Retriever: DPR

​

​

10

11 of 26

Retriever: DPR

​

​

11

12 of 26

Generator: BART

​

​

12

13 of 26

Decoding: RAG-Token

13

Standard, single beam search with transition probability:

14 of 26

Decoding: RAG-Token

14

Standard, single beam search with transition probability:

15 of 26

Decoding: RAG-Sequence

15

Unlike RAG-Token, the likelihood p(y|x) isn't broken down into individual word probabilities.

​

As a result, you can't just use a simple beam search to find the best sequence, because you need to evaluate the entire sequence probability together, which is more complex and computationally demanding.

16 of 26

Decoding: RAG-Sequence

16

Approximate p(yij|x, zi) ≈ 0

where yij was not generated during beam search from x, zi for more efficient decoding

​

Since we are finding:

arg maxyij p(yij|x)

17 of 26

Experiments

17

18 of 26

Experimental Applications

Recall that RAG can be applied to any seq2seq tasks.

Some example tasks that require intensive access of knowledge:

​

​

18

Open-domain QA

Natural Questions (NQ), TrivialQA (TQA), WebQuestions (WQ), CuratedTree (CT) Datasets

Abstractive

open-domain QA

MSMARCO Dataset

Index hot-swapping

DrQA Wikipedia Dump from Dec 2016 vs Dec 2018

19 of 26

Experimental Applications: Open-Domain QA

19

20 of 26

Experimental Applications: Open-Domain QA

20

Summary of Mechanisms and Results

  • REALM performs well but is outperformed by RAG models due to less flexibility in retrieval and generation integration.
  • DPR excels in retrieval but may not have a strong generation component, which can impact performance in generating answers.
  • RAG-Token and RAG-Seq. perform better due to their advanced methods of combining retrieval and generation. RAG-Seq., in particular, benefits from sequence-level generation, providing the most comprehensive answers.

21 of 26

Experimental Applications: Abstractive Open-Domain QA

21

22 of 26

Experimental Applications: Abstractive Open-Domain QA

22

23 of 26

Experimental Applications: Abstractive Open-Domain QA

23

24 of 26

Experimental Applications: Index Hot-Swapping

24

Non-parametric Memory Advantage:

RAG's ability to update knowledge by simply swapping the index demonstrates its advantage over parametric models like T5 or BART, which require retraining.

​

Accuracy Observations:

  • Matching Index: High accuracy when the index matches the query list (70% for 2016 leaders with the 2016 index, 68% for 2018 leaders with the 2018 index).
  • Mismatched Index: Very low accuracy when the index and query list do not match (12% and 4%).

​

25 of 26

Future Prospects

  • Graph RAGs
  • Multimodal RAGs
  • Domain-Specific RAG
  • Interactive RAG
  • Personalized RAG
  • Cross-Lingual RAG
  • …

25

26 of 26

thanks!

Any questions?

You can find me at email cyrchanh@connect.hku.hk or Discord @diffract_

26