RAG: The big picture (Part - 2)

To understand RAG, we must take a few steps back and start with understanding what is AI. There are many definitions for what constitutes an AI. The one broadly accepted is that any system which matches or exceeds average human capability in a complex task is Artificial Intelligence. This doesn’t mean the system can do everything a human can but is as good or better than huma at one or more tasks. This is superset which consists of various systems: Image detection, robotics, Natural language processing.

The next subset is Machine learning. This consists of supervised and unsupervised learning. Basically, the model learns the complex patterns in the data and act upon it. This could be predicting the price of a house give details like location, square footage, number of bedrooms etc, or forecasting the stock price. A neural network is a machine learning system that works like the human brain, using interconnected "neurons" to recognize patterns, weigh information, and make decisions. In this case ‘neurons’ are complex mathematical functions. These neural networks have an input layer, output layer and at least one hidden layer of neurons. If a neural network is known as deep neural network, if it consists two or more hidden layers. These are widely used in complex tasks line image recognition, text classification, and sentiment analysis. Generative AI subset of DNN, which can generate or create new content similar to the training data. ChatGPT is perhaps the most well-known example of generative AI model. Dall-e the image generation model is another Gen AI model. When you provide additional context to a Generative AI model—beyond its original training data—you create a RAG system. This additional data guides the AI model, keeping the response relevant, up-to-date, or domain-specific information.

Generative AI refers to artificial intelligence systems designed to create new content, such as text, images, audio, or even code, by learning patterns from existing data. It does not simply retrieve or copy information but generates original outputs based on probabilistic predictions and contextual understanding. Generative AI models are trained on diverse datasets, including books, websites, and other digital content. Through training and fine-tuning, these models learn linguistic and conceptual patterns. Most of Gen AI models are based on transformers, which is a deep learning architecture. Enables models to handle sequences of data efficiently, capturing context and relationships between elements.

RAG (Retrieval Augmented Generation) is a modified Gen AI technique, in which you supply or augments additional information to the model. This helps model generate more precise and relevant answers using the additional information provided. The relevant information is retrieved from a data store specific to the system or domain. A RAG system reduces the scope of the query and helps in generating relevant answers, thus the answers/solutions can be domain specific. Answers generated by RAG are more reliable than a general purpose LLM due to augmented knowledge.