What is DeepRAG
DeepRAG is a new retrieval-augmented generation (RAG) framework jointly launched by the Chinese Academy of Sciences, the University of Science and Technology of China, and Tencent WeChat AI, enhancing the performance of large language models (LLMs) in reasoning and retrieval tasks. By modeling retrieval-augmented reasoning as a Markov decision process (MDP), it introduces two key components, "Retrieval Narrative" and "Atomic Decision", achieving a structured and adaptive retrieval process. The core of DeepRAG lies in dynamic decision-making: at each step, the model decides based on the current state whether to retrieve external knowledge or rely solely on its own parametric knowledge for reasoning.
Main Features of DeepRAG
- Dynamic Retrieval Decision: DeepRAG can dynamically decide at each step whether external knowledge retrieval is needed, or whether to rely solely on the model's own parametric knowledge for reasoning. It avoids unnecessary retrieval operations, improves retrieval efficiency, and simultaneously reduces noise and inference latency.
- Structured Retrieval Process: By introducing "Retrieval Narrative", DeepRAG ensures that the retrieval process is structured and adaptive. The model generates new sub-queries based on previously retrieved information, progressively advancing the reasoning process, and better handling complex queries.
- Knowledge Boundary Calibration: Through the "Chain of Calibration" method, DeepRAG helps the model more accurately identify the boundaries of its own knowledge. The model can better determine when external knowledge retrieval is needed, can rely on its own knowledge for reasoning, and improves the accuracy and reliability of answers.
- Improved Retrieval Efficiency and Answer Accuracy: Experiments show that DeepRAG significantly improves answer accuracy on multiple open-domain question-answering datasets (an average improvement of 21.99%), while reducing the number of retrievals and optimizing retrieval efficiency.
- Generalization Ability and Robustness: DeepRAG shows good generalization ability and robustness in time-sensitive and out-of-distribution question-answering tasks, and can adapt to different question-answering scenarios and data distributions.
Technical Principles of DeepRAG
- Markov Decision Process (MDP) Modeling: DeepRAG models the retrieval-augmented reasoning process as an MDP, representing a partial solution to the original problem. The state st includes the input question x and the sub-queries and their intermediate answers so far. It includes two sub-decisions:
- Termination Decision: Decides whether to continue generating the next sub-query or directly generate the final answer.
- Atomic Decision: Decides whether to retrieve external knowledge or rely solely on the model's parametric knowledge.
- Transitions: Updates the state according to the action. If retrieval is decided, the model retrieves relevant documents and generates an intermediate answer; if no retrieval is decided, it directly generates an intermediate answer.
- Rewards: Evaluates states based on answer correctness and retrieval cost. The reward function maximizes answer correctness while minimizing retrieval cost.
- Binary Tree Search: DeepRAG uses a binary tree search method to construct a reasoning path for each subquery. For each subquery, the model generates two branches: one branch directly generates an answer based on parametric knowledge, and the other branch generates an answer by retrieving external knowledge. In this way, the model explores different retrieval strategies and generates a complete reasoning path from the initial question to the final answer. Binary tree search can decompose the problem and thoroughly examine the impact of retrieval choices on the final answer.
- Imitation Learning: The purpose of imitation learning is to enable the model to learn effective retrieval patterns. A priority queue is used to efficiently explore potential reasoning trajectories, prioritizing paths with lower retrieval costs. Synthetic data is generated through binary tree search, and the reasoning processes that reach the correct final answer are extracted. The model is fine-tuned using the synthetic data to improve its termination decision-making and atomic decision-making capabilities, while also enhancing its ability to decompose queries and generate reliable intermediate answers.
- Chain of Calibration: The Chain of Calibration method further optimizes the model's awareness of its own knowledge boundaries. Synthetic preference data is used to determine when retrieval is needed. The data is generated based on the optimal path and indicates the preferred retrieval strategy for each subquery. The model is fine-tuned using this preference data to enhance its atomic decision-making ability based on internal knowledge boundaries. Through the Chain of Calibration method, the model can more accurately identify when external knowledge retrieval is needed and can rely on its own knowledge for reasoning.
DeepRAG project address
- arXiv technical paper:https://arxiv.org/pdf/2502.01142
DeepRAG application scenarios
- Open-domain question answering: DeepRAG can handle complex multi-hop question answering tasks, generating accurate answers by gradually decomposing questions and dynamically retrieving relevant information.
- Knowledge base question answering: In knowledge base question answering, DeepRAG can combine external knowledge bases (such as Wikipedia) with the model's own knowledge to provide more accurate answers.
- Intelligent customer service and virtual assistants: DeepRAG can be applied to intelligent customer service systems, providing more accurate and timely customer support through dynamic retrieval and reasoning.
- Education and learning assistance: In the field of education, DeepRAG can help students and teachers obtain more accurate knowledge and information. It dynamically generates learning materials and practice questions according to students' learning progress and needs.
- Medical and health consultation: DeepRAG can be used for medical and health consultation, providing accurate health advice by retrieving the latest medical research and clinical guidelines.