
%20for%20AI%C2%A0Agents.webp)
In 2020, Patrick Lewis introduced the term Retrieval Augmented Generation (RAG) in a groundbreaking paper, positioning it as a key method for improving the accuracy and reliability of generative AI models. The method has gained widespread acceptance, and more recently, he has apologized for the unappealing acronym.
As AI Agents continue to evolve and integrate multiple generative models, understanding concepts like RAG is crucial for AI enthusiasts and our community. This knowledge will serve as the foundation for creating dynamic AI Agents and Agent Collectives on the Theoriq protocol.
RAG, or Retrieval Augmented Generation, is a technique that enhances AI’s ability to provide accurate, up-to-date responses. Imagine if every time you asked AI a question, it could quickly access the latest information from the Internet or a large database. That’s what RAG does. It helps Large Language Models (LLMs) to use up-to-date facts instead of solely relying on their pre-training data.
Before we dive deeper into RAG, it’s important to understand pre-training data and how LLMs work. LLMs are trained on vast amounts of text data to perform basic language tasks and follow instructions, building an understanding of language and general knowledge up to a certain point in time. This pre-training allows LLMs to generate human-like text.
However, pre-trained, out of the box LLMs have limitations:
This is why current AI chatbots, like ChatGPT, are not search engines. While they can generate creative responses, under the hood they essentially predict the next word and may struggle with real-time facts and real-world scenarios.
Imagine asking an AI Agent, "What should I wear today?" Without RAG, it might give a generic answer like, “how about something comfortable, like jeans and a t-shirt?”. But with RAG, the same AI interaction can be programmed to have the persona of a ‘Stylist’ that can check the latest weather report, consider the occasion you’re dressing for, and analyze the latest styling trends – it would then suggest something that is tailored to your needs.
Once we add programming to our interactions with AI, like adding a Stylist persona, we call these tools ‘Agents’. At Theoriq, we define AI Agents as follows:
“AI agents are autonomous software systems that leverage modern generative AI models to plan, access data, use tools, make decisions, and interact with the real world to perform specific functions.” Theoriq Team. (2024). Theoriq: The AI Agent Base Layer.

The typical workflow for RAG involves chunking documents into smaller pieces, computing embeddings for each chunk, and storing them in a vector database. When a question is asked, the system retrieves the most relevant chunks using a similarity metric, which helps the LLM generate a more accurate and contextually relevant response (that's where Retrieval Augmented Generation comes from - you retrieverelevant info and generate a response with the augmented context). This process might also include intermediate steps like re-ranking or filtering the retrieved information.
New Words Alert 🚨
Theoriq is a DeFi strategy curator. It curates on-chain vaults that turn tokenized assets into risk-managed yield: curators set the strategy and the risk limits, and AI-assisted systems execute and monitor within them. Its flagship vault, AlphaVault ETH, applies this framework to ETH-native yield, and the Theoriq Gold Vault extends it to tokenized gold.