Decoding AI: Part 7, Retrieval Augmented Generation with GAI

Siddhartha Chaturvedi

Miri Rodriguez

Welcome to Part 7 of our Decoding AI: A government perspective learning series! In our previous blog, we discussed how to create boundary conditions in generative AI, the topic on everybody’s mind, as we explore the boundaries (pardon the pun) of generative AI – the constraints or rules that guide the outputs of these technologies, and why they are essential for the US government. In this module, we re-introduce a technique that can help us achieve better boundary conditions and quality outputs: Retrieval Augmented Generation (RAG) with GAI. — Siddhartha Chaturvedi, Miri Rodriguez

The topical relevance of RAG as a path forward to create boundary conditions is something that we alluded to in the previous blog but we go into more depth in this module.

Image Decoding AI Part VII image 1

RAG with GAI, a technique that leverages retrieval and generation to create boundary conditions and quality outputs for generative AI, especially in high-value, high-volume critical domains such as healthcare and genomics. 

What is RAG and how does it work with GAI?

RAG is a technique that combines two components of generative AI: retrieval and generation.

  • Retrieval is the process of finding and selecting relevant information from a large corpus of documents, such as Wikipedia, news articles, or government reports.
  • Generation is the process of producing natural language outputs from a given input, such as a prompt, a question, or a keyword.

RAG works by using retrieval to augment generation, meaning that it uses the retrieved information to guide and inform the generation process. For example, if we want to generate a summary of a topic, RAG would first retrieve the most relevant documents related to that topic, and then use them as additional inputs to generate a summary. This way, RAG can leverage the existing knowledge and facts from the documents and produce more accurate and informative outputs.

By combining RAG with GAI, we can create generative AI systems that can produce high-quality and relevant outputs, while also creating boundary conditions that can ensure the outputs are consistent, accurate, and appropriate for the intended domain, task, and audience.

Benefits of RAG with GAI

Some of the benefits of using RAG with GAI are:

  • It can improve the quality and relevance of the output by using external sources of information.
  • It can create boundary conditions by limiting the outputs to the retrieved information, which can reduce the risk of generating inappropriate or inaccurate outputs.
  • It can enable more diverse and creative outputs by using different corpora of documents, across domains or agencies, such as hypothesis and simulations, real-world evidence, or scientific papers.

How can I get started with RAG with GAI?

If you want to try out some RAG examples using Azure services, you have several options:

  • You can use Azure AI Studio’s prompt flow, which is a feature that allows you to create and deploy prompts for ChatGPT, a language model that generates text based on input tokens. You can use a vector index and retrieval augmentation to enhance the prompts with relevant information from your data.
    • You can watch this video tutorial to learn how to use Azure AI Studio’s prompt flow, or this video tutorial for more advanced features.
  • You can use Azure OpenAI Studio, which is a platform that allows you to build and deploy generative AI applications using Azure OpenAI Service. You can use a search index with or without vectors to provide grounding data for your prompts.
    • You can explore this GitHub repository to learn more about Azure OpenAI Studio and GPT-RAG.
  • You can use Azure Machine Learning, which is a cloud-based service that allows you to create, manage, and deploy machine learning models and experiments. You can use a search index as a vector store in a prompt flow, which is an interactive editor for prompt engineering projects.
    • You can use this article to learn how to get started with RAG using a prompt flow sample, and to learn more about the concept of RAG in Azure Machine Learning.

The road ahead

RAG with GAI is a promising and exciting technique that can help us create better generative AI systems, that can produce high-quality and relevant outputs, while also creating boundary conditions that can ensure the outputs are consistent, accurate, and appropriate for the intended domain, task, and audience.

In our next discussion, we will wrap up with a culmination of all our learnings till date, and how they can benefit the US government and the public. We will also share some of the best practices and tips for using Generative AI, and how to avoid or mitigate some of the potential risks or challenges.

Stay up to date

Get news, updates and announcements on AI for US government delivered to your inbox, sign up here.

0 comments

Discussion is closed.

Feedback usabilla icon