Universal Tutor HubFuture skills, school & wellbeing
AI & Future Skills

What Is RAG? Retrieval-Augmented Generation Explained Simply

What Is RAG? Retrieval-Augmented Generation Explained Simply
Quick answer

Retrieval-augmented generation (RAG) is a technique where an AI system first searches a collection of trusted documents for passages relevant to a question, then gives those passages to a language model to write the answer. It lets AI answer from your own, up-to-date information and reduces hallucinations, as long as the right documents are retrieved.

The problem RAG solves

A language model only knows what was in its training data. It does not know your school's policies, your company's product manual, last week's price list, or the notes in your folder. If you ask about them, it will either say it does not know or, worse, make something up.

You could paste documents into every chat, but that does not scale to thousands of pages. RAG solves this by retrieving only the relevant pieces automatically and giving them to the model at the moment it answers.

How RAG works, step by step

Preparation (done once, then updated)

  1. Collect documents: PDFs, web pages, policies, notes, FAQs.
  2. Split into chunks: break them into passages of a few paragraphs.
  3. Create embeddings: convert each chunk into an embedding, a list of numbers that represents its meaning. Passages about similar topics end up with similar numbers.
  4. Store in a vector database: a database designed to find embeddings that are close to each other.

Answering a question

  1. The user asks: "Can I reschedule a session less than 24 hours before?"
  2. The question is converted into an embedding.
  3. The system searches the vector database for the most similar chunks, such as the rescheduling section of the policy.
  4. Those chunks are inserted into the prompt with instructions: "Answer using only the information below and cite the section."
  5. The language model writes an answer grounded in the retrieved text.

Where RAG is used

  • Customer support assistants that answer from help-centre articles.
  • Internal company assistants that search policies and documentation.
  • Study assistants that answer from a student's notes or a course syllabus.
  • Legal, medical and research tools that must point to sources.

What can go wrong

RAG is powerful but not magic:

  • Bad retrieval: if the search finds the wrong passages, the answer will be wrong, confidently.
  • Poor chunking: splitting documents in awkward places loses context.
  • Outdated documents: the answer is only as current as the stored data.
  • Ignoring the context: models sometimes still add information not in the sources.

Good RAG systems therefore test retrieval quality, re-rank results, show citations, and are evaluated on real questions before launch.

RAG versus fine-tuning

RAGFine-tuning
What it doesGives the model relevant documents at answer timeChanges the model's behaviour by further training
Best forFacts that change, private knowledge, citationsStyle, format, specialised behaviour
UpdatingAdd or edit documentsRetrain the model
Cost and effortUsually lowerUsually higher

Many real systems use RAG for knowledge and prompting or light fine-tuning for style.

Learn to build RAG

RAG is one of the most in-demand skills for AI developers because almost every organisation wants an assistant that answers from its own information. In our generative AI development course, students build a document Q&A assistant with citations as one of their main projects. Beginners can start by building a simple chatbot.

Frequently asked questions

Do I need to code to build a RAG system?

Some no-code tools offer document-based assistants, which use RAG behind the scenes. Building a reliable custom system usually requires Python or JavaScript.

Does RAG eliminate hallucinations?

It reduces them significantly when retrieval is good, but does not eliminate them. Citations and testing remain important.

What is a vector database?

A database that stores embeddings and quickly finds the ones most similar in meaning to a query.

Future Skills Faculty, AI, software and digital skills instructors

Our Future Skills Faculty are working developers, data specialists, designers, marketers and automation engineers who teach AI and technology courses at Universal Tutor Hub. Every guide is written and reviewed by instructors who use these tools in paid client work.

Book a free demo session

Meet your tutor, get a personal learning plan and decide with no pressure. No card required.

WhatsAppFree demo