ChatPaper.aiChatPaper

RAFT: Adattamento di Modelli Linguistici al RAG Specifico per Dominio

RAFT: Adapting Language Model to Domain Specific RAG

March 15, 2024
Autori: Tianjun Zhang, Shishir G. Patil, Naman Jain, Sheng Shen, Matei Zaharia, Ion Stoica, Joseph E. Gonzalez
cs.AI

Abstract

Il pretraining di Large Language Models (LLM) su grandi corpora di dati testuali è ormai un paradigma standard. Quando si utilizzano questi LLM per molte applicazioni downstream, è comune integrare ulteriormente nuove conoscenze (ad esempio, notizie tempocritiche o conoscenze di dominio private) nel modello pretrainato, sia attraverso prompt basati su RAG, sia tramite fine-tuning. Tuttavia, la metodologia ottimale affinché il modello acquisisca tali nuove conoscenze rimane una questione aperta. In questo articolo, presentiamo il Retrieval Augmented FineTuning (RAFT), una ricetta di addestramento che migliora la capacità del modello di rispondere a domande in contesti "open-book" specifici di un dominio. In RAFT, data una domanda e un insieme di documenti recuperati, addestriamo il modello a ignorare quei documenti che non aiutano a rispondere alla domanda, che chiamiamo documenti distraenti. RAFT raggiunge questo obiettivo citando testualmente la sequenza corretta dal documento rilevante che aiuterebbe a rispondere alla domanda. Questo, unito alla risposta in stile chain-of-thought di RAFT, aiuta a migliorare la capacità di ragionamento del modello. Nel RAG specifico di dominio, RAFT migliora costantemente le prestazioni del modello su dataset come PubMed, HotpotQA e Gorilla, presentando una ricetta post-training per migliorare i LLM pretrainati nel RAG specifico di dominio. Il codice e la demo di RAFT sono open-source su 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.
PDF724February 8, 2026