Bodham Labs LEARN

What is RAG?

How to make AI answer from your own documents — explained simply.

Start with an example

Say your coaching institute has a 200-page fee policy, timetable and rulebook. A parent asks on WhatsApp: "What is the last date for the second instalment?"

An AI like ChatGPT has never read your policy, so it will either refuse or guess a wrong date. RAG solves exactly this problem.

RAG = find first, then write

RAG stands for Retrieval-Augmented Generation. Think of it as an open-book exam:

  • 1. Retrieval: when a question arrives, the system finds the 3–5 most relevant passages in your documents.
  • 2. Augmented: those passages are given to the AI model with the question — "answer only from these."
  • 3. Generation: the model writes the answer from those passages, and can show its source.

So the AI answers by opening your book, not from memory.

How does it find the right passage?

Documents are split into small pieces (chunks). Each piece gets an embedding — a list of numbers that captures its meaning. The question gets an embedding too, and the pieces closest in meaning are pulled out. Good systems also run a keyword search alongside (hybrid search), so names, dates and codes are matched exactly.

Where does it help a business?

  • Customer support: correct answers on WhatsApp from your policy, price list and FAQs.
  • Inside the office: the right page from HR rules, SOPs or old contracts, instantly.
  • Education: answers to students' questions from notes and books, with page numbers.

Things to watch

  • A wrong passage gives a wrong answer. Build a test set of 20–30 real questions and check it after every change.
  • Private data: decide where the documents live and which AI service sees what.

Want to learn it, or have it built?

Students build a RAG app themselves in week 5 of our 6-week cohort. For businesses, we build "chat with your documents" for you.

Questions

What does RAG stand for?

Retrieval-Augmented Generation: first find the right information (retrieval), then write the answer from it (generation).

What is the difference between RAG and fine-tuning?

Fine-tuning retrains the model to change how it behaves. RAG leaves the model as it is and puts fresh documents in front of it for every question. When your documents change often, RAG is cheaper and simpler.

Does RAG stop AI from giving wrong answers?

Not completely, but it reduces them a lot, because the answer comes with its source passage, which a person can check. That is why we build a small test set with every RAG system.