Archetypes of Generative AI
From knowledge base Generative AI to Action based Generative AI
Retrieval-Augmented Generation (RAG) patterns and agentic architecture are advanced concepts in AI system design.
RAG Patterns:
Retrieval-Augmented Generation combines the power of pre-trained language models with external knowledge sources to generate more informed and accurate outputs. Here are different types of RAG patterns:
- Dense RAG:Utilizes dense vector representations for retrieval. It’s suitable for datasets where semantic similarity is more important than exact keyword matching.
- Sparse RAG:Relies on sparse representations like TF-IDF for retrieval. It’s effective when keyword matching is crucial.
- Hybrid RAG:Combines both dense and sparse retrieval methods to leverage the strengths of each approach.
- Sequential RAG:Performs retrieval step-by-step, refining the search progressively to hone in on the most relevant information.
- Parallel RAG:Conducts retrieval in parallel to the generation process, allowing for simultaneous refinement of the output.
Agentic Architecture: Multiple RAG tied together using Workflows and Knowledge Bases
Agentic architecture refers to a system design where components are treated as agents with specific roles and capabilities. In the context of AI, this means:
- Modularity:The system is divided into distinct modules or agents, each responsible for a particular aspect of the task.
- Interactivity:Agents can interact with each other to exchange information and make decisions.
- Autonomy:Each agent has a degree of autonomy to perform its tasks without direct instruction for every action.
- Adaptability:Agents can adapt their behavior based on feedback from the environment or other agents.
In an agentic architecture for a generative AI platform, you might have agents dedicated to context retrieval, content generation, guardrail enforcement, and user interaction. Each agent works independently but collaborates with others to produce a cohesive output that aligns with the user’s request and system’s guidelines.
These concepts are part of the broader field of AI system design and are crucial for creating advanced, scalable, and efficient AI platforms. They ensure that the AI can handle complex tasks by breaking them down into manageable parts and leveraging external knowledge effectively.
GenAI platform requirements:
- Simple: Simple architecture where an application receives a query, sends it to the model, and returns the generated response to the user. This basic setup lacks guardrails, augmented context, and optimization¹.
- Complex :Enhancing the Context. The first step in expanding a platform involves adding mechanisms to augment each query , chunking plus adding necessary information, allowing the model to access external data enterprise applications datawarehouses Datalake resources and special tools for information gathering¹. Adding Guardrails in the workflow where ever necessary.Input and output guardrails are crucial for protecting the system and users. Input guardrails prevent private information leakage and model jailbreaking, while output guardrails ensure quality measurement and manage failures¹.Model Router and Gateway. Adding a model router and gateway supports complex pipelines and adds security layers to the system. Reducing Latency with Cache. Optimizing latency and costs with different types of caches, such as prompt, exact, and semantic cache¹. Complex Logic and Write Actions . To maximize the system’s capabilities, the platform should include complex logic and write actions¹. Observability and Orchestration. Observability allows monitoring and debugging of the system through metrics, logs, and traces. Orchestration involves chaining all the components together for efficient operation¹.
Source: Conversation with Copilot, 29/07/2024
(1) Building A Generative AI Platform – huyenchip.com. https://huyenchip.com/2024/07/25/genai-platform.html.
(2) Building A Generative AI Platform – Chip Huyen. https://huyenchip.com/blog/.
(3) 正在构建生成式AI应用平台https://huyenchip-CSDN blink-领先的开发者技术社区. https://blink.csdn.net/details/1768244.
(4) What I learned from looking at 900 most popular open source AI tools. https://huyenchip.com/2024/03/14/ai-oss.html.