What is RAG? 4 analogies for this powerful AI approach
How RAG works and why it’s key to enterprise AI.
Kenny Wong
AI Engineer at Coda
AI · 6 min read
What is RAG?
RAG is a technique that directs an AI to retrieve specific sets of data first, and then looks at those sources for the answer to the user’s question. Put simply, you ask a question, the AI goes and finds the relevant data/content, and then analyzes and synthesizes that data to give you the most relevant answer.Source: Leveraging LLMs on your domain-specific knowledge base - ML6.eu
How we use RAG at Coda.
We use RAG within Coda Brain, which is our turnkey AI platform that understands your company data and allows anyone to act on it. RAG enables Coda Brain to pull applicable information from your docs and any tools you’ve connected to Coda before generating its own insights, responses, or actions based on these. This ensures that the responses are not only contextually relevant but also grounded in real, verifiable data. That’s why we call it your “favorite know-it-all.” We also use RAG in Coda’s AI features—which are built into every Coda doc and included free for Doc Makers—to provide accurate answers about the content of your Coda docs. That means you can ask it questions like “What’s our remote policy?” and get the answer based on content within your workspace. That’s something you can’t do with consumer AI tools like ChatGPT, which have access to the internet but not to your own content. In short, Coda AI knows your team—and is more helpful because of it.4 analogies for how RAG works.
In Coda Brain, we use RAG to power everything from surfacing accurate answers from your workspace to synthesizing huge amounts of data to generating brand new content tailored to exactly what you need. Here are four analogies I like to use to explain how RAG works in these different scenarios. Feel free to steal them for your own explanations!1. Generating content with RAG, the helpful librarian.
To explain the basics of how RAG generates content, I like to use the analogy of a librarian:- A student approaches a librarian with a research topic (query).
- The librarian goes and finds books, journals, and articles that are relevant to the topic (retrieval).
- The librarian then helps the student synthesize this information to create a well-informed and accurate research paper (augmented generation).
2. Finding answers with Detective RAG.
In the above example, the librarian is helping generate new content by synthesizing multiple sources. RAG can also be used for finding a single answer that lives within your workspace or connected tools, such as your vacation policy or last month’s sales figures. Think of it like a detective looking for the vital clue to crack the case:- You ask the detective to find out who committed the crime (query).
- The detective looks through evidence from various sources, such as witnesses, surveillance footage, and databases (retrieval).
- Detective RAG finds the single CCTV clip that shows who the perpetrator was and delivers the answer to you (augmented generation).
- The mystery is solved!
3. Getting the best (legal) route with RAG GPS.
To give another example of RAG’s ability to be permissions-aware, let’s imagine it as a GPS:- You input your destination (query).
- The GPS retrieves data from a map database to find all possible routes (retrieval). Because it is aware of your permissions, the GPS won’t retrieve data like private roads or walkways that you can’t access.
- It then uses this information to generate the most efficient route based on real-time traffic conditions and provides you with turn-by-turn directions (augmented generation).
4. Generating tailored content with Chef RAG.
In addition to being permissions-aware, one of the most powerful things about the RAG approach is that it can be context-aware too. That means responses can be tailored based on the context in which a question is asked, making them much more relevant. Think of it like a chef catering to your dietary needs:- You order the pasta dish at a restaurant (query).
- The chef consults the recipe and then gathers the necessary ingredients (retrieval).
- Using their culinary skills, the chef combines the ingredients to create the dish. Because Chef RAG knows who’s ordering it and what you usually like, they tailor the dish to your preferences and dietary restrictions (context-aware augmented generation).
- You get to enjoy some delicious pasta, exactly how you like it!
Bringing it all together with Coda Brain.
When you bring together all these elements of RAG—the ability to retrieve and synthesize relevant sources, being permissions-aware, and knowing your context—you can unlock some truly powerful use cases that weren’t previously possible. For example, let’s imagine we’re planning our roadmap and we want to know some of our most requested features:- You ask Coda Brain for the top feature requests. It brings back a list with the top one being a desktop app.
- You then ask “Have we explored a desktop app before?” Coda Brain synthesizes previous writeups, hackathon docs, meeting notes, and more to provide an overview of previous explorations.
- You decide to write a product requirements doc (PRD); Coda Brain can write it for you, using your team’s PRD template.
- And then, you ask for customers who’ve requested a desktop app in the past to add evidence of why you should build this. Coda Brain returns a table with customer requests from Salesforce that you can drop into your doc.