From eeb45fcd25279ff602544d2f291d5d067c06b398 Mon Sep 17 00:00:00 2001
From: Jerry Liu <jerryjliu98@gmail.com>
Date: Sun, 24 Mar 2024 23:42:34 -0700
Subject: [PATCH] edit RAFT llamapack (#12225)

cr
---
 llama-index-packs/llama-index-packs-raft-dataset/README.md    | 4 ++++
 .../examples/raft_dataset.ipynb                               | 2 ++
 2 files changed, 6 insertions(+)

diff --git a/llama-index-packs/llama-index-packs-raft-dataset/README.md b/llama-index-packs/llama-index-packs-raft-dataset/README.md
index 54d3f9aa31..a168374cd0 100644
--- a/llama-index-packs/llama-index-packs-raft-dataset/README.md
+++ b/llama-index-packs/llama-index-packs-raft-dataset/README.md
@@ -4,6 +4,10 @@ This LlamaPack implements RAFT: Adapting Language Model to Domain Specific RAG [
 
 Retrieval Augmented FineTuning (RAFT) is a training recipe introduced in this paper that aims to improve the performance of large language models (LLMs) in open-book, in-domain question-answering tasks. Given a question and a set of retrieved documents, RAFT trains the LLM to identify and cite verbatim the most relevant sequences from the documents that help answer the question, while ignoring irrelevant or distracting information. By explicitly training the model to distinguish between relevant and irrelevant information and to provide evidence from the relevant documents, RAFT encourages the LLM to develop better reasoning and explanation abilities, ultimately improving its ability to answer questions accurately and rationally in scenarios where additional context or knowledge is available.
 
+A key component of RAFT is how the dataset is generated for fine-tuning. Each QA pair also includes an "oracle" document from which the answer to the question can be deduced as well as "distractor" documents which are irrelevant. During training this forces the model to learn which information is relevant/irrelevant and also memorize domain knowledge.
+
+We've implemented the dataset generation part in a LlamaPack. Check out our [full notebook here](https://github.com/run-llama/llama_index/blob/main/llama-index-packs/llama-index-packs-raft-dataset/examples/raft_dataset.ipynb).
+
 ### Installation
 
 ```bash
diff --git a/llama-index-packs/llama-index-packs-raft-dataset/examples/raft_dataset.ipynb b/llama-index-packs/llama-index-packs-raft-dataset/examples/raft_dataset.ipynb
index 309ece94dd..e4caa75c0d 100644
--- a/llama-index-packs/llama-index-packs-raft-dataset/examples/raft_dataset.ipynb
+++ b/llama-index-packs/llama-index-packs-raft-dataset/examples/raft_dataset.ipynb
@@ -7,6 +7,8 @@
    "source": [
     "# RAFT Dataset LlamaPack\n",
     "\n",
+    "<a href=\"https://colab.research.google.com/github/run-llama/llama_index/blob/main/llama-index-packs/llama-index-packs-raft-dataset/examples/raft_dataset.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>\n",
+    "\n",
     "This LlamaPack implements RAFT: Adapting Language Model to Domain Specific RAG [paper](https://arxiv.org/abs/2403.10131)\n",
     "\n",
     "Retrieval Augmented FineTuning (RAFT) is a training recipe introduced in this paper that aims to improve the performance of large language models (LLMs) in open-book, in-domain question-answering tasks. Given a question and a set of retrieved documents, RAFT trains the LLM to identify and cite verbatim the most relevant sequences from the documents that help answer the question, while ignoring irrelevant or distracting information. By explicitly training the model to distinguish between relevant and irrelevant information and to provide evidence from the relevant documents, RAFT encourages the LLM to develop better reasoning and explanation abilities, ultimately improving its ability to answer questions accurately and rationally in scenarios where additional context or knowledge is available."
-- 
GitLab