Explain it simpler
A chatbot model only knows what it learned during training, so it does not know your company's own documents, and it may guess. Retrieval-augmented generation, or RAG, means looking up the right pieces of your documents first and handing them to the model along with the question, like giving a student the relevant textbook pages before an open-book exam. To get there, you cut documents into small passages, turn each passage into a list of numbers that captures its meaning, and save them in a database. When someone asks a question, you turn the question into numbers too, find the few closest passages, keep only the ones that person is allowed to see, and paste them into the prompt with instructions to answer only from them.
Daniel works in HR technology at Summit Freight, a fictional logistics company with offices in four countries. The new HR assistant has been live for a week when an employee in Toronto asks how many weeks of parental leave she gets. The assistant answers confidently, quoting a policy, and the number is wrong: it came from the German office's handbook. Worse, a manager notices the assistant once summarized a document from a confidential executive folder. The language model itself is fine. The problem sits in how documents were split, labeled and fetched before the model ever saw them. Where in the pipeline did things go wrong?
A large language model (LLM) only knows what was in its training data, and when asked about your private documents it may confidently invent answers, a behavior often called hallucination. Retrieval-augmented generation (RAG) fixes this by finding relevant passages from your own data at question time and putting them in the prompt, so the model answers from supplied facts rather than memory. RAG has two pipelines. The ingestion pipeline prepares your data ahead of time, and the query pipeline runs for every question. The data services from this domain, Cosmos DB, PostgreSQL with pgvector and Redis, sit in the middle as the vector store.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 8 more sections, 6 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.