RAG and Its Variants

Retrieval-Augmented Generation (RAG)

AI models like ChatGPT, DeepSeek, LLAMA are powerful, but they lack up to date knowledge or they cannot specifically answer if you want results related to yours data. RAG solves this problem by allowing you to communicate directly with your documents and data.
RAG stands for Retrieval-Augmented Generation.

  • We use Rag to add external data with response of LLM.

RAG FLOW

Preparation of data for retrieval:

In the process of retrieval of data, we load the text docs in various file types, including text, pdfs, html and csv. After loading the docs, we convert them in to chunks. Then Embedding performed to convert them in to numerical form. We perform embedding so that we can quickly retrieve the chunks based on semantic similarity. So that the AI model can utilize it. As we know, the machines cannot directly understand the text. We need to convert it to numerical form so models can utilize them. The embedding are in form of vectors. Then we convert those vectors to vector database.

What is RAG, Graph Rag and Agentic Rag?

Retrieval-Augmented Generation:

RAG combines the capabilities of standard Retrieval model and large language models. It helps to communicate with our own documents and data.

Example:
Imagine, you uploaded records of employees of specific company.
You ask Chabot, how many employees are in company. How many employees joined in this year?

Flow:
User Query ───► Retriever ───► Relevant Docs ───► Generator (LLM) ───► Final Answer

Graph RAG

Graph RAG is an evolution of simple RAG. Here system uses knowledge graph or hierarchical approach instead of plan text. We stores information as nodes and edges. This structure makes easier to capture relationships and flows between concepts. It is useful for technical fields where relationship matters.

Example:
When Instead of just retrieving text, graph RAG can represent that how cnc motor receives instructions.

Agentic RAG

In agentic AI, we uses capabilities of Ai agents in RAG. An LLM or RAG system can only take documents and give responses but it cannot perform actions. Agent does not just retrieve documents but it can also plan reason and take actions.

Example:
If you ask chatbot: “Draw the 10mm circle on CNC machine”.
Regular RAG might just fetch text about circle commands.
Agentic RAG could:

  • Retrieve CNC manual.
  • Decide to use a G-code simulator tool.
  • Run the simulation.
  • Return both the code and the result

Difference/Comparison between Graph RAG and Agentic RAG?