Skip to content

Life as I know it!

Menu
  • About Me
Menu

RAG : Retrieval Augmented Generation

Posted on January 5, 2026June 28, 2026 by soubhagya

What is the need for RAG?

LLMs are taught on a vast amount of data. They can answer queries based on the trained data set. If you ask any query about things not covered in the dataset, LLMs may hallucinate and provide incorrect answers.
LLMs are very powerful, but are also costly to train. Only a handful of companies have the required capability and resources for training LLMs.
LLMs currently train on data sets with a cutoff date. So any recent public data is not part of their training data set. Organizations have their own proprietary and private data which is not used for LLM training. Some datasets change frequently and are very dynamic.
There are few ways to incorporate the recent or private company data. The costliest option is to retrain the LLM using new data. RAG is a simpler and cheaper alternative.

Understanding RAG

Retrieval Augmented Generation name is self explanatory. While querying the LLMs we add additional data specific to our requirement. The LLM uses this augmented information to generate responses that are more relevant to the given context.
If the additional data is small, we can simply provide all data to LLMs as part of our prompts. But LLMs have a limited context window. LLMs with larger context windows are generally more expensive. Also too much data in context adversely affects the quality of results.
In many cases the additional data to consider is huge. In those cases, RAG is useful. RAG helps us to specify only the relevant data to the context instead of all additional data.
There are various ways to specify the relevant data. It is essentially a search problem. One can just grep a list of files which will be slower. One can also use OpenSearch or Elastic Search to do textual search to find relevant data.
However most RAG solutions prefer embedding-based vector stores. All the additional data sets are converted into a vector representation and stored in a vector database. During querying, the same embedding model is used to identify the most relevant information.

How is RAG done?

RAG is done in two stages.

Document/Data Ingestion Step

In this step, the documents i..e datasets are ingested into the storage. As specified above, people generally prefer vector databases. This can be done once or in regular intervals to maintain freshness of content.
The documents are passed through an embedding model. The embedding model converts the data into vector representations. The vector representations are stored in a vector database.

Querying Step


This happens in real time when the user submits a prompt or query to the system.
The specific query is passed through the same embedding model. The resulting vector representation of the query or prompt is used to pull relevant document or document chunks from the vector database.
The original user prompt is then augmented with the retrieved information to create an augmented prompt for the LLM. LLM processes this augmented prompt and generates the response.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

  • Data centers in Space
  • [Review] A Cup of Zen
  • Being an Authentic Blogger
  • Using GenAI for Effective Learning
  • TokenMaxxing and Goodhart’s Law
  • July 2026
  • June 2026
  • May 2026
  • April 2026
  • January 2026
  • August 2025
  • February 2025
  • September 2024
  • November 2023
  • August 2020
  • May 2020
  • October 2018
  • October 2009
  • March 2006
  • Aerospace
  • Book Review
  • Gen AI
  • Life
  • Literature
  • Management
  • Odia
  • Opinion
  • Personal
  • Programming
  • Reading
  • Security
  • Software Engineering
  • Uncategorized

Aerospace Book Review DeepSeek GenAI Life Literature LLM management Odia Ollama Opinion Personal Programming Reading Security Software Engineering Writing

© 2026 Life as I know it! | Powered by Minimalist Blog WordPress Theme

Website security powered by MilesWeb