Source-linked AI summary

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

arXiv:2005.11401v4cs.CLcs.LG

TL;DR

지식 집약적 NLP에는 매개변수 메모리만으로는 부족하며, 외부 지식에 접근하고 이를 검토·업데이트할 수 있는 모델이 필요하다. 이 논문은 Wikipedia를 대상으로 하는 retriever와 seq2seq 생성을 결합한 retrieval-augmented generation을 제안하고, BART보다 더 사실적이고 구체적이며 다양한 언어를 생성하면서 open-domain QA에서 state-of-the-art 성능을 달성한다.

  • 문제

    기존 hybrid-memory 모델은 open-domain extractive question answering에만 탐색되었으며, general-purpose seq2seq generation과 함께 사용하는 방식은 충분히 연구되지 않았다.

  • 방법

    RAG는 dense Wikipedia index를 대상으로 하는 neural retriever와 사전 학습된 seq2seq generator를 end-to-end 확률 모델로 결합한다.

  • 결과

    RAG는 세 가지 open-domain QA 과제에서 state-of-the-art results를 달성하며, BART보다 more factual, specific, and diverse한 언어를 생성한다.

  • 시사점 및 한계

    RAG는 강력한 지식 집약적 생성을 지원하면서, 재학습 없이 외부 메모리를 inspected and updated할 수 있게 한다.

  • 시사점 및 한계

    일부 MS-MARCO 질문은 Wikipedia만으로는 cannot be answered from Wikipedia alone하며, 합리적인 응답을 위해 gold passages 또는 매개변수 지식이 필요하다.

Abstract

from arXiv · show

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. 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.

1 서론

RAG는 사전 학습된 parametric 생성과 외부의 non-parametric Wikipedia memory를 결합해 language model의 암묵적 지식이 지닌 한계를 해결한다. 이 접근법은 세 가지 open-domain QA task에서 state-of-the-art 성능을 달성하며 TriviaQA에서는 전문화된 방법을 크게 능가한다.

  • 동기: Parametric language model은 상당한 지식을 인코딩하지만 [51] [52], 이를 쉽게 수정하거나 예측을 설명하거나 hallucination을 피하지 못한다 [38].
  • 접근법: 이 model은 maximum inner product search를 사용해 top-K document를 검색하고, latent variable로 취급되는 document에 대해 seq2seq prediction을 marginalize한다.
  • 문제: 기존 hybrid-memory system은 open-domain extractive question answering에 집중한 반면, 본 연구는 parametric 및 non-parametric memory를 seq2seq generation으로 확장한다.
  • 접근법: RAG는 사전 학습된 seq2seq transformer와 사전 학습된 neural retriever가 접근하는 dense Wikipedia index를 end-to-end probabilistic model에서 결합한다.
  • 결과: RAG는 Natural Questions, WebQuestions, CuratedTrec 에서 state-of-the-art 성능을 달성하며, TriviaQA [24]에서는 전문화된 pre-training approach를 크게 능가한다.

2 방법

RAG는 텍스트 passage에 대한 neural retriever와 seq2seq generator를 결합하고, end-to-end 학습 중 검색된 문서를 latent variable로 취급한다. sequence-level 또는 token-level document marginalization을 지원하며, 두 변형에는 서로 다른 decoding 절차를 사용한다.

  • Architecture: RAG는 pη(z|x)를 사용해 top-K passage를 검색하고, target sequence를 생성할 때 각 passage를 조건으로 generator pθ(yi|x, z, y1:i−1)를 사용한다.retriever와 generator가 generation을 위한 non-parametric context와 parametric context를 함께 제공한다.
  • RAG 변형: RAG-Sequence는 전체 output에 대해 문서를 하나의 latent variable로 marginalize하는 반면, RAG-Token은 각 target token마다 서로 다른 latent document를 선택할 수 있다.Token-level marginalization을 사용하면 여러 검색 문서의 내용을 결합해 답변을 구성할 수 있다.
  • Model components: retriever는 DPR의 BERTBASE bi-encoder와 approximate maximum inner product search를 사용하고, generator는 input과 검색된 passage를 연결해 입력으로 사용하는 400M-parameter BART-large를 사용한다.document encoder는 dense index를 구축하고, query encoder는 input query를 표현한다.
  • Training: 학습은 document-retrieval label 없이 negative marginal log-likelihood를 최소화하며, document encoder와 index는 고정한 채 query encoder와 BART generator를 업데이트한다.document encoder를 고정하면 학습 중 document index를 주기적으로 다시 구축하지 않아도 된다.
  • Inference: test 시 RAG-Sequence는 document-specific beam search와 추가 scoring을 필요로 하는데, 그 likelihood가 일반적인 per-token likelihood가 아니기 때문이다.반면 RAG-Token은 autoregressive transition probability를 가지므로, 두 변형은 arg max_y p(y|x)에 대해 서로 다른 근사를 필요로 한다.

