Retrieval-augmented generation (RAG)
People Also Ask
What is retrieval-augmented generation?
Retrieval-augmented generation is an AI method that retrieves relevant information from external sources and gives it to a large language model as context before the model generates an answer.
How does RAG work?
A RAG system searches an indexed knowledge source, selects relevant information, adds it to the model’s prompt, and asks the model to answer using that context.
What are the main components of a RAG system?
The main components are knowledge sources, a content-processing and indexing pipeline, a retriever, an optional reranker, a prompt-building layer, and a generative language model.
What is the difference between RAG and fine-tuning?
RAG provides external information when a query is processed. Fine-tuning changes a model by training it on additional examples. RAG is generally better suited to changing factual knowledge, while fine-tuning is often used to adjust behavior, format, or task performance.
Does RAG eliminate hallucinations?
No. RAG can reduce unsupported answers by supplying relevant evidence, but the model may still misinterpret that evidence or add claims that the retrieved sources do not support.
What are common RAG use cases?
Common uses include customer support, enterprise search, document Q&A, research assistance, product information, compliance support, and AI agents that require current or private knowledge.
Does RAG require a vector database?
No. Vector databases are common because they support semantic retrieval, but RAG can also use keyword search, relational databases, search APIs, knowledge graphs, or hybrid search.
What are the limitations and security risks of RAG?
RAG can retrieve incorrect, incomplete, outdated, or unauthorized information. Production systems need source governance, access controls, protection against malicious retrieved content, and separate evaluation of retrieval and generated answers.