QB-RAG
Properties
In this work, we introduce Query-Based Retrieval Augmented Generation (QB-RAG), a novel approach that pre-computes a database of potential queries from a content base using LLMs. For an incoming patient question, QB-RAG efficiently matches it against this pre-generated query database using vector search, improving alignment between user questions and the content. We establish a theoretical foundation for QB-RAG and provide a comparative analysis of existing retrieval enhancement techniques for RAG systems.
# Generating Questions
To generate an initial set of questions, we design a prompt (shown in listing 1) with clear instructions for question generation and few-shot examples to illustrate the desired style and format. This prompt incorporates a num questions parameter to specify the target number of questions per content card. While we set this parameter to 20, the actual number of questions generated by the LLM may vary. Applying this prompt to our content base of 630 cards resulted in over 8,000 potential questions.
# Validating Answerability of the Questions
After generating questions using an LLM for our content cards, we noticed that our output questions were sometimes not relevant to the content, or were formatted inappropriately. To mitigate this issue and filter out irrelevant questions, we developed an LLM-based answerability model. Specifically, for each content card and generated question pair, we prompt the LLM to assess whether or not the content contains relevant information to answer the question.