3 실험

실험에서는 공유된 Wikipedia 기반 non-parametric memory를 사용해 다양한 knowledge-intensive task에서 RAG를 평가한다. extractive 및 abstractive QA, question generation, evidence-based claim verification을 다루며, 불완전한 Wikipedia coverage와 gold passage 부재에서 비롯되는 한계도 검증한다.

  • 실험 설정: 모든 실험은 십이월 2018 Wikipedia 덤프를 사용하며, 이를 서로 겹치지 않는 21M개의 100단어 문서로 나누고 문서 인코더 임베딩을 사용해 FAISS로 색인한다.동일한 Wikipedia 기반 비파라미터 지식 소스가 실험을 뒷받침한다.
  • Open-domain question answering: Open-domain QA에서는 RAG가 answer negative log-likelihood를 직접 최소화하며, extractive retrieval-based QA 및 closed-book approach와 비교한다.이 설정에서는 질문과 답변을 input-output text pair로 다루고, RAG의 generation을 extractive 및 parametric-only paradigm과 대조한다.
  • MSMARCO natural language generation: MSMARCO NLG는 제공된 gold passage 없이 질문과 답변만 사용하는 open-domain abstractive QA로 다룬다.이용할 수 없는 passage-specific information이 필요한 질문에서는 성능이 낮아질 것으로 예상되지만, Wikipedia에 답이 없을 때는 parametric knowledge가 도움이 될 수 있다.
  • Open-domain question generation: Question-generation 평가는 SearchQA split과 Q-BLEU-1을 사용하고, factuality와 specificity에 대한 human assessment를 포함하는 난도 높은 Jeopardy-question generation을 도입한다.Jeopardy question은 사실로부터 entity를 추론해야 하며, 평가에서는 RAG를 학습된 BART baseline과 비교한다.
  • FEVER claim verification: FEVER에서는 Wikipedia evidence retrieval 후 entailment reasoning을 수행해 claim을 supported, refuted 또는 unverifiable로 분류하는 과제에서 RAG를 평가한다.이 과제는 retrieval과 evidence에 대한 까다로운 reasoning을 결합하므로 단순한 document lookup 이상을 검증한다.

4 결과

RAG는 open-domain QA 전반에서 state-of-the-art 성능을 달성하며 generation 및 classification task에서도 경쟁력을 유지한다. 검색된 non-parametric memory는 factuality, diversity, retrieval effectiveness, test-time knowledge updating도 향상한다.

  • Open-Domain QA: RAG는 검색된 문서 어디에도 답이 나타나지 않는 NQ 질문에서 11.8% accuracy를 달성하는 반면, extractive model의 점수는 0%다.Generation은 답을 그대로 명시하지 않고 단서를 포함한 문서를 활용할 수 있다.
  • Open-Domain QA: RAG는 네 가지 open-domain QA task 모두에서 새로운 state of the art를 세우며, closed-book generation의 유연성과 open-book retrieval 성능을 결합한다.이를 위해 특화된 salient-span-masking pre-training 은 필요하지 않다.
  • Generation and Classification: RAG-Sequence는 Open MS-MARCO NLG에서 BART를 Bleu 2.6점과 Rouge-L 2.6점 차이로 앞서며, human evaluation에서는 RAG-Token이 BART보다 더 factual하다.BART가 더 factual했던 경우는 7.1%였던 반면, RAG가 더 factual했던 경우는 42.7%였다.
  • Generation and Classification: RAG classification은 state-of-the-art FEVER 3-way system과 4.3% 이내의 차이를 보이며, 2-way classification에서는 gold-evidence RoBERTa model과 2.7% 이내의 차이를 보인다.2-way 비교에서 RAG는 claim만 입력받고 자체적으로 evidence를 검색한다.
  • Retrieval Ablations and Index Hot-Swapping: Learned differentiable retrieval은 BM25가 FEVER에서 가장 우수한 경우를 제외한 모든 task를 향상하며, index를 교체하면 test time에 RAG의 world knowledge가 업데이트된다.Matched index를 사용하면 RAG는 2016 leaders에서 70%, 2018 leaders에서 68%에 도달하지만, mismatched index에서는 각각 12%와 4%를 얻는다.
  • Generation Diversity: RAG generation은 diversity-promoting decoding 없이도 BART보다 더 diverse하며, RAG-Sequence가 RAG-Token보다 더 diverse하다.두 RAG variant 모두 BART보다 유의하게 더 diverse하다.

