AI Newsway
Back to glossary

Retrieval-Augmented Generation

AI and machine learning

Retrieval-augmented generation (RAG) is a technique that fetches relevant documents from an external knowledge source and places them in a language model's context before it answers. A typical pipeline splits source documents into chunks, converts each chunk into a vector embedding, and stores them in a vector database. At query time the user's question is embedded, the closest chunks are retrieved, and they are inserted into the prompt with an instruction to answer only from the supplied material. The model then generates a response grounded in that text and can cite it. This lets a system use private, current, or domain-specific information without retraining the model, and it reduces hallucination because the answer has source material to draw on. Enterprise search, customer support assistants, and documentation chatbots are the common applications, built on vector stores such as pgvector, Pinecone, or Qdrant. Retrieval quality sets the ceiling for the whole system. If the search step returns the wrong chunks, the model answers confidently from irrelevant text, so teams add hybrid keyword and vector search, reranking, and evaluation of retrieval separately from generation. RAG complements fine-tuning, since retrieval supplies facts while fine-tuning shapes behavior and format.