Event banner
Azure Cognitive Search AMA: Vector search, Azure OpenAI Service, generative apps, plugins & more
Event details
Jason Jensen here from south-eastern Washington state. I'm interested in information or resources on what the Retrieval Augmented Generation pattern with Cognitive Search and vector search looks like end-to-end. Specifically comparing it to the existing samples available in GitHub would be extra useful.
- liamca-msftJul 25, 2023
Microsoft
Jason, I think this blog post that Pablo Castro wrote is the best resource to get started here and to learn more about RAG and the Retrieve Augment Generate pattern. From there, the demo code which can be found here. is a great more technical resource.
- jasoneilifJul 25, 2023Copper Contributor
Thanks liamca-msft , that is the pattern I have been following in my experimentation using the sample code from GitHub as well. How will vector search change or improve upon this?
- robertlee-msftSep 25, 2023
Microsoft
RAG pattern consists broadly of two steps:
[the summary of RAG pattern below, number points 1 and 2 are sourced from https://vitalflux.com/retrieval-augmented-generation-rag-llm-examples/]
1. Retrieval Phase: Given an input query (like a question), the RAG system first retrieves relevant documents or passages from a large corpus using a retriever. This is often done using efficient dense vector space methods, like the Dense Retriever (DPR), which embeds both the query and documents into a continuous vector space and retrieves documents based on distance metrics.
2. Generation Phase: Once the top-k relevant documents or passages are retrieved, they are fed into a sequence-to-sequence generator along with the original query. The generator is then responsible for producing the desired output (like an answer to the question) using both the query and the retrieved passages as context.
During the retrieval phase, the candidate documents that are returned will directly affect the generation phase, as the quality of that phase will only be as good as the input documents and the completion model.
As a result, it is beneficial to improve the quality of the retrieval phase. This is where vector search can improve on this RAG pattern. In many common scenarios, vector search can return more semantically relevant information than traditional keyword search, because it is searching based on the meaning of the search query and candidate documents and doesn't require keyword matches and term frequency, document length, term saturation, etc that TF IDF and BM25 keyword search techniques would use. This brings all the powerful capabilities of vector search, such as multi-lingual, multi-modal, etc to surface potentially more relevant documents.
(Please don't confuse the use of the word 'semantic' above with Azure Cognitive Search feature, "semantic search". Here I'm only using semantic as an adjective.)