5 관련 연구

관련 연구는 task-specific retrieval, general-purpose pretrained architectures, learned retrieval, memory-based models, retrieve-and-edit methods를 아우른다. 본 연구는 raw-text external memory를 사용하고 검색된 예시를 가볍게 편집하는 대신 내용을 aggregate함으로써 개별 task에서의 retrieval 성과를 통합하는 연구로 자리매김한다.

  • Single-Task Retrieval: Retrieval은 open-domain question answering [5], fact checking, dialogue [41] [9], translation 및 기타 개별 NLP task 전반에서 성능을 향상시켰다.이 논문은 자신의 기여를 이러한 task-specific 성과를 통합하는 것으로 제시한다.
  • NLP를 위한 General-Purpose Architectures: Pretrained language models는 retrieval 없이 classification, discriminative, generative task 전반에서 강력한 성능을 달성하며, 여기에는 fine-tuning 이후의 GLUE [8]와 GPT-2 가 포함된다.
  • Learned Retrieval: Learned retrieval methods는 pretrained neural language models [44] [26]와 search [46], reinforcement learning, 또는 latent variables [31]를 통한 task-specific optimization을 사용한다.
  • Memory-based Architectures: Document index는 memory networks [64] [55]와 유사한 large external memory로 기능하는 반면, 관련 system은 raw text가 아니라 entity 또는 fact embedding [14] [15]을 검색한다.이 논문은 raw text를 자신의 memory를 특징짓는 핵심 요소로 식별한다.
  • Retrieve-and-Edit approaches: Retrieve-and-edit approaches는 편집을 위해 유사한 training input-output pairs를 retrieve하며 Machine Translation 과 Semantic Parsing [21]에서 성공을 거두었다.이 논문은 하나의 검색된 항목을 가볍게 편집하는 접근과 대비되며, 여러 항목의 내용을 aggregation한다는 점을 강조한다.

6 논의

이 연구는 RAG를 parametric memory와 non-parametric memory의 결합으로 제시하며, open-domain QA에서 state-of-the-art 성능을 달성한다. RAG 생성 결과는 순수 parametric BART보다 사실에 부합하고 구체적이라는 이유로 더 선호되었으며, retrieval 분석은 학습된 retriever의 유효성을 뒷받침했고 index hot-swapping은 모델 업데이트를 가능하게 했다.

  • RAG 모델은 open-domain question answering에서 state-of-the-art 성능을 달성한다.
  • 사람들은 RAG 생성 결과가 순수 parametric BART보다 더 사실에 부합하고 구체적이기 때문에 이를 더 선호한다.
  • RAG는 hybrid generation을 위해 parametric memory와 non-parametric memory를 결합한다.
  • 학습된 retrieval component를 조사한 결과 그 유효성이 검증되었다.
  • retrieval index는 모델을 업데이트하기 위해 hot-swapped될 수 있다.

광범위한 영향

RAG는 Wikipedia에 기반하므로 생성 결과의 사실성을 높이고 제어 가능성과 해석 가능성을 개선할 수 있지만, 외부 지식 소스에는 편향이 포함될 수 있으며 GPT-2 와 유사하게 유해한 용도로 사용될 수 있다.

  • RAG를 Wikipedia의 실제 사실 지식에 기반하게 하면 환각을 줄이고 사실성, 제어 가능성, 해석 가능성을 개선할 수 있다.
  • RAG는 의료 지식 인덱스를 사용해 오픈 도메인 의료 질문에 답하는 등의 응용에서 사회적 편익을 제공할 수 있다.
  • 외부 지식 소스는 편향되어 있거나 사실적으로 불완전할 수 있으며, RAG는 GPT-2 와 마찬가지로 악용, 오해를 유도하는 콘텐츠, 사칭 또는 스팸·피싱 자동화를 지원할 수 있다.

Retrieval-Augmented Generation for를 위한 부록

이 부록은 “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks” 논문과 함께 제공된다.

  • 이 부록은 “Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks”라는 제목의 논문과 관련된다.
  • 이 논문은 제목에 명시된 것처럼 knowledge-intensive NLP tasks에 초점을 둔다.

A 구현 세부사항

