From the course: RAG Fine-Tuning: Advanced Techniques for Accuracy and Model Performance
Unlock this course with a free trial
Join today to access over 24,800 courses taught by industry experts.
Q&A pair generation
From the course: RAG Fine-Tuning: Advanced Techniques for Accuracy and Model Performance
Q&A pair generation
- The next step in the training data preparation process is to generate questions for each document. Here, we'll focus on two main tasks. First, generating relevant questions from each document chunk. And second, creating document question pairs along with distractor documents. Let's break down our first function, which is generate questions for chunk. Here, we declare our function that takes three inputs. Chunk, which is our text from the chunk, model GPT-4o mini. Number of questions, that is how many questions we want. So by default this is set to three. We create a prompt template using chat prompt template from LangChain. The prompt here says generate number of questions, that is three, that can be answered based on the following text and here we insert the text from the chunk. Questions should be separated by semicolon character so that we can process and extract individual questions. We format our prompt with the number of questions and chunk, send it to our model to get the…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.