From the course: RAG and Fine-Tuning Explained

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

The RAG flow

The RAG flow

- As a flow chart, this is how a RAG system works. When a request comes in, an LLM is used to parse the meaning of the request and transform it into a query for whatever data source and knowledge-based it's attached to. That could be a standard database accessed via an API or an array of embeddings or a vector database, or even a cookbook, and we refer to it as the grounded truth. The LLM functions as a translator, turning the natural language request into a software query. Then the grounded truth data source processes the request and returns the data to the LLM. Now the LLM combines the original request with the newly retrieved data and produces an answer. This process should produce an accurate answer, but because LLMs are probabilistic and non-deterministic, the accuracy can be off. To reduce this risk, it's become fairly standard to add an additional verification loop here by returning the generated response along with the retrieved data to the LLM and asking it to make sure the…

Contents