구현에서는 과제별 retrieval depth와 decoding strategy를 사용한다. QA에서는 RAG variant에 따라 문서 15개 또는 50개를 사용하고, question generation에서는 두 variant 모두 문서 10개를 사용한다.

  • A 구현 세부사항: open-domain QA에서 RAG-Token은 검색된 문서 15개를 사용하는 반면, RAG-Sequence는 50개와 Thorough Decoding을 사용한다.beam search로는 결과가 향상되지 않았기 때문에 QA에는 Greedy decoding을 사용한다.
  • A 구현 세부사항: Open-MSMarco와 Jeopardy question generation에서는 RAG-Token과 RAG-Sequence 모두 검색된 문서 10개를 사용한다.
  • A 구현 세부사항: 또한 구현에서는 question generation을 위한 training setting을 지정하며, 불완전하게 보고된 BART-large configuration을 포함한다.

B 인간 평가

인간 평가는 상세한 지침과 품질 검사를 포함한 사실성 주석 인터페이스를 사용해 수행됐다. 각 문장에서 모델 레이블이 나타나는 위치는 무작위화했으며, 주석자들은 주제를 조사할 수 있었고 gold 문장을 사용해 평가됐다.

  • B 인간 평가: 사실성 평가 인터페이스는 전용 가이드를 통해 상세한 지침과 작성된 예시를 제공했다.주석자들은 전체 지침 탭에 접근하고 인터페이스에서 도구 가이드를 확인할 수 있었다.
  • B 인간 평가: 화면 위치 편향을 피하기 위해 각 예시에서 문장 A와 B에 대한 모델 할당을 무작위화했다.
  • B 인간 평가: 주석자들은 온라인에서 주제를 조사하도록 권장받았으며, 주석 정확도를 평가하기 위해 gold 문장을 포함했다.두 명의 주석자는 gold 예시에서 낮은 성과를 보였고, 이들의 주석은 보존하지 않았다.

C 학습 설정 세부 사항 … I 데이터셋별 인스턴스 수

부록은 RAG의 학습, 과제별 전처리, 파라미터화, 데이터셋 규모를 자세히 설명하고, null-document 및 retrieval collapse에 관한 조사를 기록한다. 또한 RAG가 비교 가능한 closed-book 모델보다 학습 가능한 파라미터 수가 상당히 적으면서도 강력한 open-domain QA 성능을 달성함을 보인다.

  • C 학습 설정 세부 사항: RAG와 BART baseline은 Fairseq, mixed-precision training, 그리고 8 또는 32GB NVIDIA V100 GPU에 걸친 distributed training을 사용한다.학습과 추론은 하나의 GPU에서 실행할 수 있으며, FAISS search는 CPU에서 충분히 빠르게 실행되고 Wikipedia의 index vector를 위해 약 100GB의 CPU memory가 필요하다.
  • D Open-Domain QA 추가 세부 사항: 여러 question-answer annotation pair를 별도로 학습하면 Natural Questions와 WebQuestions에서 RAG accuracy가 소폭 향상된다.이 접근법은 annotation을 문서 매칭 대안으로만 취급하지 않고 각 (q, a) pair를 별도로 사용한다.
  • D Open-Domain QA 추가 세부 사항: CuratedTrec supervision은 상위 1000개 문서를 검색한 뒤 각 regular-expression annotation과 가장 빈번하게 일치하는 answer를 선택해 얻는다.일치하는 항목이 없으면 possible answer permutation을 생성하는 heuristic으로 대체한다.
  • D Open-Domain QA 추가 세부 사항: 실험은 open-domain QA에 DPR dataset split을 사용하며, TriviaQA에는 Roberts et al. [52]가 사용한 공식 Wikipedia test set 대신 공개 Web Development split을 사용한다.이 split은 일반적인 open-domain QA 관행과 일관된 것으로 설명된다.
  • E FEVER 추가 세부 사항: FEVER classification에서 RAG는 claim을 재생성하고, 최종 hidden state로 분류하며, 문서 전체에 걸쳐 probability를 marginalize한다.본문의 과제는 Supported, Refuted, Not Enough Info의 three-way classification이다.
  • F Null Document Probability: 실험에서는 retrieved document와 함께 null document를 테스트하고, marginalization 전에 learned embedding 또는 static bias로 그 logit을 모델링했다.이 메커니즘은 유용한 정보를 검색할 수 없는 입력을 처리하기 위한 것이었다.
  • H Retrieval Collapse: Retrieval collapse가 발생하면 retriever가 입력과 무관하게 동일한 문서를 선택하고, 이후 generator가 retrieval을 무시하여 BART performance와 일치했다.이는 story generation과 같은 과제의 preliminary experiment에서 발생했으며, 더 약한 factual requirement 또는 더 긴 target sequence를 반영할 수 있다. Table 7은 dataset instance count를 보고한다.
Loading 2005.11401v4…