Retrieval Types
Methods by which a document can be retrieved from vector database for closeness matching
1. Multi Query
When a user submits a natural language Query to a RAG system, query may
contain 2 or 3 different varied questions.
Now if retriever tries to match vector embedding of whole user query, it
might not provide correct matching document, since matching documents
might be far placed in embedding vector space, since query might have
2-3 unrelated questions
How Multi-Query solves this?
1. System takes the user's prompt and asks a fast LLM: "Generate 3(for
example) sub-questions of this query from different angles."
2. The system executes a vector search (retrieve_top_k=10) for each of
those generated variations independently against the vector database, we
get 3*10=30 nearest documents
3. Duplicate documents are removed and remaining documents are fed as
context with User's query to LLM for final response generation.