Retrieval-Augmented Generation (RAG)
What RAG in AI is
Retrieval augmented generation, or RAG, is a way of using a language model in which, before answering, the system searches a set of your own documents for the relevant passages and passes them to the model. The model answers from that material, not only from what it learned during training.
The practical difference is large. A language model on its own does not know your contracts, your tender specifications or your internal procedures, and it can make up an answer that sounds right. With RAG the answer rests on specific texts and can show where each piece of information comes from.
How retrieval augmented generation works
A RAG system has two parts:
Indexing
Documents are split into passages and each passage is turned into a vector, a list of numbers that represents its meaning. Those vectors are stored in an index, usually a vector database.
Retrieval and generation
When someone asks a question, the question is also turned into a vector. The system looks for the passages closest in meaning, not just in exact words, and hands them to the model along with the question. The model writes the answer using those passages and can cite the source document and page.
RAG vs fine-tuning
There are two ways to make a model work with your own knowledge: retrain it (fine-tuning) or use RAG. Fine-tuning changes how the model behaves and is useful for teaching it a style or a format. RAG leaves the model untouched: it changes the information the model receives with each query. If documents change often or you need to know where each answer comes from, RAG is usually the more practical option, because you only need to add new documents to the index.
A simple example
A bid specialist asks what late-delivery penalties a contract has. A RAG system searches that tender's documents for the passages about penalties, passes them to the model, and the model answers with the figure and a reference to the document where it appears. The specialist can open the original and check it.