What it is used for
RAG is most often used to build question answering assistants on top of your own documents: product manuals, office policies, customer support question collections, and archives of regulations. The user asks in ordinary language, and the assistant answers from the content of those documents instead of inventing from general knowledge.
For businesses and offices, RAG means knowledge scattered across many files can be questioned as if you were asking a staff member who has memorized all of them. For general readers, RAG is the reason some chatbots can now cite the sources of their answers and respond to specific things they could never have learned in training, such as the content of a document created yesterday.
How to use it
For end users, using RAG is as simple as using a finished product: upload documents or connect the data source the service offers, then ask specific questions. Ask for answers with source citations, and open those sources to check that the answer really came from them.
For builders, LangChain's documentation divides the flow into two big stages. The first stage is indexing: documents are loaded, split into small chunks, converted into embeddings, and stored. An embedding is a list of numbers that captures the meaning of a piece of text, so a computer can find the chunks whose meaning is closest to a question. The second stage happens when a question arrives: the relevant chunks are retrieved, handed to the model together with the question, and the model composes its answer from that material.
Practitioner level
The quality of a RAG system is largely decided by the quality of its retrieval. Documents split into chunks that are too large make search imprecise; chunks that are too small lose context. Builders therefore tune chunk size, the number of chunks retrieved, and ways of rewriting the question so the search lands better.
LangChain's documentation shows two main patterns. The two step RAG chain always retrieves first and then answers with a single model call, which makes it fast and predictable. Agentic RAG gives the model freedom to decide when and what to retrieve, which suits layered questions but is slower and harder to control.
Expert level
The original RAG paper distinguishes two kinds of memory. Parametric memory is the knowledge stored inside the model's weights from training. Non-parametric memory is an index of documents outside the model that can be replaced and updated at any time. The Facebook AI researchers paired a text generating model with a neural retriever over a dense index of Wikipedia, and trained the two together.
The same paper distinguishes two forms. RAG-Sequence uses the same retrieved documents for the whole answer, while RAG-Token may use different documents for each generated token. The big advantage of this approach is that the origin of an answer can be shown, and knowledge can be updated simply by changing the index, without retraining the model at great expense.
Limits and risks
RAG reduces, but does not remove, the model's habit of making things up. If retrieval pulls the wrong or incomplete chunks, the model can still compose a confident sounding answer from faulty material. A RAG answer is only as good as the documents it searches: outdated documents produce outdated answers.
There are also security risks. Documents connected to the system may contain hidden instructions written by someone else to influence the answers, and confidential documents uploaded to a third party service leave their owner's control. Source citations therefore still need to be read by a human, especially for important decisions, and document access should be limited to what is needed.
