Introduction
Retrieval-Augmented Generation (RAG) has become a cornerstone for enhancing the factual accuracy of Large Language Models (LLMs) by integrating external knowledge. However, a significant challenge remains: not all queries require the same level of retrieval effort. While straightforward questions may be answered directly by the LLM's internal knowledge, complex multi-hop queries necessitate iterative retrieval processes.
Existing adaptive RAG systems often employ static classifiers trained on heuristic labels to decide the retrieval strategy. These "one-size-fits-all" approaches are frequently too rigid, failing to account for the fact that multiple strategies might lead to a correct answer. This rigidity often results in either unnecessary computational costs or suboptimal accuracy for difficult questions. To address this, we introduce MBA-RAG (Multi-arm Bandit-based Adaptive RAG), a framework that dynamically optimizes retrieval strategies based on query complexity through reinforcement learning.
Methodology
MBA-RAG reframes the selection of a retrieval strategy as a Multi-Armed Bandit (MAB) problem. In this framework, the system chooses between three distinct "arms" or strategies:
- Direct Answer: The LLM generates an answer without external retrieval.
- Retrieval Once: A single-hop retrieval step is performed before generation.
- Iterative Retrieval: Multiple retrieval steps are conducted to handle complex reasoning.
The architecture consists of a lightweight DistilBERT encoder that processes the user query to predict the optimal arm. Unlike traditional supervised methods, MBA-RAG employs an epsilon-greedy strategy for trial-and-error exploration. The model is guided by a fine-grained reward function that balances accuracy (measured by Exact Match and F1 scores) against efficiency. By penalizing excessive retrieval steps, the model learns to identify the most efficient path to a correct answer.
Experimental Results
The performance of MBA-RAG was evaluated across six datasets, spanning single-hop (SQuAD, Natural Questions, TriviaQA) and multi-hop (MuSiQue, HotpotQA, 2WikiMultiHopQA) tasks. Using FLAN-T5-XL (3B) as the backbone generator, MBA-RAG demonstrated superior performance compared to established baselines like Self-RAG and Adaptive-RAG.
Performance and Efficiency
MBA-RAG achieved a state-of-the-art average Exact Match (EM) of 38.80 and an F1 score of 48.61. Crucially, these accuracy gains were accompanied by a significant increase in efficiency. The average number of retrieval steps was reduced from 2.17 to 1.80, representing an approximate 20% reduction in retrieval costs.
Classification Accuracy
A key advantage of the bandit approach is its ability to learn from actual performance feedback rather than static heuristics. This leads to a more nuanced understanding of query complexity.
As illustrated in the analysis, MBA-RAG's classification accuracy reached 56.1%, outperforming previous adaptive methods. This improvement confirms that learning through interaction allows the model to better categorize queries and select the most appropriate retrieval depth.
Discussion and Conclusion
The success of MBA-RAG highlights that flexibility in strategy selection is superior to rigid classification. By allowing the model to explore multiple valid paths, it avoids the pitfalls of penalizing "correct but non-optimal" choices during training. The system effectively manages the accuracy-efficiency trade-off, becoming "lazy" for simple queries and "diligent" for complex ones.
While MBA-RAG shows robust performance, limitations include the sensitivity of the lightweight encoder on highly complex datasets like HotpotQA. Future work will explore scaling the framework to a broader range of retrieval strategies and improving the generalization of the encoder across diverse NLP tasks. In summary, MBA-RAG provides a scalable and efficient solution for adaptive retrieval, setting a new benchmark for cost-effective RAG systems.
Summary updated