RAG (Retrieval-Augmented Generation)
The technique of fetching relevant documents from a knowledge base and inserting them into an LLM's context before it answers — so the answer is grounded in actual sources rather than just the model's training data. The standard way to give an LLM current, private, or verifiable knowledge.
Mechanic: the user's question is turned into an embedding, a vector search fetches the most relevant text pieces (chunks) from a database, and these are pasted into the prompt as context. The model answers based on the retrieved material and can cite sources. Win: reduced hallucination, fresh/private facts without retraining, traceability. Problem: the quality hinges entirely on retrieval ("garbage in, garbage out"), chunking strategy, and getting the right material ranked highly. Improvements: reranking, hybrid search, query expansion, semantic chunking. Coined in a Meta/FAIR paper in 2020 and became the dominant architecture for LLM apps with their own data. Related to chunking and hybrid search.