What is Retrieval Augmented Generation (RAG)

Retrieval-Augmented Generation (RAG), is a technique in natural language processing (NLP) coined by Patrick Lewis and his research team in the paper Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks in 2020.

Consider RAG as an approach to enhance the output of LLMs. You would be wondering, how? Well, because RAG provides LLMs with relevant, and fresh data and documents. The data is real-time and context-specific.

RAG includes both retrieval and generation, therefore making it a powerful and awesome tool for applications that need up-to-date, detailed, and context-rich responses. Therefore, let us bifurcate the term RAG:

  • Retrieval: Search for relevant data and documents
  • Augmented: Adding it to the prompt context
  • Generation: Display it as a prompt response

Let us understand a situation where LLM models are used with and without the RAG approach.

LLM Without RAG

Without RAG, the LLM model is the only source of knowledge therefore some issues like hallucinations can occur. The information is old. The below figure will make the things more clear regarding the LLM process:

LLM Model without RAG

LLM With RAG

With RAG, the LLM model is grounded on source data and the information is always up to date. The data can be public data or specific to your use case.

Grounded on source data means the responses generated by the model are based on, and aligned with, actual information retrieved from reliable sources. The below figure will make the things more clear regarding the LLM with RAG process:

LLM Model with RAG


If you liked the tutorial, spread the word and share the link and our website Studyopedia with others.


For Videos, Join Our YouTube Channel: Join Now


Read More:

How RAG is better than traditional retrieval models
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading