Skip to main content

Command Palette

Search for a command to run...

Understanding Retrieval-Augmented Generation (RAG)

Updated
2 min read
Understanding Retrieval-Augmented Generation (RAG)

Retrieval Augmented Generation is a technique that enhances Large Language Models (LLM’s) by giving them the power of seeking useful data from external resources before generating the outputs.

Internal Working of RAG

Cha lo ab ye samjha jaye ki akhir ye RAG model kaam karta kase hai
Imagine you are preparing for an exam

You’re not just writing from your memory — you keep a notebook full of important notes next to you

Now picture this :

Whenever someone ask you a question :

  • “You first flip through your notebook , find the right page with answer“

  • “Then you use your own words and style to explain it”

    This is exaclty how RAG(Retrieval Augmented Generation) works !

In Tech Terms

  • Retrieval :
    Jaake apne “notes” (databse, knowledge base) se relevant info lana

  • Generation:
    Us info ko apne shabdon mein samjhana (usign language model like ChatGPT)

📦 Example in Real Life:

Suppose you built a chatbot for a college.

  • Without RAG:
    The chatbot only knows general stuff. Agar kisi ne bola “BTech syllabus for 2nd year CSE?”, it might give a vague answer or say “I don’t know.”

  • With RAG:
    The chatbot pehle jaata hai us college ke documents mein, syllabus dhundta hai, fir ek achha sa answer bana ke user ko deta hai.

🧠 Why RAG is Smart?

  • Apne dimaag + kitaabon ka combination!

  • Real-time info use karta hai.

  • Apne aap naye documents se seekh sakta hai (jab database update hota hai).

Ab thoda technical dekhte hain, kaise kaam karta hai RAG system ke andar…

🧠 Simple Breakdown of the Diagram:

  • Data Source: Apka syllabus, PDF, documents — jo bhi info hai.

  • Chunking of Data: Bada document chhoti-chhoti pieces mein todte hain.

  • Create Embeddings: Har piece ka ek smart summary/ID banate hain.

  • Vector Database: Sab embeddings ko ek smart library mein rakhte hain.

Now jab User koi question puchta hai:

  • Question bhi embedding mein convert hota hai.

  • System usse match karta hai database se.

  • Jo relevant info milta hai, wo LLM ko diya jata hai.

  • Fir LLM us info se ek badhiya answer generate karta hai.

Agar yaha tak padh liya to
🙏 Shukriya Doston!

Bas itna hi tha aaj ke liye.
Agar aapko RAG (Retrieval-Augmented Generation) samajh aaya ho, toh mission successful!

Milte hain agle post mein ek naye concept ke saath.
Happy learning! 🚀

#ChaiCode #GenAICohort

More from this blog

Jassi's Blog

9 posts