{"id":21564,"date":"2023-12-05T09:00:38","date_gmt":"2023-12-05T17:00:38","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/azuregov\/?p=21564"},"modified":"2023-12-05T16:29:21","modified_gmt":"2023-12-06T00:29:21","slug":"decoding-ai-part-7","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/azuregov\/decoding-ai-part-7\/","title":{"rendered":"Decoding AI: Part 7, Retrieval Augmented Generation with GAI"},"content":{"rendered":"<p><em>Welcome to <strong>Part 7 of our Decoding AI: A government perspective learning series<\/strong>! In our previous blog, we discussed how to create boundary conditions in generative AI, the topic on everybody\u2019s mind, as we explore the boundaries (pardon the pun) of generative AI &#8211; 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. \u2014 Siddhartha Chaturvedi, Miri Rodriguez<\/em><\/p>\n<p>The topical relevance of RAG as a path forward to create boundary conditions is something that we alluded to in the <a href=\"https:\/\/aka.ms\/DecodingAIPart6\">previous blog<\/a> but we go into more depth in this module.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azuregov\/wp-content\/uploads\/sites\/43\/2023\/12\/Decoding-AI-Part-VII-image-1.jpg\"><img decoding=\"async\" class=\"wp-image-21567 size-large aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/azuregov\/wp-content\/uploads\/sites\/43\/2023\/12\/Decoding-AI-Part-VII-image-1-1024x576.jpg\" alt=\"Image Decoding AI Part VII image 1\" width=\"640\" height=\"360\" srcset=\"https:\/\/devblogs.microsoft.com\/azuregov\/wp-content\/uploads\/sites\/43\/2023\/12\/Decoding-AI-Part-VII-image-1-1024x576.jpg 1024w, https:\/\/devblogs.microsoft.com\/azuregov\/wp-content\/uploads\/sites\/43\/2023\/12\/Decoding-AI-Part-VII-image-1-300x169.jpg 300w, https:\/\/devblogs.microsoft.com\/azuregov\/wp-content\/uploads\/sites\/43\/2023\/12\/Decoding-AI-Part-VII-image-1-768x432.jpg 768w, https:\/\/devblogs.microsoft.com\/azuregov\/wp-content\/uploads\/sites\/43\/2023\/12\/Decoding-AI-Part-VII-image-1-1536x864.jpg 1536w, https:\/\/devblogs.microsoft.com\/azuregov\/wp-content\/uploads\/sites\/43\/2023\/12\/Decoding-AI-Part-VII-image-1.jpg 1920w\" sizes=\"(max-width: 640px) 100vw, 640px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><span style=\"font-size: 10pt;\"><em>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.\u00a0 <\/em><\/span><\/p>\n<p><strong>What is RAG and how does it work with GAI?<\/strong><\/p>\n<p>RAG is a technique that combines two components of generative AI:\u00a0<strong>retrieval<\/strong>\u00a0and\u00a0<strong>generation<\/strong>.<\/p>\n<ul>\n<li>Retrieval is the process of finding and selecting relevant information from a large corpus of documents, such as Wikipedia, news articles, or government reports.<\/li>\n<li>Generation is the process of producing natural language outputs from a given input, such as a prompt, a question, or a keyword.<\/li>\n<\/ul>\n<p>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.<\/p>\n<p>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.<\/p>\n<p><strong>Benefits of RAG with GAI<\/strong><\/p>\n<p>Some of the benefits of using RAG with GAI are:<\/p>\n<ul>\n<li>It can improve the quality and relevance of the output by using external sources of information.<\/li>\n<li>It can create boundary conditions by limiting the outputs to the retrieved information, which can reduce the risk of generating inappropriate or inaccurate outputs.<\/li>\n<li>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.<\/li>\n<\/ul>\n<p><strong>How can I get started with RAG with GAI?<\/strong><\/p>\n<p>If you want to try out some RAG examples using Azure services, you have several options:<\/p>\n<ul>\n<li>You can use <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/machine-learning\/prompt-flow\/overview-what-is-prompt-flow?view=azureml-api-2\"><strong>Azure AI Studio\u2019s prompt flow<\/strong><\/a>, 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.\n<ul>\n<li>You can watch this\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=vkM_sgaMTsU\">video tutorial<\/a>\u00a0to learn how to use Azure AI Studio\u2019s prompt flow, or this\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=roy4IFV-nFQ\">video tutorial<\/a>\u00a0for more advanced features.<\/li>\n<\/ul>\n<\/li>\n<li>You can use <a href=\"https:\/\/oai.azure.com\/\"><strong>Azure OpenAI Studio<\/strong><\/a>, 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.\n<ul>\n<li>You can explore this\u00a0<a href=\"https:\/\/github.com\/Azure\/gpt-rag\">GitHub repository<\/a>\u00a0to learn more about Azure OpenAI Studio and GPT-RAG.<\/li>\n<\/ul>\n<\/li>\n<li>You can use <a href=\"https:\/\/azure.microsoft.com\/en-us\/products\/machine-learning\/\"><strong>Azure Machine Learning<\/strong><\/a>, 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.\n<ul>\n<li>You can use this\u00a0<a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/machine-learning\/how-to-use-retrieval-augmented-generation?view=azureml-api-2\">article<\/a>\u00a0to learn how to get started with RAG using a prompt flow sample, and\u00a0to learn more about the concept of RAG in Azure Machine Learning.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>The road ahead<\/strong><\/p>\n<p>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.<\/p>\n<p>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.<\/p>\n<p><strong>Stay up to date<\/strong><\/p>\n<p>Get news, updates and announcements on AI for US government delivered to your inbox, <a href=\"https:\/\/aka.ms\/AIforGovUpdates\">sign up here<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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\u2019s mind, as we explore the boundaries (pardon the pun) of generative AI &#8211; the constraints or rules that guide the outputs of these technologies, [&hellip;]<\/p>\n","protected":false},"author":128904,"featured_media":21566,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[2,1],"tags":[47],"class_list":["post-21564","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcements","category-azuregov","tag-ai"],"acf":[],"blog_post_summary":"<p>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\u2019s mind, as we explore the boundaries (pardon the pun) of generative AI &#8211; the constraints or rules that guide the outputs of these technologies, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/posts\/21564","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/users\/128904"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/comments?post=21564"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/posts\/21564\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/media\/21566"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/media?parent=21564"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/categories?post=21564"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azuregov\/wp-json\/wp\/v2\/tags?post=21564"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}