$linuxjunkies
>

RAG

RAG (Retrieval-Augmented Generation) is an AI/ML technique that combines document retrieval with language model generation to provide answers grounded in external knowledge sources rather than just the model's training data.

RAG enhances large language models by retrieving relevant documents or data from a knowledge base before generating responses. Instead of relying solely on information learned during training, the system first searches for pertinent context, then uses that retrieved information to craft more accurate and up-to-date answers.

In Linux contexts, RAG is typically relevant when building AI applications or chatbots that need to reference documentation, logs, or configuration files. For example, a system could retrieve relevant man pages or error logs before generating troubleshooting suggestions.

The workflow is: (1) user submits a query, (2) system retrieves matching documents from a knowledge base, (3) those documents are fed into a language model along with the query, (4) the model generates an answer grounded in the retrieved context. This reduces hallucinations and makes responses more reliable and verifiable.

Related terms