Member-only story
Productionizing RAGs: Query Normalization /Re-Write
With the breakthrough in LLMs, the Retrieval Augmented Generation (RAG) based have gain a great popularity with industrial leaders. However, productionizing a RAG system has it own challenges and pain points.
If haven’t already, please have a look at my earlier article: Productionizing RAGs: Challenges, to get an overview of the challenges.
This article focuses on one of the pain points, augmenting queries.
Irrespective of the quality of knowledge base, technology or algorithm, an RAG system cannot produces good results, if it cannot understand the user query. Consequently, methodologies have been developed to make modify the user queries better understandable for the models:
Acronym Expansion
Original query: “How do I do my bf?”
Interpretation #1: “How do I do my boy friend?”
Interpretation #2: “How do I do my breakfast?”
The LLMs can very well make the first interpretation, when the intended interpretation is second one. This ambiguity may make the LLMs produce funny, irrelevant or unacceptable responses.
Augmenting queries by expanding the acronyms is one of the straight forward ways to augment queries albeit may be a complex one depending upon the context. In its simplest form, a simple key value look-up should be good. However, depending upon the context, more complex systems might have to be designed.