RAFT: 도메인 특화 RAG를 위한 언어 모델 적응
RAFT: Adapting Language Model to Domain Specific RAG
March 15, 2024
저자: Tianjun Zhang, Shishir G. Patil, Naman Jain, Sheng Shen, Matei Zaharia, Ion Stoica, Joseph E. Gonzalez
cs.AI
초록
대규모 텍스트 데이터 코퍼스에 대한 대형 언어 모델(LLM)의 사전 학습은 이제 표준 패러다임이 되었습니다. 이러한 LLM을 다양한 다운스트림 애플리케이션에 사용할 때, 시간에 민감한 뉴스나 특정 도메인 지식과 같은 새로운 지식을 사전 학습된 모델에 추가로 통합하는 것이 일반적입니다. 이는 RAG 기반 프롬프팅이나 미세 조정을 통해 이루어질 수 있습니다. 그러나 모델이 이러한 새로운 지식을 습득하기 위한 최적의 방법론은 여전히 미해결 문제로 남아 있습니다. 본 논문에서는 "오픈북" 방식의 도메인 내 설정에서 질문에 답변하는 모델의 능력을 향상시키는 훈련 방법인 Retrieval Augmented FineTuning(RAFT)을 제안합니다. RAFT에서는 질문과 함께 검색된 문서 집합이 주어졌을 때, 모델이 질문에 답변하는 데 도움이 되지 않는 문서(이를 '방해 문서'라고 함)를 무시하도록 훈련시킵니다. RAFT는 이를 위해 관련 문서에서 질문에 답변하는 데 도움이 되는 정확한 문구를 인용하는 방식으로 이를 달성합니다. 이는 RAFT의 사고 연쇄(chain-of-thought) 스타일 응답과 결합되어 모델의 추론 능력을 향상시킵니다. 도메인 특화 RAG에서 RAFT는 PubMed, HotpotQA, Gorilla 데이터셋에서 모델의 성능을 지속적으로 개선하며, 사전 학습된 LLM을 도메인 내 RAG에 적합하게 개선하는 사후 훈련 방법을 제시합니다. RAFT의 코드와 데모는 github.com/ShishirPatil/gorilla에서 오픈소스로 제공됩니다.
English
Pretraining Large Language Models (LLMs) on large corpora of textual data is
now a standard paradigm. When using these LLMs for many downstream
applications, it is common to additionally bake in new knowledge (e.g.,
time-critical news, or private domain knowledge) into the pretrained model
either through RAG-based-prompting, or fine-tuning. However, the optimal
methodology for the model to gain such new knowledge remains an open question.
In this paper, we present Retrieval Augmented FineTuning (RAFT), a training
recipe that improves the model's ability to answer questions in a "open-book"
in-domain settings. In RAFT, given a question, and a set of retrieved
documents, we train the model to ignore those documents that don't help in
answering the question, which we call, distractor documents. RAFT accomplishes
this by citing verbatim the right sequence from the relevant document that
would help answer the question. This coupled with RAFT's chain-of-thought-style
response helps improve the model's ability to reason. In domain-specific RAG,
RAFT consistently improves the model's performance across PubMed, HotpotQA, and
Gorilla datasets, presenting a post-training recipe to improve pre-trained LLMs
to in-domain RAG. RAFT's code and demo are open-sourced at
github.com/ShishirPatil/gorilla.Summary
AI-Generated Summary