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-based-prompting或微调将新知识(例如,时效性新闻或私有领域知识)额外融入预训练模型中。然而,模型获取此类新知识的最佳方法仍然是一个悬而未决的问题。在本文中,我们提出了检索增强微调(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