🇮🇳 Introduction to Retrieval Augmented Generation (RAGs)

Aman KumarAman Kumar
6 min read

We’ve all experienced this situation: you ask ChatGPT or another AI model a question, and it replies with confidence… but sometimes the answer is wrong 😅. It feels like that over-smart friend in class who speaks with full authority, but later you realize half the details were made up.

This is one of the biggest limitations of Large Language Models (LLMs) like GPT, LLaMA, or Claude. They’re trained on a fixed dataset, which means:

  • They don’t know about events after their training cutoff 📆

  • They may “hallucinate” and make up facts 🚫

  • They don’t automatically know your private data (like your startup’s sales reports, or an IIT student’s notes 📚)

That’s where Retrieval Augmented Generation (RAG) comes in.

In simple words:
👉 RAG = LLM + Google search for your own documents

It combines the natural text generation of LLMs with the factual accuracy of external data retrieval.


🌟 Why RAG is Needed

Let’s break it down:

  1. Fresh Knowledge
    LLMs can’t automatically know the latest Indian budget 🪙, today’s cricket score 🏏, or the newest iPhone launch 📱. With RAG, you can plug in external data sources to keep your AI updated.

  2. Reduce Hallucinations
    Without context, the model sometimes invents answers (classic “bhai ne gyaan de diya” situation 😅). RAG grounds the output in real documents, reducing errors.

  3. Domain-Specific Knowledge
    A doctor in AIIMS might want a chatbot that knows medical guidelines. A CA in Delhi might want one that knows ITR filing rules. With RAG, you can feed your own documents and build a tailored AI.

  4. Cost-Effective
    Retraining a large model is very expensive 💸. With RAG, you don’t retrain—you just update the knowledge base. Much cheaper, and much faster.


⚙️ How RAG Works (Retriever + Generator)

The best analogy:

Think of a UPSC aspirant 📖:

  • First, they search their notes for relevant info. (Retriever 🔍)

  • Then, they write an essay in their own words. (Generator ✍️)

This is exactly how RAG functions.

Steps in RAG:

  1. Retriever:

    • Takes your query.

    • Looks into a database (knowledge base).

    • Finds the most relevant chunks of information using vector search.

  2. Generator (LLM):

    • Takes the retrieved context.

    • Combines it with the query.

    • Generates a natural, human-like response.


🧩 Example

You ask your chatbot:

“Explain RAG in simple terms.”

  • Retriever → Finds a paragraph from your knowledge base that says: “RAG is a combination of retrieval and generation for better accuracy.”

  • Generator → Reads it and replies: “RAG means an LLM that looks up relevant documents before answering, so it’s like ChatGPT + Google search combined.”

Much smarter, much safer.


🔑 Important Concepts in RAG

Now let’s explore the key building blocks in detail.


📑 1. Indexing

Raw text is not efficient to search. Imagine going to a library and flipping through every book randomly 😵. Instead, you want a catalog or index.

That’s what indexing does—it preprocesses your documents into a structure that’s easy to search quickly.

  • Example: Breaking a long novel into pages with page numbers.

  • In RAG: We break documents into chunks and store their embeddings in a vector database like Pinecone, Weaviate, or FAISS.


🔢 2. Vectorization

Humans understand words. Machines understand numbers.
So, to make AI “understand” text, we convert words into embeddings (vectors of numbers).

  • Example:

    • “Car 🚗” and “Automobile” → Embeddings will be close together.

    • “Car 🚗” and “Banana 🍌” → Embeddings will be far apart.

This is why RAG can fetch results even when your query words don’t exactly match the document.
For example, if you search “dost ke liye gaadi”, the system may still find a passage about “car for a friend” 😎.


💡 3. Why RAG Exists

  • Without RAG: LLMs only know what they learned during training. They cannot update themselves.

  • With RAG: LLMs gain a “live memory” powered by your own knowledge base.

It’s like the difference between:

  • Student who only remembers what he studied last year 📚

  • Student who studies with the latest notes + internet updates 🌐


✂️ 4. Chunking

Most documents are too long. If you store them whole, retrieval becomes imprecise.

So we break them into chunks—smaller, meaningful pieces (like paragraphs).

Example:

  • A 50-page policy document becomes 500 chunks of 200 words each.

  • Now the retriever can fetch just the relevant 2-3 chunks instead of the entire book.

Indian example:
Think of splitting a big ladoo 🍬 into pieces so everyone can enjoy. If you give the whole ladoo, one person will be confused. Small bites = easy to digest.


🔄 5. Overlapping in Chunking

Sometimes splitting strictly can cut off meaning.

Example:

  • Chunk 1 ends: “…the Indian Constitution guarantees the right to freedom of speech…”

  • Chunk 2 starts: “…and expression under Article 19.”

If we cut here, the meaning breaks.

To solve this, we add overlap (like 20–50 words extra in each chunk).
This way, even if the answer is split, context is preserved.

Desi analogy:
It’s like rolling out roti 🍪 a little bigger than the sabzi bowl so nothing spills out.


🏗️ Architecture of a RAG System

Let’s visualize the flow:

  1. User Query 🧑‍💻 → “What are India’s EV policies?”

  2. Retriever 🔍 → Searches vector database of government PDFs.

  3. Generator 🤖 → LLM reads the retrieved chunks.

  4. Response 📢 → “India’s EV policy aims for 30% adoption by 2030…”

Tools commonly used:

  • Vector DBs: Pinecone, Weaviate, FAISS

  • Embeddings: OpenAI, HuggingFace, Cohere

  • LLMs: GPT, LLaMA, Mistral


🇮🇳 Real-Life Use Cases in India

  1. EdTech – Chatbots that answer from NCERT books 📚.

  2. Healthcare – AI assistants for medical protocols 🏥.

  3. Legal Tech – Lawyers searching past judgments ⚖️.

  4. Startups – Customer support bots with FAQs.

  5. Government – Citizen portals answering based on RTI/public documents.

Imagine an Indian Railway chatbot 🚆 that answers queries based on Indian Railways circulars. Much better than vague general responses.


🔮 Future of RAG

RAG is not the end—it’s the beginning of knowledge-grounded AI. Next steps include:

  • Multimodal RAG → Not just text, but also images, PDFs, audio, video 🎥.

  • Personal RAG → AI that remembers your chats, notes, and documents (like a smart desi personal assistant 🪔).

  • Hybrid RAG → Combining symbolic search + vector search for better accuracy.

For India, this means more localized apps in Hinglish 🗣️, regional languages 🪔, and domain-specific chatbots for everything from GST to Ayurveda 🌿.


🎯 Conclusion

Retrieval Augmented Generation is like giving LLMs an “open book exam” instead of a “closed book exam.”

  • Retriever = Finds the right notes.

  • Generator = Writes the perfect answer.

By combining these, RAG solves the biggest pain points of AI: hallucinations, outdated knowledge, and lack of personalization.

So next time someone asks you: “Bhai, what’s RAG?” just reply:
👉 “It’s ChatGPT + Google search, but for your own data.” 🤝

And that’s the magic of RAG. 🚀


0
Subscribe to my newsletter

Read articles from Aman Kumar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Aman Kumar
Aman Kumar