RAG System Using Smart Chunking and Quantization
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Large Language Models (LLMs) are resource-intensive, require expensive retraining when underlying information changes, and may 'hallucinate' factually incorrect information, especially in domain-specific contexts like medicine where accurate and up-to-date information is crucial.
Innovation Solution
The implementation of retrieval augmented generation (RAG) systems that utilize a smaller, locally maintained LLM in conjunction with an external database. This system retrieves relevant documents from the database based on user queries, which are then used to inform the LLM's responses, enhancing accuracy and reducing resource requirements.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a large LLM is used to provide accurate domain-specific information, then response accuracy is improved, but computational resources and memory requirements increase
Solution Approach 1:
The system segments the knowledge base into domain-specific documents and retrieves only relevant portions needed for answering queries, rather than relying on a large LLM to contain all knowledge internally. This divides the problem into: (1) a smaller LLM for reasoning, and (2) an external retrieval system for accessing domain-specific information.
Solution Approach 2:
The system introduces an intermediary retrieval mechanism that acts as a bridge between the smaller LLM and the domain-specific knowledge base. The retriever fetches relevant documents based on query understanding, and the smaller LLM uses these retrieved documents to generate accurate responses, eliminating the need for a large LLM.
2Reliability
If a large LLM is trained on domain-specific data to improve accuracy, then response quality is improved, but training cost and time increase
Solution Approach 1:
The system performs preliminary organization of domain-specific data into a structured knowledge base with metadata and indexing before deployment. This preliminary action enables efficient retrieval during inference without requiring time-consuming training processes, allowing the smaller LLM to access relevant information quickly when needed.
3Reliability
If a large LLM is used to ensure up-to-date information, then knowledge currency is improved, but retraining cost increases when information changes
Solution Approach 1:
The system implements a dynamic knowledge base where domain-specific documents can be added, updated, or removed without retraining the LLM. The retrieval system automatically adapts to new information by indexing updated documents, allowing the model to maintain current knowledge through simple document updates rather than expensive retraining processes.
4Use of energy by moving object
If a smaller LLM is used to reduce resource requirements, then computational efficiency is improved, but response accuracy deteriorates
Solution Approach 1:
The system merges a smaller LLM with an external retrieval-augmented generation system. The smaller LLM handles reasoning and response generation efficiently, while the retrieval system supplements it with relevant domain-specific information from the knowledge base. This combination allows the smaller LLM to achieve accuracy comparable to or exceeding larger models by accessing external knowledge when needed.
Data Source
AI summary
Embodiments described herein provide systems and methods for retrieval augmented generation. Embodiments herein include a pipeline for database construction from unlabeled data. Embodiments also include smart chunking techniques for more efficient retrieval. Embodiments also include quantization of a sentence embedding model used in the retrieval process, resulting in a faster more lightweight overall system. Use of a lightweight LLM allows for local LLM inference, increasing data privacy.


