Abstract
Agent-UniRAG is a novel framework designed to empower small, open-source Large Language Models (LLMs), such as Llama-3-8B, with advanced multi-hop reasoning capabilities for Retrieval-Augmented Generation (RAG). By employing a unified agentic loop and training on the novel SynAgent-RAG synthetic dataset, the framework enables smaller models to match or even outperform significantly larger closed-source models in accuracy and explainability. This paper details the architecture, data synthesis process, and empirical results demonstrating the effectiveness of Agent-UniRAG across diverse single-hop and multi-hop benchmarks.
Introduction
Retrieval-Augmented Generation (RAG) has become the standard for grounding AI outputs in external facts. However, most RAG systems are specialized: they are either optimized for simple, single-document lookups (Naive RAG) or complex, multi-step reasoning (Advanced RAG). In real-world scenarios, user queries vary in complexity, and pre-emptive classification of these queries often lacks the necessary flexibility. Furthermore, high-performing multi-hop RAG systems typically depend on massive, expensive models like GPT-4. Agent-UniRAG addresses these challenges by providing a unified, explainable, and open-source framework that operates efficiently on smaller hardware.
The Agent-UniRAG Framework
Agent-UniRAG treats the LLM as a "controller" within a reasoning loop, following a ReAct (Reasoning + Acting) pattern. The framework consists of four core modules that work iteratively to resolve queries:
- Planning Module: Determines whether the agent requires additional information or has sufficient evidence to generate a final answer.
- Search Tool: Formulates and executes queries against an external knowledge base.
- Reflector Module: Acts as a critique step, evaluating retrieved documents to filter out noise and irrelevant information before passing them back to the agent.
- Working Memory: Maintains a log of previous thoughts and actions, preventing circular reasoning and ensuring a traceable logic path.
To enable these capabilities in smaller models like Llama-3-8B, the authors employed Knowledge Distillation. GPT-4 served as a "teacher" model to generate high-quality reasoning paths, which were then used to fine-tune the smaller "student" model on the specialized SynAgent-RAG dataset.
Data Synthesis with SynAgent-RAG
The framework's success is underpinned by SynAgent-RAG, a synthetic dataset specifically designed to train RAG agents.
- Scale: The dataset includes 16,987 training samples and 1,197 testing samples.
- Source: It is built using Wikipedia’s "Vital Articles" (Level 5), covering a broad spectrum of human knowledge.
- Benchmarks: Evaluation was conducted across six industry-standard benchmarks, including single-hop (SQuAD, Natural Questions, TriviaQA) and multi-hop (MusiQue, HotpotQA, 2WikiMultiHopQA) tasks.
Key Results and Insights
Agent-UniRAG demonstrates superior performance across various benchmarks, often surpassing "Adaptive RAG" systems that utilize larger models like GPT-3.5.
- Single-Hop Performance: On the TriviaQA benchmark, Agent-UniRAG (Llama-3-8B) achieved an F1 score of 72.5, notably higher than Adaptive-RAG's 66.5.
- Multi-Hop Competitiveness: The model reached a 59.9 F1 score on HotpotQA, outperforming the state-of-the-art IRCoT method (58.3).
- The Importance of Reflection: The Reflector module is critical for multi-hop tasks. By filtering out irrelevant search results, it prevents the LLM from being derailed by noise. Ablation studies show that removing the Reflector significantly degrades performance on complex tasks like MusiQue.
- Ablation Analysis: Removing the Planning Module leads to a drastic drop in performance (e.g., from 30.4 to 10.2 EM on MusiQue), confirming that the agentic loop is the primary driver of the system's success.
Conclusion
Agent-UniRAG represents a significant advancement for open-source RAG. By proving that reasoning is not solely a function of model size, it makes sophisticated AI accessible to a wider audience. While the iterative nature of the agentic loop introduces some inference latency, the gains in accuracy and the ability to handle complex queries in a unified manner are substantial. Future work will focus on optimizing inference speed and expanding the framework's versatility to include non-retrieval tasks.
Summary updated