RAFT: Retrieval-Augmented Fine-Tuning

RAFT is a fine-tuning recipe that teaches LLMs to handle distractor documents during RAG and to answer with CoT-style citations to retrieved passages.
Ask this paper
Distractor-aware training: Each training example mixes relevant documents with distractors, forcing the model to learn to ignore irrelevant retrieved content rather than averaging over it.
CoT + citations: Responses are trained to walk through chain-of-thought reasoning while verbatim-quoting the supporting passages, improving both accuracy and transparency.
Domain-specific RAG: Evaluated on PubMed, HotpotQA, and Gorilla (API-calling), RAFT consistently improves open-book in-domain QA over both plain fine-tuning and plain RAG baselines.
Practical recipe: Positions RAFT as a post-training step that upgrades a pretrained LLM for production-grade RAG without needing a new architecture.
Abstract
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.