Retrieval-augmented generation (RAG) is a technique that finds relevant passages from trusted sources and adds them to an LLM’s prompt, so its answers are grounded in that content rather than memory alone.

Definition
Retrieval-augmented generation combines two steps: retrieval, which searches a collection of documents for the passages most relevant to a question, and generation, where a large language model writes an answer using those passages as context. The model is instructed to rely on the supplied material and, ideally, to cite it. This lets an LLM answer questions about private, specialized or recently updated information it never saw during training.
RAG has become the default pattern for knowledge assistants, support bots and internal search because it is cheaper and faster to update than retraining a model. When a policy changes, you update the document and re-index it; the next answer reflects the change. It also improves trust, since users can check the cited sources. RAG reduces hallucination but does not remove it: if retrieval surfaces the wrong passage, or none at all, the model can still produce a confident but incorrect answer.

How it works
First, the source content is prepared. Documents are collected from places such as a wiki, a help center, PDFs or a database, cleaned, and split into chunks of a manageable size. Each chunk is converted into an embedding, a numeric vector that captures its meaning, and stored in a vector database or search index along with metadata such as title, date and access permissions.
When a user asks a question, the system embeds the question the same way and looks up the chunks with the closest meaning, often combined with keyword search and a re-ranking step to improve precision. Permission filters make sure the user only retrieves content they are allowed to see. The top passages are then inserted into the prompt with instructions to answer only from them and to say so when the answer is not there.
The LLM generates a response, usually with citations pointing back to the source chunks. Good RAG systems are evaluated on two levels: whether retrieval found the right material, and whether the answer used it faithfully. Most quality problems trace back to the first level, through poor chunking, stale content, missing documents or weak search, so tuning retrieval is where much of the engineering effort goes.
Keep learning
Put it into practice
AI consulting, LLM and generative AI applications, NLP and AI integration engineered into the products and systems you already run.
Explore serviceCustom AI chatbots and conversational assistants that resolve customer and employee questions using your own knowledge, systems and policies.
Explore serviceFAQ
Not always. A vector database is the common choice because it searches by meaning, but small collections can work with a plain search index, and many relational databases and search engines now support vector search alongside keyword search. Hybrid search, which combines both, often retrieves better results than either alone, especially for product codes, names and exact phrases.
It reduces them substantially when retrieval works well, because the model has the right facts in front of it. It does not eliminate them. Clear instructions to answer only from sources, citations, an explicit “I could not find this” path and regular evaluation against real questions are what keep the remaining errors rare and visible.
Connect the indexing pipeline to the source systems so new and changed documents are re-chunked and re-embedded automatically, and deleted ones are removed. Track document owners and review dates so stale content gets fixed at the source. Monitoring which questions return no good match also shows where the knowledge base has gaps.
Talk to a solution architect about where it fits in your roadmap.
