ChatPaper.aiChatPaper

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

摘要

在大型文本數據庫上對大型語言模型(LLMs)進行預訓練現在是一種標準範式。在將這些LLMs用於許多下游應用時,通常會額外將新知識(例如,時效性新聞或私有領域知識)融入預訓練模型中,可以通過基於RAG的提示或微調來實現。然而,模型獲取此類新知識的最佳方法仍然是一個懸而未決的問題。在本文中,我們提出了檢索增強微調(RAFT),這是一種訓練方法,可以提高模型在“開放書籍”領域設置中回答問題的能力。在RAFT中,給定一個問題和一組檢索到的文檔,我們訓練模型忽略那些對回答問題沒有幫助的文檔,我們稱之為干擾文檔。RAFT通過引用相關文檔中對回答問題有幫助的正確序列來實現這一點。這與RAFT的思維鏈式回應相結合,有助於提高模型的推理能力。在特定領域的RAG中,RAFT在PubMed、HotpotQA和Gorilla數據集上持續改善模型的性能,提供了一種用於改進預訓練LLMs到領域內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

PDF734December 15, 2024